repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
iipc/webarchive-commons
src/main/java/org/archive/io/ArchiveRecord.java
ArchiveRecord.available
public int available() { long amount = getHeader().getLength() - getPosition(); return (amount > Integer.MAX_VALUE? Integer.MAX_VALUE: (int)amount); }
java
public int available() { long amount = getHeader().getLength() - getPosition(); return (amount > Integer.MAX_VALUE? Integer.MAX_VALUE: (int)amount); }
[ "public", "int", "available", "(", ")", "{", "long", "amount", "=", "getHeader", "(", ")", ".", "getLength", "(", ")", "-", "getPosition", "(", ")", ";", "return", "(", "amount", ">", "Integer", ".", "MAX_VALUE", "?", "Integer", ".", "MAX_VALUE", ":", ...
This available is not the stream's available. Its an available based on what the stated Archive record length is minus what we've read to date. @return True if bytes remaining in record content.
[ "This", "available", "is", "not", "the", "stream", "s", "available", ".", "Its", "an", "available", "based", "on", "what", "the", "stated", "Archive", "record", "length", "is", "minus", "what", "we", "ve", "read", "to", "date", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/ArchiveRecord.java#L228-L231
train
iipc/webarchive-commons
src/main/java/org/archive/io/ArchiveRecord.java
ArchiveRecord.skip
protected void skip() throws IOException { if (this.eor) { return; } // Read to the end of the body of the record. Exhaust the stream. // Can't skip direct to end because underlying stream may be compressed // and we're calculating the digest for the record. int r = available(); while (r > 0 && !this.eor) { skip(r); r = available(); } }
java
protected void skip() throws IOException { if (this.eor) { return; } // Read to the end of the body of the record. Exhaust the stream. // Can't skip direct to end because underlying stream may be compressed // and we're calculating the digest for the record. int r = available(); while (r > 0 && !this.eor) { skip(r); r = available(); } }
[ "protected", "void", "skip", "(", ")", "throws", "IOException", "{", "if", "(", "this", ".", "eor", ")", "{", "return", ";", "}", "// Read to the end of the body of the record. Exhaust the stream.", "// Can't skip direct to end because underlying stream may be compressed", "...
Skip over this records content. @throws IOException
[ "Skip", "over", "this", "records", "content", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/ArchiveRecord.java#L238-L251
train
iipc/webarchive-commons
src/main/java/org/archive/io/GenerationFileHandler.java
GenerationFileHandler.rotate
public GenerationFileHandler rotate(String storeSuffix, String activeSuffix) throws IOException { return rotate(storeSuffix, activeSuffix, false); }
java
public GenerationFileHandler rotate(String storeSuffix, String activeSuffix) throws IOException { return rotate(storeSuffix, activeSuffix, false); }
[ "public", "GenerationFileHandler", "rotate", "(", "String", "storeSuffix", ",", "String", "activeSuffix", ")", "throws", "IOException", "{", "return", "rotate", "(", "storeSuffix", ",", "activeSuffix", ",", "false", ")", ";", "}" ]
Move the current file to a new filename with the storeSuffix in place of the activeSuffix; continuing logging to a new file under the original filename. @param storeSuffix Suffix to put in place of <code>activeSuffix</code> @param activeSuffix Suffix to replace with <code>storeSuffix</code>. @return GenerationFileHandler instance. @throws IOException
[ "Move", "the", "current", "file", "to", "a", "new", "filename", "with", "the", "storeSuffix", "in", "place", "of", "the", "activeSuffix", ";", "continuing", "logging", "to", "a", "new", "file", "under", "the", "original", "filename", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/GenerationFileHandler.java#L91-L95
train
iipc/webarchive-commons
src/main/java/org/archive/io/GenerationFileHandler.java
GenerationFileHandler.makeNew
public static GenerationFileHandler makeNew(String filename, boolean append, boolean shouldManifest) throws SecurityException, IOException { FileUtils.moveAsideIfExists(new File(filename)); return new GenerationFileHandler(filename, append, shouldManifest); }
java
public static GenerationFileHandler makeNew(String filename, boolean append, boolean shouldManifest) throws SecurityException, IOException { FileUtils.moveAsideIfExists(new File(filename)); return new GenerationFileHandler(filename, append, shouldManifest); }
[ "public", "static", "GenerationFileHandler", "makeNew", "(", "String", "filename", ",", "boolean", "append", ",", "boolean", "shouldManifest", ")", "throws", "SecurityException", ",", "IOException", "{", "FileUtils", ".", "moveAsideIfExists", "(", "new", "File", "("...
Constructor-helper that rather than clobbering any existing file, moves it aside with a timestamp suffix. @param filename @param append @param shouldManifest @return @throws SecurityException @throws IOException
[ "Constructor", "-", "helper", "that", "rather", "than", "clobbering", "any", "existing", "file", "moves", "it", "aside", "with", "a", "timestamp", "suffix", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/GenerationFileHandler.java#L156-L159
train
iipc/webarchive-commons
src/main/java/org/archive/util/iterator/LookaheadIterator.java
LookaheadIterator.next
public T next() { if (!hasNext()) { throw new NoSuchElementException(); } // 'next' is guaranteed non-null by a hasNext() which returned true T returnObj = this.next; this.next = null; return returnObj; }
java
public T next() { if (!hasNext()) { throw new NoSuchElementException(); } // 'next' is guaranteed non-null by a hasNext() which returned true T returnObj = this.next; this.next = null; return returnObj; }
[ "public", "T", "next", "(", ")", "{", "if", "(", "!", "hasNext", "(", ")", ")", "{", "throw", "new", "NoSuchElementException", "(", ")", ";", "}", "// 'next' is guaranteed non-null by a hasNext() which returned true", "T", "returnObj", "=", "this", ".", "next", ...
Return the next item. @see java.util.Iterator#next()
[ "Return", "the", "next", "item", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/iterator/LookaheadIterator.java#L57-L65
train
iipc/webarchive-commons
src/main/java/org/archive/util/ByteOp.java
ByteOp.readToNull
public static byte[] readToNull(InputStream is, int maxSize) throws IOException { byte[] bytes = new byte[maxSize]; int i = 0; while(i < maxSize) { int b = is.read(); if(b == -1) { throw new EOFException("NO NULL"); } bytes[i] = (byte) (b & 0xff); i++; if(b == 0) { return copy(bytes,0,i); } } // BUGBUG: This isn't the right exception!!! // TODO: just skip any more bytes until NULL or EOF // throw an EOF if we find it... produce warning, too throw new IOException("Buffer too small"); }
java
public static byte[] readToNull(InputStream is, int maxSize) throws IOException { byte[] bytes = new byte[maxSize]; int i = 0; while(i < maxSize) { int b = is.read(); if(b == -1) { throw new EOFException("NO NULL"); } bytes[i] = (byte) (b & 0xff); i++; if(b == 0) { return copy(bytes,0,i); } } // BUGBUG: This isn't the right exception!!! // TODO: just skip any more bytes until NULL or EOF // throw an EOF if we find it... produce warning, too throw new IOException("Buffer too small"); }
[ "public", "static", "byte", "[", "]", "readToNull", "(", "InputStream", "is", ",", "int", "maxSize", ")", "throws", "IOException", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "maxSize", "]", ";", "int", "i", "=", "0", ";", "while", "(", ...
Read, buffer, and return bytes from is until a null byte is encountered @param is InputStream to read from @param maxSize maximum number of bytes to search for the null @return array of bytes read, INCLUDING TRAILING NULL @throws IOException if the underlying stream throws on, OR if the specified maximum buffer size is reached before a null byte is found @throws ShortByteReadException if EOF is encountered before a null byte
[ "Read", "buffer", "and", "return", "bytes", "from", "is", "until", "a", "null", "byte", "is", "encountered" ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/ByteOp.java#L196-L216
train
iipc/webarchive-commons
src/main/java/org/archive/util/Base32.java
Base32.main
static public void main(String[] args) { if (args.length == 0) { System.out.println("Supply a Base32-encoded argument."); return; } System.out.println(" Original: " + args[0]); byte[] decoded = Base32.decode(args[0]); System.out.print(" Hex: "); for (int i = 0; i < decoded.length; i++) { int b = decoded[i]; if (b < 0) { b += 256; } System.out.print((Integer.toHexString(b + 256)).substring(1)); } System.out.println(); System.out.println("Reencoded: " + Base32.encode(decoded)); }
java
static public void main(String[] args) { if (args.length == 0) { System.out.println("Supply a Base32-encoded argument."); return; } System.out.println(" Original: " + args[0]); byte[] decoded = Base32.decode(args[0]); System.out.print(" Hex: "); for (int i = 0; i < decoded.length; i++) { int b = decoded[i]; if (b < 0) { b += 256; } System.out.print((Integer.toHexString(b + 256)).substring(1)); } System.out.println(); System.out.println("Reencoded: " + Base32.encode(decoded)); }
[ "static", "public", "void", "main", "(", "String", "[", "]", "args", ")", "{", "if", "(", "args", ".", "length", "==", "0", ")", "{", "System", ".", "out", ".", "println", "(", "\"Supply a Base32-encoded argument.\"", ")", ";", "return", ";", "}", "Sys...
For testing, take a command-line argument in Base32, decode, print in hex, encode, print @param args
[ "For", "testing", "take", "a", "command", "-", "line", "argument", "in", "Base32", "decode", "print", "in", "hex", "encode", "print" ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/Base32.java#L141-L158
train
iipc/webarchive-commons
src/main/java/org/archive/util/zip/GzipHeader.java
GzipHeader.readHeader
public void readHeader(InputStream in) throws IOException { CRC32 crc = new CRC32(); crc.reset(); if (!testGzipMagic(in, crc)) { throw new NoGzipMagicException(); } this.length += 2; if (readByte(in, crc) != Deflater.DEFLATED) { throw new IOException("Unknown compression"); } this.length++; // Get gzip header flag. this.flg = readByte(in, crc); this.length++; // Get MTIME. this.mtime = readInt(in, crc); this.length += 4; // Read XFL and OS. this.xfl = readByte(in, crc); this.length++; this.os = readByte(in, crc); this.length++; // Skip optional extra field -- stuff w/ alexa stuff in it. final int FLG_FEXTRA = 4; if ((this.flg & FLG_FEXTRA) == FLG_FEXTRA) { int count = readShort(in, crc); this.length +=2; this.fextra = new byte[count]; readByte(in, crc, this.fextra, 0, count); this.length += count; } // Skip file name. It ends in null. final int FLG_FNAME = 8; if ((this.flg & FLG_FNAME) == FLG_FNAME) { while (readByte(in, crc) != 0) { this.length++; } } // Skip file comment. It ends in null. final int FLG_FCOMMENT = 16; // File comment if ((this.flg & FLG_FCOMMENT) == FLG_FCOMMENT) { while (readByte(in, crc) != 0) { this.length++; } } // Check optional CRC. final int FLG_FHCRC = 2; if ((this.flg & FLG_FHCRC) == FLG_FHCRC) { int calcCrc = (int)(crc.getValue() & 0xffff); if (readShort(in, crc) != calcCrc) { throw new IOException("Bad header CRC"); } this.length += 2; } }
java
public void readHeader(InputStream in) throws IOException { CRC32 crc = new CRC32(); crc.reset(); if (!testGzipMagic(in, crc)) { throw new NoGzipMagicException(); } this.length += 2; if (readByte(in, crc) != Deflater.DEFLATED) { throw new IOException("Unknown compression"); } this.length++; // Get gzip header flag. this.flg = readByte(in, crc); this.length++; // Get MTIME. this.mtime = readInt(in, crc); this.length += 4; // Read XFL and OS. this.xfl = readByte(in, crc); this.length++; this.os = readByte(in, crc); this.length++; // Skip optional extra field -- stuff w/ alexa stuff in it. final int FLG_FEXTRA = 4; if ((this.flg & FLG_FEXTRA) == FLG_FEXTRA) { int count = readShort(in, crc); this.length +=2; this.fextra = new byte[count]; readByte(in, crc, this.fextra, 0, count); this.length += count; } // Skip file name. It ends in null. final int FLG_FNAME = 8; if ((this.flg & FLG_FNAME) == FLG_FNAME) { while (readByte(in, crc) != 0) { this.length++; } } // Skip file comment. It ends in null. final int FLG_FCOMMENT = 16; // File comment if ((this.flg & FLG_FCOMMENT) == FLG_FCOMMENT) { while (readByte(in, crc) != 0) { this.length++; } } // Check optional CRC. final int FLG_FHCRC = 2; if ((this.flg & FLG_FHCRC) == FLG_FHCRC) { int calcCrc = (int)(crc.getValue() & 0xffff); if (readShort(in, crc) != calcCrc) { throw new IOException("Bad header CRC"); } this.length += 2; } }
[ "public", "void", "readHeader", "(", "InputStream", "in", ")", "throws", "IOException", "{", "CRC32", "crc", "=", "new", "CRC32", "(", ")", ";", "crc", ".", "reset", "(", ")", ";", "if", "(", "!", "testGzipMagic", "(", "in", ",", "crc", ")", ")", "...
Read in gzip header. Advances the stream past the gzip header. @param in InputStream. @throws IOException Throws if does not start with GZIP Header.
[ "Read", "in", "gzip", "header", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/zip/GzipHeader.java#L112-L173
train
iipc/webarchive-commons
src/main/java/org/archive/util/zip/GzipHeader.java
GzipHeader.readInt
private int readInt(InputStream in, CRC32 crc) throws IOException { int s = readShort(in, crc); return ((readShort(in, crc) << 16) & 0xffff0000) | s; }
java
private int readInt(InputStream in, CRC32 crc) throws IOException { int s = readShort(in, crc); return ((readShort(in, crc) << 16) & 0xffff0000) | s; }
[ "private", "int", "readInt", "(", "InputStream", "in", ",", "CRC32", "crc", ")", "throws", "IOException", "{", "int", "s", "=", "readShort", "(", "in", ",", "crc", ")", ";", "return", "(", "(", "readShort", "(", "in", ",", "crc", ")", "<<", "16", "...
Read an int. We do not expect to get a -1 reading. If we do, we throw exception. Update the crc as we go. @param in InputStream to read. @param crc CRC to update. @return int read. @throws IOException
[ "Read", "an", "int", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/zip/GzipHeader.java#L213-L216
train
iipc/webarchive-commons
src/main/java/org/archive/url/UsableURI.java
UsableURI.getHostBasename
public String getHostBasename() throws URIException { // caching eliminated because this is rarely used // (only benefits legacy DomainScope, which should // be retired). Saves 4-byte object pointer in UURI // instances. return (this.getReferencedHost() == null) ? null : TextUtils.replaceFirst(MASSAGEHOST_PATTERN, this.getReferencedHost(), UsableURIFactory.EMPTY_STRING); }
java
public String getHostBasename() throws URIException { // caching eliminated because this is rarely used // (only benefits legacy DomainScope, which should // be retired). Saves 4-byte object pointer in UURI // instances. return (this.getReferencedHost() == null) ? null : TextUtils.replaceFirst(MASSAGEHOST_PATTERN, this.getReferencedHost(), UsableURIFactory.EMPTY_STRING); }
[ "public", "String", "getHostBasename", "(", ")", "throws", "URIException", "{", "// caching eliminated because this is rarely used", "// (only benefits legacy DomainScope, which should", "// be retired). Saves 4-byte object pointer in UURI", "// instances.", "return", "(", "this", ".",...
Strips www variants from the host. Strips www[0-9]*\. from the host. If calling getHostBaseName becomes a performance issue we should consider adding the hostBasename member that is set on initialization. @return Host's basename. @throws URIException
[ "Strips", "www", "variants", "from", "the", "host", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURI.java#L238-L247
train
iipc/webarchive-commons
src/main/java/org/archive/url/UsableURI.java
UsableURI.coalesceUriStrings
protected void coalesceUriStrings() { if (this.cachedString != null && this.cachedEscapedURI != null && this.cachedString.length() == this.cachedEscapedURI.length()) { // lengths will only be identical if contents are identical // (deescaping will always shrink length), so coalesce to // use only single cached instance this.cachedString = this.cachedEscapedURI; } }
java
protected void coalesceUriStrings() { if (this.cachedString != null && this.cachedEscapedURI != null && this.cachedString.length() == this.cachedEscapedURI.length()) { // lengths will only be identical if contents are identical // (deescaping will always shrink length), so coalesce to // use only single cached instance this.cachedString = this.cachedEscapedURI; } }
[ "protected", "void", "coalesceUriStrings", "(", ")", "{", "if", "(", "this", ".", "cachedString", "!=", "null", "&&", "this", ".", "cachedEscapedURI", "!=", "null", "&&", "this", ".", "cachedString", ".", "length", "(", ")", "==", "this", ".", "cachedEscap...
The two String fields cachedString and cachedEscapedURI are usually identical; if so, coalesce into a single instance.
[ "The", "two", "String", "fields", "cachedString", "and", "cachedEscapedURI", "are", "usually", "identical", ";", "if", "so", "coalesce", "into", "a", "single", "instance", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURI.java#L336-L344
train
iipc/webarchive-commons
src/main/java/org/archive/url/UsableURI.java
UsableURI.coalesceHostAuthorityStrings
protected void coalesceHostAuthorityStrings() { if (this.cachedAuthorityMinusUserinfo != null && this.cachedHost != null && this.cachedHost.length() == this.cachedAuthorityMinusUserinfo.length()) { // lengths can only be identical if contents // are identical; use only one instance this.cachedAuthorityMinusUserinfo = this.cachedHost; } }
java
protected void coalesceHostAuthorityStrings() { if (this.cachedAuthorityMinusUserinfo != null && this.cachedHost != null && this.cachedHost.length() == this.cachedAuthorityMinusUserinfo.length()) { // lengths can only be identical if contents // are identical; use only one instance this.cachedAuthorityMinusUserinfo = this.cachedHost; } }
[ "protected", "void", "coalesceHostAuthorityStrings", "(", ")", "{", "if", "(", "this", ".", "cachedAuthorityMinusUserinfo", "!=", "null", "&&", "this", ".", "cachedHost", "!=", "null", "&&", "this", ".", "cachedHost", ".", "length", "(", ")", "==", "this", "...
The two String fields cachedHost and cachedAuthorityMinusUserInfo are usually identical; if so, coalesce into a single instance.
[ "The", "two", "String", "fields", "cachedHost", "and", "cachedAuthorityMinusUserInfo", "are", "usually", "identical", ";", "if", "so", "coalesce", "into", "a", "single", "instance", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURI.java#L362-L371
train
iipc/webarchive-commons
src/main/java/org/archive/url/UsableURI.java
UsableURI.getReferencedHost
public String getReferencedHost() throws URIException { String referencedHost = this.getHost(); if(referencedHost==null && this.getScheme().equals("dns")) { // extract target domain of DNS lookup String possibleHost = this.getCurrentHierPath(); if(possibleHost != null && possibleHost.matches("[-_\\w\\.:]+")) { referencedHost = possibleHost; } } return referencedHost; }
java
public String getReferencedHost() throws URIException { String referencedHost = this.getHost(); if(referencedHost==null && this.getScheme().equals("dns")) { // extract target domain of DNS lookup String possibleHost = this.getCurrentHierPath(); if(possibleHost != null && possibleHost.matches("[-_\\w\\.:]+")) { referencedHost = possibleHost; } } return referencedHost; }
[ "public", "String", "getReferencedHost", "(", ")", "throws", "URIException", "{", "String", "referencedHost", "=", "this", ".", "getHost", "(", ")", ";", "if", "(", "referencedHost", "==", "null", "&&", "this", ".", "getScheme", "(", ")", ".", "equals", "(...
Return the referenced host in the UURI, if any, also extracting the host of a DNS-lookup URI where necessary. @return the target or topic host of the URI @throws URIException
[ "Return", "the", "referenced", "host", "in", "the", "UURI", "if", "any", "also", "extracting", "the", "host", "of", "a", "DNS", "-", "lookup", "URI", "where", "necessary", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURI.java#L380-L390
train
iipc/webarchive-commons
src/main/java/org/archive/url/UsableURI.java
UsableURI.hasScheme
public static boolean hasScheme(String possibleUrl) { boolean result = false; for (int i = 0; i < possibleUrl.length(); i++) { char c = possibleUrl.charAt(i); if (c == ':') { if (i != 0) { result = true; } break; } if (!scheme.get(c)) { break; } } return result; }
java
public static boolean hasScheme(String possibleUrl) { boolean result = false; for (int i = 0; i < possibleUrl.length(); i++) { char c = possibleUrl.charAt(i); if (c == ':') { if (i != 0) { result = true; } break; } if (!scheme.get(c)) { break; } } return result; }
[ "public", "static", "boolean", "hasScheme", "(", "String", "possibleUrl", ")", "{", "boolean", "result", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "possibleUrl", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "...
Test if passed String has likely URI scheme prefix. @param possibleUrl URL string to examine. @return True if passed string looks like it could be an URL.
[ "Test", "if", "passed", "String", "has", "likely", "URI", "scheme", "prefix", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURI.java#L461-L476
train
iipc/webarchive-commons
src/main/java/org/archive/format/http/HttpHeaders.java
HttpHeaders.write
public void write(OutputStream out) throws IOException { for(HttpHeader header: this) { header.write(out); } out.write(CR); out.write(LF); }
java
public void write(OutputStream out) throws IOException { for(HttpHeader header: this) { header.write(out); } out.write(CR); out.write(LF); }
[ "public", "void", "write", "(", "OutputStream", "out", ")", "throws", "IOException", "{", "for", "(", "HttpHeader", "header", ":", "this", ")", "{", "header", ".", "write", "(", "out", ")", ";", "}", "out", ".", "write", "(", "CR", ")", ";", "out", ...
Write all Headers and a trailing CRLF, CRLF @param out @throws IOException
[ "Write", "all", "Headers", "and", "a", "trailing", "CRLF", "CRLF" ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/format/http/HttpHeaders.java#L143-L149
train
iipc/webarchive-commons
src/main/java/org/archive/httpclient/ThreadLocalHttpConnectionManager.java
ThreadLocalHttpConnectionManager.finishLastResponse
private static boolean finishLastResponse(final HttpConnection conn) { InputStream lastResponse = conn.getLastResponseInputStream(); if(lastResponse != null) { conn.setLastResponseInputStream(null); try { lastResponse.close(); return true; } catch (IOException ioe) { // force reconnect. return false; } } else { return false; } }
java
private static boolean finishLastResponse(final HttpConnection conn) { InputStream lastResponse = conn.getLastResponseInputStream(); if(lastResponse != null) { conn.setLastResponseInputStream(null); try { lastResponse.close(); return true; } catch (IOException ioe) { // force reconnect. return false; } } else { return false; } }
[ "private", "static", "boolean", "finishLastResponse", "(", "final", "HttpConnection", "conn", ")", "{", "InputStream", "lastResponse", "=", "conn", ".", "getLastResponseInputStream", "(", ")", ";", "if", "(", "lastResponse", "!=", "null", ")", "{", "conn", ".", ...
Since the same connection is about to be reused, make sure the previous request was completely processed, and if not consume it now. @param conn The connection @return true, if the connection is reusable
[ "Since", "the", "same", "connection", "is", "about", "to", "be", "reused", "make", "sure", "the", "previous", "request", "was", "completely", "processed", "and", "if", "not", "consume", "it", "now", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/httpclient/ThreadLocalHttpConnectionManager.java#L78-L92
train
iipc/webarchive-commons
src/main/java/org/archive/io/arc/ARCWriter.java
ARCWriter.generateARCFileMetaData
private byte [] generateARCFileMetaData(String date) throws IOException { if(date!=null && date.length()>14) { date = date.substring(0,14); } int metadataBodyLength = getMetadataLength(); // If metadata body, then the minor part of the version is '1' rather // than '0'. String metadataHeaderLinesTwoAndThree = getMetadataHeaderLinesTwoAndThree("1 " + ((metadataBodyLength > 0)? "1": "0")); int recordLength = metadataBodyLength + metadataHeaderLinesTwoAndThree.getBytes(DEFAULT_ENCODING).length; String metadataHeaderStr = ARC_MAGIC_NUMBER + getBaseFilename() + " 0.0.0.0 " + date + " text/plain " + recordLength + metadataHeaderLinesTwoAndThree; ByteArrayOutputStream metabaos = new ByteArrayOutputStream(recordLength); // Write the metadata header. metabaos.write(metadataHeaderStr.getBytes(DEFAULT_ENCODING)); // Write the metadata body, if anything to write. if (metadataBodyLength > 0) { writeMetaData(metabaos); } // Write out a LINE_SEPARATORs to end this record. metabaos.write(LINE_SEPARATOR); // Now get bytes of all just written and compress if flag set. byte [] bytes = metabaos.toByteArray(); if(isCompressed()) { // GZIP the header but catch the gzipping into a byte array so we // can add the special IA GZIP header to the product. After // manipulations, write to the output stream (The JAVA GZIP // implementation does not give access to GZIP header. It // produces a 'default' header only). We can get away w/ these // maniupulations because the GZIP 'default' header doesn't // do the 'optional' CRC'ing of the header. byte [] gzippedMetaData = ArchiveUtils.gzip(bytes); if (gzippedMetaData[3] != 0) { throw new IOException("The GZIP FLG header is unexpectedly " + " non-zero. Need to add smarter code that can deal " + " when already extant extra GZIP header fields."); } // Set the GZIP FLG header to '4' which says that the GZIP header // has extra fields. Then insert the alex {'L', 'X', '0', '0', '0, // '0'} 'extra' field. The IA GZIP header will also set byte // 9 (zero-based), the OS byte, to 3 (Unix). We'll do the same. gzippedMetaData[3] = 4; gzippedMetaData[9] = 3; byte [] assemblyBuffer = new byte[gzippedMetaData.length + ARC_GZIP_EXTRA_FIELD.length]; // '10' in the below is a pointer past the following bytes of the // GZIP header: ID1 ID2 CM FLG + MTIME(4-bytes) XFL OS. See // RFC1952 for explaination of the abbreviations just used. System.arraycopy(gzippedMetaData, 0, assemblyBuffer, 0, 10); System.arraycopy(ARC_GZIP_EXTRA_FIELD, 0, assemblyBuffer, 10, ARC_GZIP_EXTRA_FIELD.length); System.arraycopy(gzippedMetaData, 10, assemblyBuffer, 10 + ARC_GZIP_EXTRA_FIELD.length, gzippedMetaData.length - 10); bytes = assemblyBuffer; } return bytes; }
java
private byte [] generateARCFileMetaData(String date) throws IOException { if(date!=null && date.length()>14) { date = date.substring(0,14); } int metadataBodyLength = getMetadataLength(); // If metadata body, then the minor part of the version is '1' rather // than '0'. String metadataHeaderLinesTwoAndThree = getMetadataHeaderLinesTwoAndThree("1 " + ((metadataBodyLength > 0)? "1": "0")); int recordLength = metadataBodyLength + metadataHeaderLinesTwoAndThree.getBytes(DEFAULT_ENCODING).length; String metadataHeaderStr = ARC_MAGIC_NUMBER + getBaseFilename() + " 0.0.0.0 " + date + " text/plain " + recordLength + metadataHeaderLinesTwoAndThree; ByteArrayOutputStream metabaos = new ByteArrayOutputStream(recordLength); // Write the metadata header. metabaos.write(metadataHeaderStr.getBytes(DEFAULT_ENCODING)); // Write the metadata body, if anything to write. if (metadataBodyLength > 0) { writeMetaData(metabaos); } // Write out a LINE_SEPARATORs to end this record. metabaos.write(LINE_SEPARATOR); // Now get bytes of all just written and compress if flag set. byte [] bytes = metabaos.toByteArray(); if(isCompressed()) { // GZIP the header but catch the gzipping into a byte array so we // can add the special IA GZIP header to the product. After // manipulations, write to the output stream (The JAVA GZIP // implementation does not give access to GZIP header. It // produces a 'default' header only). We can get away w/ these // maniupulations because the GZIP 'default' header doesn't // do the 'optional' CRC'ing of the header. byte [] gzippedMetaData = ArchiveUtils.gzip(bytes); if (gzippedMetaData[3] != 0) { throw new IOException("The GZIP FLG header is unexpectedly " + " non-zero. Need to add smarter code that can deal " + " when already extant extra GZIP header fields."); } // Set the GZIP FLG header to '4' which says that the GZIP header // has extra fields. Then insert the alex {'L', 'X', '0', '0', '0, // '0'} 'extra' field. The IA GZIP header will also set byte // 9 (zero-based), the OS byte, to 3 (Unix). We'll do the same. gzippedMetaData[3] = 4; gzippedMetaData[9] = 3; byte [] assemblyBuffer = new byte[gzippedMetaData.length + ARC_GZIP_EXTRA_FIELD.length]; // '10' in the below is a pointer past the following bytes of the // GZIP header: ID1 ID2 CM FLG + MTIME(4-bytes) XFL OS. See // RFC1952 for explaination of the abbreviations just used. System.arraycopy(gzippedMetaData, 0, assemblyBuffer, 0, 10); System.arraycopy(ARC_GZIP_EXTRA_FIELD, 0, assemblyBuffer, 10, ARC_GZIP_EXTRA_FIELD.length); System.arraycopy(gzippedMetaData, 10, assemblyBuffer, 10 + ARC_GZIP_EXTRA_FIELD.length, gzippedMetaData.length - 10); bytes = assemblyBuffer; } return bytes; }
[ "private", "byte", "[", "]", "generateARCFileMetaData", "(", "String", "date", ")", "throws", "IOException", "{", "if", "(", "date", "!=", "null", "&&", "date", ".", "length", "(", ")", ">", "14", ")", "{", "date", "=", "date", ".", "substring", "(", ...
Write out the ARCMetaData. <p>Generate ARC file meta data. Currently we only do version 1 of the ARC file formats or version 1.1 when metadata has been supplied (We write it into the body of the first record in the arc file). <p>Version 1 metadata looks roughly like this: <pre>filedesc://testWriteRecord-JunitIAH20040110013326-2.arc 0.0.0.0 \\ 20040110013326 text/plain 77 1 0 InternetArchive URL IP-address Archive-date Content-type Archive-length </pre> <p>If compress is set, then we generate a header that has been gzipped in the Internet Archive manner. Such a gzipping enables the FEXTRA flag in the FLG field of the gzip header. It then appends an extra header field: '8', '0', 'L', 'X', '0', '0', '0', '0'. The first two bytes are the length of the field and the last 6 bytes the Internet Archive header. To learn about GZIP format, see RFC1952. To learn about the Internet Archive extra header field, read the source for av_ziparc which can be found at <code>alexa/vista/alexa-tools-1.2/src/av_ziparc.cc</code>. <p>We do things in this roundabout manner because the java GZIPOutputStream does not give access to GZIP header fields. @param date Date to put into the ARC metadata; if 17-digit will be truncated to traditional 14-digits @return Byte array filled w/ the arc header. @throws IOException
[ "Write", "out", "the", "ARCMetaData", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/arc/ARCWriter.java#L202-L266
train
iipc/webarchive-commons
src/main/java/org/archive/io/arc/ARCWriter.java
ARCWriter.validateMetaLine
protected String validateMetaLine(String metaLineStr) throws IOException { if (metaLineStr.length() > MAX_METADATA_LINE_LENGTH) { throw new IOException("Metadata line too long (" + metaLineStr.length() + ">" + MAX_METADATA_LINE_LENGTH + "): " + metaLineStr); } Matcher m = METADATA_LINE_PATTERN.matcher(metaLineStr); if (!m.matches()) { throw new IOException("Metadata line doesn't match expected" + " pattern: " + metaLineStr); } return metaLineStr; }
java
protected String validateMetaLine(String metaLineStr) throws IOException { if (metaLineStr.length() > MAX_METADATA_LINE_LENGTH) { throw new IOException("Metadata line too long (" + metaLineStr.length() + ">" + MAX_METADATA_LINE_LENGTH + "): " + metaLineStr); } Matcher m = METADATA_LINE_PATTERN.matcher(metaLineStr); if (!m.matches()) { throw new IOException("Metadata line doesn't match expected" + " pattern: " + metaLineStr); } return metaLineStr; }
[ "protected", "String", "validateMetaLine", "(", "String", "metaLineStr", ")", "throws", "IOException", "{", "if", "(", "metaLineStr", ".", "length", "(", ")", ">", "MAX_METADATA_LINE_LENGTH", ")", "{", "throw", "new", "IOException", "(", "\"Metadata line too long (\...
Test that the metadata line is valid before writing. @param metaLineStr @throws IOException @return The passed in metaline.
[ "Test", "that", "the", "metadata", "line", "is", "valid", "before", "writing", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/arc/ARCWriter.java#L445-L458
train
iipc/webarchive-commons
src/main/java/org/archive/format/warc/WARCRecordWriter.java
WARCRecordWriter.writeRecord
private void writeRecord( OutputStream out, HttpHeaders headers, byte[] contents) throws IOException { if ( contents == null ) { headers.add(CONTENT_LENGTH, "0"); } else { headers.add(CONTENT_LENGTH,String.valueOf(contents.length)); } out.write(WARC_ID.getBytes(DEFAULT_ENCODING)); out.write(CR); out.write(LF); // NOTE: HttpHeaders.write() method includes the trailing CRLF. // So we don't need to write it out here. headers.write(out); if ( contents != null ) { out.write( contents ); } // Emit the 2 trailing CRLF sequences. out.write(CR); out.write(LF); out.write(CR); out.write(LF); }
java
private void writeRecord( OutputStream out, HttpHeaders headers, byte[] contents) throws IOException { if ( contents == null ) { headers.add(CONTENT_LENGTH, "0"); } else { headers.add(CONTENT_LENGTH,String.valueOf(contents.length)); } out.write(WARC_ID.getBytes(DEFAULT_ENCODING)); out.write(CR); out.write(LF); // NOTE: HttpHeaders.write() method includes the trailing CRLF. // So we don't need to write it out here. headers.write(out); if ( contents != null ) { out.write( contents ); } // Emit the 2 trailing CRLF sequences. out.write(CR); out.write(LF); out.write(CR); out.write(LF); }
[ "private", "void", "writeRecord", "(", "OutputStream", "out", ",", "HttpHeaders", "headers", ",", "byte", "[", "]", "contents", ")", "throws", "IOException", "{", "if", "(", "contents", "==", "null", ")", "{", "headers", ".", "add", "(", "CONTENT_LENGTH", ...
Write the headers and contents as a WARC record to the given output stream. WARC record format: <pre>warc-file = 1*warc-record warc-record = header CRLF block CRLF CRLF header = version warc-fields version = "WARC/0.18" CRLF warc-fields = *named-field CRLF block = *OCTET</pre>
[ "Write", "the", "headers", "and", "contents", "as", "a", "WARC", "record", "to", "the", "given", "output", "stream", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/format/warc/WARCRecordWriter.java#L29-L60
train
iipc/webarchive-commons
src/main/java/org/archive/io/ArchiveReaderFactory.java
ArchiveReaderFactory.get
public static ArchiveReader get(final String arcFileOrUrl) throws MalformedURLException, IOException { return ArchiveReaderFactory.factory.getArchiveReader(arcFileOrUrl); }
java
public static ArchiveReader get(final String arcFileOrUrl) throws MalformedURLException, IOException { return ArchiveReaderFactory.factory.getArchiveReader(arcFileOrUrl); }
[ "public", "static", "ArchiveReader", "get", "(", "final", "String", "arcFileOrUrl", ")", "throws", "MalformedURLException", ",", "IOException", "{", "return", "ArchiveReaderFactory", ".", "factory", ".", "getArchiveReader", "(", "arcFileOrUrl", ")", ";", "}" ]
Get an Archive file Reader on passed path or url. Does primitive heuristic figuring if path or URL. @param arcFileOrUrl File path or URL pointing at an Archive file. @return An Archive file Reader. @throws IOException @throws MalformedURLException @throws IOException
[ "Get", "an", "Archive", "file", "Reader", "on", "passed", "path", "or", "url", ".", "Does", "primitive", "heuristic", "figuring", "if", "path", "or", "URL", "." ]
988bec707c27a01333becfc3bd502af4441ea1e1
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/ArchiveReaderFactory.java#L74-L77
train
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneOption.java
SaneOption.getIntegerValue
public int getIntegerValue() throws IOException, SaneException { // check for type agreement Preconditions.checkState(getValueType() == OptionValueType.INT, "option is not an integer"); Preconditions.checkState(getValueCount() == 1, "option is an integer array, not integer"); // Send RCP corresponding to: // // SANE_Status sane_control_option (SANE_Handle h, SANE_Int n, // SANE_Action a, void *v, // SANE_Int * i); ControlOptionResult result = readOption(); Preconditions.checkState(result.getType() == OptionValueType.INT); Preconditions.checkState( result.getValueSize() == SaneWord.SIZE_IN_BYTES, "unexpected value size " + result.getValueSize() + ", expecting " + SaneWord.SIZE_IN_BYTES); // TODO: handle resource authorisation // TODO: check status -- may have to reload options!! return SaneWord.fromBytes(result.getValue()).integerValue(); // the // value }
java
public int getIntegerValue() throws IOException, SaneException { // check for type agreement Preconditions.checkState(getValueType() == OptionValueType.INT, "option is not an integer"); Preconditions.checkState(getValueCount() == 1, "option is an integer array, not integer"); // Send RCP corresponding to: // // SANE_Status sane_control_option (SANE_Handle h, SANE_Int n, // SANE_Action a, void *v, // SANE_Int * i); ControlOptionResult result = readOption(); Preconditions.checkState(result.getType() == OptionValueType.INT); Preconditions.checkState( result.getValueSize() == SaneWord.SIZE_IN_BYTES, "unexpected value size " + result.getValueSize() + ", expecting " + SaneWord.SIZE_IN_BYTES); // TODO: handle resource authorisation // TODO: check status -- may have to reload options!! return SaneWord.fromBytes(result.getValue()).integerValue(); // the // value }
[ "public", "int", "getIntegerValue", "(", ")", "throws", "IOException", ",", "SaneException", "{", "// check for type agreement", "Preconditions", ".", "checkState", "(", "getValueType", "(", ")", "==", "OptionValueType", ".", "INT", ",", "\"option is not an integer\"", ...
Reads the current Integer value option. We do not cache value from previous get or set operations so each get involves a round trip to the server. TODO: consider caching the returned value for "fast read" later @return the value of the option @throws IOException if a problem occurred while talking to SANE
[ "Reads", "the", "current", "Integer", "value", "option", ".", "We", "do", "not", "cache", "value", "from", "previous", "get", "or", "set", "operations", "so", "each", "get", "involves", "a", "round", "trip", "to", "the", "server", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneOption.java#L343-L364
train
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneOption.java
SaneOption.setBooleanValue
public boolean setBooleanValue(boolean value) throws IOException, SaneException { ControlOptionResult result = writeOption(SaneWord.forInt(value ? 1 : 0)); Preconditions.checkState(result.getType() == OptionValueType.BOOLEAN); return SaneWord.fromBytes(result.getValue()).integerValue() != 0; }
java
public boolean setBooleanValue(boolean value) throws IOException, SaneException { ControlOptionResult result = writeOption(SaneWord.forInt(value ? 1 : 0)); Preconditions.checkState(result.getType() == OptionValueType.BOOLEAN); return SaneWord.fromBytes(result.getValue()).integerValue() != 0; }
[ "public", "boolean", "setBooleanValue", "(", "boolean", "value", ")", "throws", "IOException", ",", "SaneException", "{", "ControlOptionResult", "result", "=", "writeOption", "(", "SaneWord", ".", "forInt", "(", "value", "?", "1", ":", "0", ")", ")", ";", "P...
Sets the value of the current option to the supplied boolean value. Option value must be of boolean type. SANE may ignore your preference, so if you need to ensure the value has been set correctly, you should examine the return value of this method. @return the value that the option now has according to SANE
[ "Sets", "the", "value", "of", "the", "current", "option", "to", "the", "supplied", "boolean", "value", ".", "Option", "value", "must", "be", "of", "boolean", "type", ".", "SANE", "may", "ignore", "your", "preference", "so", "if", "you", "need", "to", "en...
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneOption.java#L473-L478
train
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneOption.java
SaneOption.setFixedValue
public double setFixedValue(double value) throws IOException, SaneException { Preconditions.checkArgument( value >= -32768 && value <= 32767.9999, "value " + value + " is out of range"); SaneWord wordValue = SaneWord.forFixedPrecision(value); ControlOptionResult result = writeOption(wordValue); Preconditions.checkState( result.getType() == OptionValueType.FIXED, "setFixedValue is not appropriate for option of type " + result.getType()); return SaneWord.fromBytes(result.getValue()).fixedPrecisionValue(); }
java
public double setFixedValue(double value) throws IOException, SaneException { Preconditions.checkArgument( value >= -32768 && value <= 32767.9999, "value " + value + " is out of range"); SaneWord wordValue = SaneWord.forFixedPrecision(value); ControlOptionResult result = writeOption(wordValue); Preconditions.checkState( result.getType() == OptionValueType.FIXED, "setFixedValue is not appropriate for option of type " + result.getType()); return SaneWord.fromBytes(result.getValue()).fixedPrecisionValue(); }
[ "public", "double", "setFixedValue", "(", "double", "value", ")", "throws", "IOException", ",", "SaneException", "{", "Preconditions", ".", "checkArgument", "(", "value", ">=", "-", "32768", "&&", "value", "<=", "32767.9999", ",", "\"value \"", "+", "value", "...
Sets the value of the current option to the supplied fixed-precision value. Option value must be of fixed-precision type.
[ "Sets", "the", "value", "of", "the", "current", "option", "to", "the", "supplied", "fixed", "-", "precision", "value", ".", "Option", "value", "must", "be", "of", "fixed", "-", "precision", "type", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneOption.java#L488-L498
train
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneOption.java
SaneOption.setIntegerValue
public int setIntegerValue(int newValue) throws IOException, SaneException { Preconditions.checkState(getValueCount() == 1, "option is an array"); // check that this option is readable Preconditions.checkState(isWriteable()); // Send RPC corresponding to: // // SANE_Status sane_control_option (SANE_Handle h, SANE_Int n, // SANE_Action a, void *v, // SANE_Int * i); ControlOptionResult result = writeOption(ImmutableList.of(newValue)); Preconditions.checkState(result.getType() == OptionValueType.INT); Preconditions.checkState(result.getValueSize() == SaneWord.SIZE_IN_BYTES); return SaneWord.fromBytes(result.getValue()).integerValue(); }
java
public int setIntegerValue(int newValue) throws IOException, SaneException { Preconditions.checkState(getValueCount() == 1, "option is an array"); // check that this option is readable Preconditions.checkState(isWriteable()); // Send RPC corresponding to: // // SANE_Status sane_control_option (SANE_Handle h, SANE_Int n, // SANE_Action a, void *v, // SANE_Int * i); ControlOptionResult result = writeOption(ImmutableList.of(newValue)); Preconditions.checkState(result.getType() == OptionValueType.INT); Preconditions.checkState(result.getValueSize() == SaneWord.SIZE_IN_BYTES); return SaneWord.fromBytes(result.getValue()).integerValue(); }
[ "public", "int", "setIntegerValue", "(", "int", "newValue", ")", "throws", "IOException", ",", "SaneException", "{", "Preconditions", ".", "checkState", "(", "getValueCount", "(", ")", "==", "1", ",", "\"option is an array\"", ")", ";", "// check that this option is...
Set the value of the current option to the supplied value. Option value must be of integer type TODO: consider caching the returned value for "fast read" later @param newValue for the option @return the value actually set @throws IOException
[ "Set", "the", "value", "of", "the", "current", "option", "to", "the", "supplied", "value", ".", "Option", "value", "must", "be", "of", "integer", "type" ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneOption.java#L571-L588
train
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneDevice.java
SaneDevice.close
@Override public void close() throws IOException { if (!isOpen()) { throw new IOException("device is already closed"); } session.closeDevice(handle); handle = null; }
java
@Override public void close() throws IOException { if (!isOpen()) { throw new IOException("device is already closed"); } session.closeDevice(handle); handle = null; }
[ "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "if", "(", "!", "isOpen", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"device is already closed\"", ")", ";", "}", "session", ".", "closeDevice", "(", "handle...
Closes the device. @throws IOException if an error occurs talking to the SANE backend @throws IllegalStateException if the device is already closed
[ "Closes", "the", "device", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneDevice.java#L130-L138
train
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneDevice.java
SaneDevice.listOptions
public List<SaneOption> listOptions() throws IOException { if (optionTitleMap == null) { groups.clear(); optionTitleMap = Maps.uniqueIndex( SaneOption.optionsFor(this), new Function<SaneOption, String>() { @Override public String apply(SaneOption input) { return input.getName(); } }); } // Maps.uniqueIndex guarantees the order of optionTitleMap.values() return ImmutableList.copyOf(optionTitleMap.values()); }
java
public List<SaneOption> listOptions() throws IOException { if (optionTitleMap == null) { groups.clear(); optionTitleMap = Maps.uniqueIndex( SaneOption.optionsFor(this), new Function<SaneOption, String>() { @Override public String apply(SaneOption input) { return input.getName(); } }); } // Maps.uniqueIndex guarantees the order of optionTitleMap.values() return ImmutableList.copyOf(optionTitleMap.values()); }
[ "public", "List", "<", "SaneOption", ">", "listOptions", "(", ")", "throws", "IOException", "{", "if", "(", "optionTitleMap", "==", "null", ")", "{", "groups", ".", "clear", "(", ")", ";", "optionTitleMap", "=", "Maps", ".", "uniqueIndex", "(", "SaneOption...
Returns the list of options applicable to this device. @return a list of {@link SaneOption} instances @throws IOException if a problem occurred talking to the SANE backend
[ "Returns", "the", "list", "of", "options", "applicable", "to", "this", "device", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneDevice.java#L167-L183
train
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/OptionGroup.java
OptionGroup.addOption
void addOption(SaneOption option) { Preconditions.checkState(option.getGroup() == this); options.add(option); }
java
void addOption(SaneOption option) { Preconditions.checkState(option.getGroup() == this); options.add(option); }
[ "void", "addOption", "(", "SaneOption", "option", ")", "{", "Preconditions", ".", "checkState", "(", "option", ".", "getGroup", "(", ")", "==", "this", ")", ";", "options", ".", "add", "(", "option", ")", ";", "}" ]
Adds an option to the group.
[ "Adds", "an", "option", "to", "the", "group", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/OptionGroup.java#L42-L45
train
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.withRemoteSane
public static SaneSession withRemoteSane(InetAddress saneAddress, int port) throws IOException { return withRemoteSane(saneAddress, port, 0, TimeUnit.MILLISECONDS, 0, TimeUnit.MILLISECONDS); }
java
public static SaneSession withRemoteSane(InetAddress saneAddress, int port) throws IOException { return withRemoteSane(saneAddress, port, 0, TimeUnit.MILLISECONDS, 0, TimeUnit.MILLISECONDS); }
[ "public", "static", "SaneSession", "withRemoteSane", "(", "InetAddress", "saneAddress", ",", "int", "port", ")", "throws", "IOException", "{", "return", "withRemoteSane", "(", "saneAddress", ",", "port", ",", "0", ",", "TimeUnit", ".", "MILLISECONDS", ",", "0", ...
Establishes a connection to the SANE daemon running on the given host on the given port with no connection timeout.
[ "Establishes", "a", "connection", "to", "the", "SANE", "daemon", "running", "on", "the", "given", "host", "on", "the", "given", "port", "with", "no", "connection", "timeout", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L86-L88
train
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.listDevices
public List<SaneDevice> listDevices() throws IOException, SaneException { outputStream.write(SaneRpcCode.SANE_NET_GET_DEVICES); outputStream.flush(); return inputStream.readDeviceList(); }
java
public List<SaneDevice> listDevices() throws IOException, SaneException { outputStream.write(SaneRpcCode.SANE_NET_GET_DEVICES); outputStream.flush(); return inputStream.readDeviceList(); }
[ "public", "List", "<", "SaneDevice", ">", "listDevices", "(", ")", "throws", "IOException", ",", "SaneException", "{", "outputStream", ".", "write", "(", "SaneRpcCode", ".", "SANE_NET_GET_DEVICES", ")", ";", "outputStream", ".", "flush", "(", ")", ";", "return...
Lists the devices known to the SANE daemon. @return a list of devices that may be opened, see {@link SaneDevice#open} @throws IOException if an error occurs while communicating with the SANE daemon @throws SaneException if the SANE backend returns an error in response to this request
[ "Lists", "the", "devices", "known", "to", "the", "SANE", "daemon", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L160-L164
train
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.close
@Override public void close() throws IOException { try { outputStream.write(SaneRpcCode.SANE_NET_EXIT); outputStream.close(); } finally { socket.close(); } }
java
@Override public void close() throws IOException { try { outputStream.write(SaneRpcCode.SANE_NET_EXIT); outputStream.close(); } finally { socket.close(); } }
[ "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "try", "{", "outputStream", ".", "write", "(", "SaneRpcCode", ".", "SANE_NET_EXIT", ")", ";", "outputStream", ".", "close", "(", ")", ";", "}", "finally", "{", "socket", ...
Closes the connection to the SANE server. This is done immediately by closing the socket. @throws IOException if an error occurred while closing the connection
[ "Closes", "the", "connection", "to", "the", "SANE", "server", ".", "This", "is", "done", "immediately", "by", "closing", "the", "socket", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L171-L179
train
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.authorize
boolean authorize(String resource) throws IOException { if (passwordProvider == null) { throw new IOException( "Authorization failed - no password provider present " + "(you must call setPasswordProvider)"); } if (passwordProvider.canAuthenticate(resource)) { // RPC code FOR SANE_NET_AUTHORIZE outputStream.write(SaneRpcCode.SANE_NET_AUTHORIZE); outputStream.write(resource); outputStream.write(passwordProvider.getUsername(resource)); writePassword(resource, passwordProvider.getPassword(resource)); outputStream.flush(); // Read dummy reply and discard (according to the spec, it is unused). inputStream.readWord(); return true; } return false; }
java
boolean authorize(String resource) throws IOException { if (passwordProvider == null) { throw new IOException( "Authorization failed - no password provider present " + "(you must call setPasswordProvider)"); } if (passwordProvider.canAuthenticate(resource)) { // RPC code FOR SANE_NET_AUTHORIZE outputStream.write(SaneRpcCode.SANE_NET_AUTHORIZE); outputStream.write(resource); outputStream.write(passwordProvider.getUsername(resource)); writePassword(resource, passwordProvider.getPassword(resource)); outputStream.flush(); // Read dummy reply and discard (according to the spec, it is unused). inputStream.readWord(); return true; } return false; }
[ "boolean", "authorize", "(", "String", "resource", ")", "throws", "IOException", "{", "if", "(", "passwordProvider", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Authorization failed - no password provider present \"", "+", "\"(you must call setPasswordP...
Authorize the resource for access. @throws IOException if an error occurs while communicating with the SANE daemon
[ "Authorize", "the", "resource", "for", "access", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L345-L366
train
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.writePassword
private void writePassword(String resource, String password) throws IOException { String[] resourceParts = resource.split("\\$MD5\\$"); if (resourceParts.length == 1) { // Write in clean outputStream.write(password); } else { outputStream.write("$MD5$" + SanePasswordEncoder.derivePassword(resourceParts[1], password)); } }
java
private void writePassword(String resource, String password) throws IOException { String[] resourceParts = resource.split("\\$MD5\\$"); if (resourceParts.length == 1) { // Write in clean outputStream.write(password); } else { outputStream.write("$MD5$" + SanePasswordEncoder.derivePassword(resourceParts[1], password)); } }
[ "private", "void", "writePassword", "(", "String", "resource", ",", "String", "password", ")", "throws", "IOException", "{", "String", "[", "]", "resourceParts", "=", "resource", ".", "split", "(", "\"\\\\$MD5\\\\$\"", ")", ";", "if", "(", "resourceParts", "."...
Write password to outputstream depending on resource provided by saned. @param resource as provided by sane in authorization request @param password @throws IOException
[ "Write", "password", "to", "outputstream", "depending", "on", "resource", "provided", "by", "saned", "." ]
15ad0f73df0a8d0efec5167a2141cbd53afd862d
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L375-L383
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlay.java
FeatureOverlay.ignoreTileDao
public void ignoreTileDao(TileDao tileDao) { GeoPackageOverlay tileOverlay = new GeoPackageOverlay(tileDao); linkedOverlays.add(tileOverlay); }
java
public void ignoreTileDao(TileDao tileDao) { GeoPackageOverlay tileOverlay = new GeoPackageOverlay(tileDao); linkedOverlays.add(tileOverlay); }
[ "public", "void", "ignoreTileDao", "(", "TileDao", "tileDao", ")", "{", "GeoPackageOverlay", "tileOverlay", "=", "new", "GeoPackageOverlay", "(", "tileDao", ")", ";", "linkedOverlays", ".", "add", "(", "tileOverlay", ")", ";", "}" ]
Ignore drawing tiles if they exist in the tile table represented by the tile dao @param tileDao tile data access object @since 1.2.6
[ "Ignore", "drawing", "tiles", "if", "they", "exist", "in", "the", "tile", "table", "represented", "by", "the", "tile", "dao" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlay.java#L112-L116
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.simplifyPoints
private List<Point> simplifyPoints(List<Point> points) { List<Point> simplifiedPoints = null; if (simplifyTolerance != null) { // Reproject to web mercator if not in meters if (projection != null && !projection.isUnit(Units.METRES)) { points = toWebMercator.transform(points); } // Simplify the points simplifiedPoints = GeometryUtils.simplifyPoints(points, simplifyTolerance); // Reproject back to the original projection if (projection != null && !projection.isUnit(Units.METRES)) { simplifiedPoints = fromWebMercator.transform(simplifiedPoints); } } else { simplifiedPoints = points; } return simplifiedPoints; }
java
private List<Point> simplifyPoints(List<Point> points) { List<Point> simplifiedPoints = null; if (simplifyTolerance != null) { // Reproject to web mercator if not in meters if (projection != null && !projection.isUnit(Units.METRES)) { points = toWebMercator.transform(points); } // Simplify the points simplifiedPoints = GeometryUtils.simplifyPoints(points, simplifyTolerance); // Reproject back to the original projection if (projection != null && !projection.isUnit(Units.METRES)) { simplifiedPoints = fromWebMercator.transform(simplifiedPoints); } } else { simplifiedPoints = points; } return simplifiedPoints; }
[ "private", "List", "<", "Point", ">", "simplifyPoints", "(", "List", "<", "Point", ">", "points", ")", "{", "List", "<", "Point", ">", "simplifiedPoints", "=", "null", ";", "if", "(", "simplifyTolerance", "!=", "null", ")", "{", "// Reproject to web mercator...
When the simplify tolerance is set, simplify the points to a similar curve with fewer points. @param points ordered points @return simplified points
[ "When", "the", "simplify", "tolerance", "is", "set", "simplify", "the", "points", "to", "a", "similar", "curve", "with", "fewer", "points", "." ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L565-L588
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.getOrientation
public PolygonOrientation getOrientation(List<LatLng> points) { return SphericalUtil.computeSignedArea(points) >= 0 ? PolygonOrientation.COUNTERCLOCKWISE : PolygonOrientation.CLOCKWISE; }
java
public PolygonOrientation getOrientation(List<LatLng> points) { return SphericalUtil.computeSignedArea(points) >= 0 ? PolygonOrientation.COUNTERCLOCKWISE : PolygonOrientation.CLOCKWISE; }
[ "public", "PolygonOrientation", "getOrientation", "(", "List", "<", "LatLng", ">", "points", ")", "{", "return", "SphericalUtil", ".", "computeSignedArea", "(", "points", ")", ">=", "0", "?", "PolygonOrientation", ".", "COUNTERCLOCKWISE", ":", "PolygonOrientation", ...
Determine the closed points orientation @param points closed points @return orientation @since 1.3.2
[ "Determine", "the", "closed", "points", "orientation" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L728-L730
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addShapeToMap
public static GoogleMapShape addShapeToMap(GoogleMap map, GoogleMapShape shape) { GoogleMapShape addedShape = null; switch (shape.getShapeType()) { case LAT_LNG: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MARKER, addLatLngToMap(map, (LatLng) shape.getShape())); break; case MARKER_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MARKER, addMarkerOptionsToMap(map, (MarkerOptions) shape.getShape())); break; case POLYLINE_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.POLYLINE, addPolylineToMap(map, (PolylineOptions) shape.getShape())); break; case POLYGON_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.POLYGON, addPolygonToMap(map, (PolygonOptions) shape.getShape())); break; case MULTI_LAT_LNG: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MULTI_MARKER, addLatLngsToMap(map, (MultiLatLng) shape.getShape())); break; case MULTI_POLYLINE_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MULTI_POLYLINE, addPolylinesToMap(map, (MultiPolylineOptions) shape.getShape())); break; case MULTI_POLYGON_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MULTI_POLYGON, addPolygonsToMap(map, (MultiPolygonOptions) shape.getShape())); break; case COLLECTION: List<GoogleMapShape> addedShapeList = new ArrayList<GoogleMapShape>(); @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape .getShape(); for (GoogleMapShape shapeListItem : shapeList) { addedShapeList.add(addShapeToMap(map, shapeListItem)); } addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.COLLECTION, addedShapeList); break; default: throw new GeoPackageException("Unsupported Shape Type: " + shape.getShapeType()); } return addedShape; }
java
public static GoogleMapShape addShapeToMap(GoogleMap map, GoogleMapShape shape) { GoogleMapShape addedShape = null; switch (shape.getShapeType()) { case LAT_LNG: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MARKER, addLatLngToMap(map, (LatLng) shape.getShape())); break; case MARKER_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MARKER, addMarkerOptionsToMap(map, (MarkerOptions) shape.getShape())); break; case POLYLINE_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.POLYLINE, addPolylineToMap(map, (PolylineOptions) shape.getShape())); break; case POLYGON_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.POLYGON, addPolygonToMap(map, (PolygonOptions) shape.getShape())); break; case MULTI_LAT_LNG: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MULTI_MARKER, addLatLngsToMap(map, (MultiLatLng) shape.getShape())); break; case MULTI_POLYLINE_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MULTI_POLYLINE, addPolylinesToMap(map, (MultiPolylineOptions) shape.getShape())); break; case MULTI_POLYGON_OPTIONS: addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.MULTI_POLYGON, addPolygonsToMap(map, (MultiPolygonOptions) shape.getShape())); break; case COLLECTION: List<GoogleMapShape> addedShapeList = new ArrayList<GoogleMapShape>(); @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape .getShape(); for (GoogleMapShape shapeListItem : shapeList) { addedShapeList.add(addShapeToMap(map, shapeListItem)); } addedShape = new GoogleMapShape(shape.getGeometryType(), GoogleMapShapeType.COLLECTION, addedShapeList); break; default: throw new GeoPackageException("Unsupported Shape Type: " + shape.getShapeType()); } return addedShape; }
[ "public", "static", "GoogleMapShape", "addShapeToMap", "(", "GoogleMap", "map", ",", "GoogleMapShape", "shape", ")", "{", "GoogleMapShape", "addedShape", "=", "null", ";", "switch", "(", "shape", ".", "getShapeType", "(", ")", ")", "{", "case", "LAT_LNG", ":",...
Add a shape to the map @param map google map @param shape google map shape @return google map shape
[ "Add", "a", "shape", "to", "the", "map" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1464-L1524
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addPolygonsToMap
public static mil.nga.geopackage.map.geom.MultiPolygon addPolygonsToMap( GoogleMap map, MultiPolygonOptions polygons) { mil.nga.geopackage.map.geom.MultiPolygon multiPolygon = new mil.nga.geopackage.map.geom.MultiPolygon(); for (PolygonOptions polygonOption : polygons.getPolygonOptions()) { if (polygons.getOptions() != null) { polygonOption.fillColor(polygons.getOptions().getFillColor()); polygonOption.strokeColor(polygons.getOptions() .getStrokeColor()); polygonOption.geodesic(polygons.getOptions().isGeodesic()); polygonOption.visible(polygons.getOptions().isVisible()); polygonOption.zIndex(polygons.getOptions().getZIndex()); polygonOption.strokeWidth(polygons.getOptions().getStrokeWidth()); } com.google.android.gms.maps.model.Polygon polygon = addPolygonToMap( map, polygonOption); multiPolygon.add(polygon); } return multiPolygon; }
java
public static mil.nga.geopackage.map.geom.MultiPolygon addPolygonsToMap( GoogleMap map, MultiPolygonOptions polygons) { mil.nga.geopackage.map.geom.MultiPolygon multiPolygon = new mil.nga.geopackage.map.geom.MultiPolygon(); for (PolygonOptions polygonOption : polygons.getPolygonOptions()) { if (polygons.getOptions() != null) { polygonOption.fillColor(polygons.getOptions().getFillColor()); polygonOption.strokeColor(polygons.getOptions() .getStrokeColor()); polygonOption.geodesic(polygons.getOptions().isGeodesic()); polygonOption.visible(polygons.getOptions().isVisible()); polygonOption.zIndex(polygons.getOptions().getZIndex()); polygonOption.strokeWidth(polygons.getOptions().getStrokeWidth()); } com.google.android.gms.maps.model.Polygon polygon = addPolygonToMap( map, polygonOption); multiPolygon.add(polygon); } return multiPolygon; }
[ "public", "static", "mil", ".", "nga", ".", "geopackage", ".", "map", ".", "geom", ".", "MultiPolygon", "addPolygonsToMap", "(", "GoogleMap", "map", ",", "MultiPolygonOptions", "polygons", ")", "{", "mil", ".", "nga", ".", "geopackage", ".", "map", ".", "g...
Add a list of Polygons to the map @param map google map @param polygons multi polygon options @return multi polygon
[ "Add", "a", "list", "of", "Polygons", "to", "the", "map" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1643-L1661
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addPointsToMapAsMarkers
public List<Marker> addPointsToMapAsMarkers(GoogleMap map, List<LatLng> points, MarkerOptions customMarkerOptions, boolean ignoreIdenticalEnds) { List<Marker> markers = new ArrayList<Marker>(); for (int i = 0; i < points.size(); i++) { LatLng latLng = points.get(i); if (points.size() > 1 && i + 1 == points.size() && ignoreIdenticalEnds) { LatLng firstLatLng = points.get(0); if (latLng.latitude == firstLatLng.latitude && latLng.longitude == firstLatLng.longitude) { break; } } MarkerOptions markerOptions = new MarkerOptions(); if (customMarkerOptions != null) { markerOptions.icon(customMarkerOptions.getIcon()); markerOptions.anchor(customMarkerOptions.getAnchorU(), customMarkerOptions.getAnchorV()); markerOptions.draggable(customMarkerOptions.isDraggable()); markerOptions.visible(customMarkerOptions.isVisible()); markerOptions.zIndex(customMarkerOptions.getZIndex()); } Marker marker = addLatLngToMap(map, latLng, markerOptions); markers.add(marker); } return markers; }
java
public List<Marker> addPointsToMapAsMarkers(GoogleMap map, List<LatLng> points, MarkerOptions customMarkerOptions, boolean ignoreIdenticalEnds) { List<Marker> markers = new ArrayList<Marker>(); for (int i = 0; i < points.size(); i++) { LatLng latLng = points.get(i); if (points.size() > 1 && i + 1 == points.size() && ignoreIdenticalEnds) { LatLng firstLatLng = points.get(0); if (latLng.latitude == firstLatLng.latitude && latLng.longitude == firstLatLng.longitude) { break; } } MarkerOptions markerOptions = new MarkerOptions(); if (customMarkerOptions != null) { markerOptions.icon(customMarkerOptions.getIcon()); markerOptions.anchor(customMarkerOptions.getAnchorU(), customMarkerOptions.getAnchorV()); markerOptions.draggable(customMarkerOptions.isDraggable()); markerOptions.visible(customMarkerOptions.isVisible()); markerOptions.zIndex(customMarkerOptions.getZIndex()); } Marker marker = addLatLngToMap(map, latLng, markerOptions); markers.add(marker); } return markers; }
[ "public", "List", "<", "Marker", ">", "addPointsToMapAsMarkers", "(", "GoogleMap", "map", ",", "List", "<", "LatLng", ">", "points", ",", "MarkerOptions", "customMarkerOptions", ",", "boolean", "ignoreIdenticalEnds", ")", "{", "List", "<", "Marker", ">", "marker...
Add the list of points as markers @param map google map @param points points @param customMarkerOptions custom marker options @param ignoreIdenticalEnds ignore identical ends flag @return list of markers
[ "Add", "the", "list", "of", "points", "as", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1817-L1846
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addPolylineToMapAsMarkers
public PolylineMarkers addPolylineToMapAsMarkers(GoogleMap map, PolylineOptions polylineOptions, MarkerOptions polylineMarkerOptions, PolylineOptions globalPolylineOptions) { PolylineMarkers polylineMarkers = new PolylineMarkers(this); if (globalPolylineOptions != null) { polylineOptions.color(globalPolylineOptions.getColor()); polylineOptions.geodesic(globalPolylineOptions.isGeodesic()); polylineOptions.visible(globalPolylineOptions.isVisible()); polylineOptions.zIndex(globalPolylineOptions.getZIndex()); polylineOptions.width(globalPolylineOptions.getWidth()); } Polyline polyline = addPolylineToMap(map, polylineOptions); polylineMarkers.setPolyline(polyline); List<Marker> markers = addPointsToMapAsMarkers(map, polylineOptions.getPoints(), polylineMarkerOptions, false); polylineMarkers.setMarkers(markers); return polylineMarkers; }
java
public PolylineMarkers addPolylineToMapAsMarkers(GoogleMap map, PolylineOptions polylineOptions, MarkerOptions polylineMarkerOptions, PolylineOptions globalPolylineOptions) { PolylineMarkers polylineMarkers = new PolylineMarkers(this); if (globalPolylineOptions != null) { polylineOptions.color(globalPolylineOptions.getColor()); polylineOptions.geodesic(globalPolylineOptions.isGeodesic()); polylineOptions.visible(globalPolylineOptions.isVisible()); polylineOptions.zIndex(globalPolylineOptions.getZIndex()); polylineOptions.width(globalPolylineOptions.getWidth()); } Polyline polyline = addPolylineToMap(map, polylineOptions); polylineMarkers.setPolyline(polyline); List<Marker> markers = addPointsToMapAsMarkers(map, polylineOptions.getPoints(), polylineMarkerOptions, false); polylineMarkers.setMarkers(markers); return polylineMarkers; }
[ "public", "PolylineMarkers", "addPolylineToMapAsMarkers", "(", "GoogleMap", "map", ",", "PolylineOptions", "polylineOptions", ",", "MarkerOptions", "polylineMarkerOptions", ",", "PolylineOptions", "globalPolylineOptions", ")", "{", "PolylineMarkers", "polylineMarkers", "=", "...
Add a Polyline to the map as markers @param map google map @param polylineOptions polyline options @param polylineMarkerOptions polyline marker options @param globalPolylineOptions global polyline options @return polyline markers
[ "Add", "a", "Polyline", "to", "the", "map", "as", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1857-L1880
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addPolygonToMapAsMarkers
public PolygonMarkers addPolygonToMapAsMarkers( GoogleMapShapeMarkers shapeMarkers, GoogleMap map, PolygonOptions polygonOptions, MarkerOptions polygonMarkerOptions, MarkerOptions polygonMarkerHoleOptions, PolygonOptions globalPolygonOptions) { PolygonMarkers polygonMarkers = new PolygonMarkers(this); if (globalPolygonOptions != null) { polygonOptions.fillColor(globalPolygonOptions.getFillColor()); polygonOptions.strokeColor(globalPolygonOptions.getStrokeColor()); polygonOptions.geodesic(globalPolygonOptions.isGeodesic()); polygonOptions.visible(globalPolygonOptions.isVisible()); polygonOptions.zIndex(globalPolygonOptions.getZIndex()); polygonOptions.strokeWidth(globalPolygonOptions.getStrokeWidth()); } com.google.android.gms.maps.model.Polygon polygon = addPolygonToMap( map, polygonOptions); polygonMarkers.setPolygon(polygon); List<Marker> markers = addPointsToMapAsMarkers(map, polygon.getPoints(), polygonMarkerOptions, true); polygonMarkers.setMarkers(markers); for (List<LatLng> holes : polygon.getHoles()) { List<Marker> holeMarkers = addPointsToMapAsMarkers(map, holes, polygonMarkerHoleOptions, true); PolygonHoleMarkers polygonHoleMarkers = new PolygonHoleMarkers( polygonMarkers); polygonHoleMarkers.setMarkers(holeMarkers); shapeMarkers.add(polygonHoleMarkers); polygonMarkers.addHole(polygonHoleMarkers); } return polygonMarkers; }
java
public PolygonMarkers addPolygonToMapAsMarkers( GoogleMapShapeMarkers shapeMarkers, GoogleMap map, PolygonOptions polygonOptions, MarkerOptions polygonMarkerOptions, MarkerOptions polygonMarkerHoleOptions, PolygonOptions globalPolygonOptions) { PolygonMarkers polygonMarkers = new PolygonMarkers(this); if (globalPolygonOptions != null) { polygonOptions.fillColor(globalPolygonOptions.getFillColor()); polygonOptions.strokeColor(globalPolygonOptions.getStrokeColor()); polygonOptions.geodesic(globalPolygonOptions.isGeodesic()); polygonOptions.visible(globalPolygonOptions.isVisible()); polygonOptions.zIndex(globalPolygonOptions.getZIndex()); polygonOptions.strokeWidth(globalPolygonOptions.getStrokeWidth()); } com.google.android.gms.maps.model.Polygon polygon = addPolygonToMap( map, polygonOptions); polygonMarkers.setPolygon(polygon); List<Marker> markers = addPointsToMapAsMarkers(map, polygon.getPoints(), polygonMarkerOptions, true); polygonMarkers.setMarkers(markers); for (List<LatLng> holes : polygon.getHoles()) { List<Marker> holeMarkers = addPointsToMapAsMarkers(map, holes, polygonMarkerHoleOptions, true); PolygonHoleMarkers polygonHoleMarkers = new PolygonHoleMarkers( polygonMarkers); polygonHoleMarkers.setMarkers(holeMarkers); shapeMarkers.add(polygonHoleMarkers); polygonMarkers.addHole(polygonHoleMarkers); } return polygonMarkers; }
[ "public", "PolygonMarkers", "addPolygonToMapAsMarkers", "(", "GoogleMapShapeMarkers", "shapeMarkers", ",", "GoogleMap", "map", ",", "PolygonOptions", "polygonOptions", ",", "MarkerOptions", "polygonMarkerOptions", ",", "MarkerOptions", "polygonMarkerHoleOptions", ",", "PolygonO...
Add a Polygon to the map as markers @param shapeMarkers google map shape markers @param map google map @param polygonOptions polygon options @param polygonMarkerOptions polygon marker options @param polygonMarkerHoleOptions polygon marker hole options @param globalPolygonOptions global polygon options @return polygon markers
[ "Add", "a", "Polygon", "to", "the", "map", "as", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1893-L1929
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addMultiPolylineToMapAsMarkers
public MultiPolylineMarkers addMultiPolylineToMapAsMarkers( GoogleMapShapeMarkers shapeMarkers, GoogleMap map, MultiPolylineOptions multiPolyline, MarkerOptions polylineMarkerOptions, PolylineOptions globalPolylineOptions) { MultiPolylineMarkers polylines = new MultiPolylineMarkers(); for (PolylineOptions polylineOptions : multiPolyline .getPolylineOptions()) { PolylineMarkers polylineMarker = addPolylineToMapAsMarkers(map, polylineOptions, polylineMarkerOptions, globalPolylineOptions); shapeMarkers.add(polylineMarker); polylines.add(polylineMarker); } return polylines; }
java
public MultiPolylineMarkers addMultiPolylineToMapAsMarkers( GoogleMapShapeMarkers shapeMarkers, GoogleMap map, MultiPolylineOptions multiPolyline, MarkerOptions polylineMarkerOptions, PolylineOptions globalPolylineOptions) { MultiPolylineMarkers polylines = new MultiPolylineMarkers(); for (PolylineOptions polylineOptions : multiPolyline .getPolylineOptions()) { PolylineMarkers polylineMarker = addPolylineToMapAsMarkers(map, polylineOptions, polylineMarkerOptions, globalPolylineOptions); shapeMarkers.add(polylineMarker); polylines.add(polylineMarker); } return polylines; }
[ "public", "MultiPolylineMarkers", "addMultiPolylineToMapAsMarkers", "(", "GoogleMapShapeMarkers", "shapeMarkers", ",", "GoogleMap", "map", ",", "MultiPolylineOptions", "multiPolyline", ",", "MarkerOptions", "polylineMarkerOptions", ",", "PolylineOptions", "globalPolylineOptions", ...
Add a MultiPolylineOptions to the map as markers @param shapeMarkers google map shape markers @param map google map @param multiPolyline multi polyline options @param polylineMarkerOptions polyline marker options @param globalPolylineOptions global polyline options @return multi polyline markers
[ "Add", "a", "MultiPolylineOptions", "to", "the", "map", "as", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1941-L1956
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addMultiPolygonToMapAsMarkers
public MultiPolygonMarkers addMultiPolygonToMapAsMarkers( GoogleMapShapeMarkers shapeMarkers, GoogleMap map, MultiPolygonOptions multiPolygon, MarkerOptions polygonMarkerOptions, MarkerOptions polygonMarkerHoleOptions, PolygonOptions globalPolygonOptions) { MultiPolygonMarkers multiPolygonMarkers = new MultiPolygonMarkers(); for (PolygonOptions polygon : multiPolygon.getPolygonOptions()) { PolygonMarkers polygonMarker = addPolygonToMapAsMarkers( shapeMarkers, map, polygon, polygonMarkerOptions, polygonMarkerHoleOptions, globalPolygonOptions); shapeMarkers.add(polygonMarker); multiPolygonMarkers.add(polygonMarker); } return multiPolygonMarkers; }
java
public MultiPolygonMarkers addMultiPolygonToMapAsMarkers( GoogleMapShapeMarkers shapeMarkers, GoogleMap map, MultiPolygonOptions multiPolygon, MarkerOptions polygonMarkerOptions, MarkerOptions polygonMarkerHoleOptions, PolygonOptions globalPolygonOptions) { MultiPolygonMarkers multiPolygonMarkers = new MultiPolygonMarkers(); for (PolygonOptions polygon : multiPolygon.getPolygonOptions()) { PolygonMarkers polygonMarker = addPolygonToMapAsMarkers( shapeMarkers, map, polygon, polygonMarkerOptions, polygonMarkerHoleOptions, globalPolygonOptions); shapeMarkers.add(polygonMarker); multiPolygonMarkers.add(polygonMarker); } return multiPolygonMarkers; }
[ "public", "MultiPolygonMarkers", "addMultiPolygonToMapAsMarkers", "(", "GoogleMapShapeMarkers", "shapeMarkers", ",", "GoogleMap", "map", ",", "MultiPolygonOptions", "multiPolygon", ",", "MarkerOptions", "polygonMarkerOptions", ",", "MarkerOptions", "polygonMarkerHoleOptions", ","...
Add a MultiPolygonOptions to the map as markers @param shapeMarkers google map shape markers @param map google map @param multiPolygon multi polygon options @param polygonMarkerOptions polygon marker options @param polygonMarkerHoleOptions polygon marker hole options @param globalPolygonOptions global polygon options @return multi polygon markers
[ "Add", "a", "MultiPolygonOptions", "to", "the", "map", "as", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1969-L1984
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.getPointsFromMarkers
public List<LatLng> getPointsFromMarkers(List<Marker> markers) { List<LatLng> points = new ArrayList<LatLng>(); for (Marker marker : markers) { points.add(marker.getPosition()); } return points; }
java
public List<LatLng> getPointsFromMarkers(List<Marker> markers) { List<LatLng> points = new ArrayList<LatLng>(); for (Marker marker : markers) { points.add(marker.getPosition()); } return points; }
[ "public", "List", "<", "LatLng", ">", "getPointsFromMarkers", "(", "List", "<", "Marker", ">", "markers", ")", "{", "List", "<", "LatLng", ">", "points", "=", "new", "ArrayList", "<", "LatLng", ">", "(", ")", ";", "for", "(", "Marker", "marker", ":", ...
Get a list of points as LatLng from a list of Markers @param markers list of markers @return lat lngs
[ "Get", "a", "list", "of", "points", "as", "LatLng", "from", "a", "list", "of", "Markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1992-L1998
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.boundingBoxToWebMercator
public BoundingBox boundingBoxToWebMercator(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(toWebMercator); }
java
public BoundingBox boundingBoxToWebMercator(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(toWebMercator); }
[ "public", "BoundingBox", "boundingBoxToWebMercator", "(", "BoundingBox", "boundingBox", ")", "{", "if", "(", "projection", "==", "null", ")", "{", "throw", "new", "GeoPackageException", "(", "\"Shape Converter projection is null\"", ")", ";", "}", "return", "boundingB...
Transform the bounding box in the feature projection to web mercator @param boundingBox bounding box in feature projection @return bounding box in web mercator
[ "Transform", "the", "bounding", "box", "in", "the", "feature", "projection", "to", "web", "mercator" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L2302-L2307
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.boundingBoxToWgs84
public BoundingBox boundingBoxToWgs84(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(toWgs84); }
java
public BoundingBox boundingBoxToWgs84(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(toWgs84); }
[ "public", "BoundingBox", "boundingBoxToWgs84", "(", "BoundingBox", "boundingBox", ")", "{", "if", "(", "projection", "==", "null", ")", "{", "throw", "new", "GeoPackageException", "(", "\"Shape Converter projection is null\"", ")", ";", "}", "return", "boundingBox", ...
Transform the bounding box in the feature projection to WGS84 @param boundingBox bounding box in feature projection @return bounding box in WGS84
[ "Transform", "the", "bounding", "box", "in", "the", "feature", "projection", "to", "WGS84" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L2315-L2320
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.boundingBoxFromWebMercator
public BoundingBox boundingBoxFromWebMercator(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(fromWebMercator); }
java
public BoundingBox boundingBoxFromWebMercator(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(fromWebMercator); }
[ "public", "BoundingBox", "boundingBoxFromWebMercator", "(", "BoundingBox", "boundingBox", ")", "{", "if", "(", "projection", "==", "null", ")", "{", "throw", "new", "GeoPackageException", "(", "\"Shape Converter projection is null\"", ")", ";", "}", "return", "boundin...
Transform the bounding box in web mercator to the feature projection @param boundingBox bounding box in web mercator @return bounding box in the feature projection
[ "Transform", "the", "bounding", "box", "in", "web", "mercator", "to", "the", "feature", "projection" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L2328-L2333
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.boundingBoxFromWgs84
public BoundingBox boundingBoxFromWgs84(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(fromWgs84); }
java
public BoundingBox boundingBoxFromWgs84(BoundingBox boundingBox) { if (projection == null) { throw new GeoPackageException("Shape Converter projection is null"); } return boundingBox.transform(fromWgs84); }
[ "public", "BoundingBox", "boundingBoxFromWgs84", "(", "BoundingBox", "boundingBox", ")", "{", "if", "(", "projection", "==", "null", ")", "{", "throw", "new", "GeoPackageException", "(", "\"Shape Converter projection is null\"", ")", ";", "}", "return", "boundingBox",...
Transform the bounding box in WGS84 to the feature projection @param boundingBox bounding box in WGS84 @return bounding box in the feature projection
[ "Transform", "the", "bounding", "box", "in", "WGS84", "to", "the", "feature", "projection" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L2341-L2346
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java
DateSpinner.setDateFormat
public void setDateFormat(java.text.DateFormat dateFormat, java.text.DateFormat numbersDateFormat) { this.customDateFormat = dateFormat; this.secondaryDateFormat = numbersDateFormat; // update the spinner with the new date format: // the only spinner item that will be affected is the month item, so just toggle the flag twice // instead of rebuilding the whole adapter if(showMonthItem) { int monthPosition = getAdapterItemPosition(4); boolean reselectMonthItem = getSelectedItemPosition() == monthPosition; setShowMonthItem(false); setShowMonthItem(true); if(reselectMonthItem) setSelection(monthPosition); } // if we have a temporary date item selected, update that as well if(getSelectedItemPosition() == getAdapter().getCount()) setSelectedDate(getSelectedDate()); }
java
public void setDateFormat(java.text.DateFormat dateFormat, java.text.DateFormat numbersDateFormat) { this.customDateFormat = dateFormat; this.secondaryDateFormat = numbersDateFormat; // update the spinner with the new date format: // the only spinner item that will be affected is the month item, so just toggle the flag twice // instead of rebuilding the whole adapter if(showMonthItem) { int monthPosition = getAdapterItemPosition(4); boolean reselectMonthItem = getSelectedItemPosition() == monthPosition; setShowMonthItem(false); setShowMonthItem(true); if(reselectMonthItem) setSelection(monthPosition); } // if we have a temporary date item selected, update that as well if(getSelectedItemPosition() == getAdapter().getCount()) setSelectedDate(getSelectedDate()); }
[ "public", "void", "setDateFormat", "(", "java", ".", "text", ".", "DateFormat", "dateFormat", ",", "java", ".", "text", ".", "DateFormat", "numbersDateFormat", ")", "{", "this", ".", "customDateFormat", "=", "dateFormat", ";", "this", ".", "secondaryDateFormat",...
Sets the custom date format to use for formatting Calendar objects to displayable strings. @param dateFormat The new DateFormat, or null to use the default format. @param numbersDateFormat The DateFormat for formatting the secondary date when both FLAG_NUMBERS and FLAG_WEEKDAY_NAMES are set, or null to use the default format.
[ "Sets", "the", "custom", "date", "format", "to", "use", "for", "formatting", "Calendar", "objects", "to", "displayable", "strings", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L333-L351
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java
DateSpinner.setShowPastItems
public void setShowPastItems(boolean enable) { if(enable && !showPastItems) { // first reset the minimum date if necessary: if(getMinDate() != null && compareCalendarDates(getMinDate(), Calendar.getInstance()) == 0) setMinDate(null); // create the yesterday and last Monday item: final Resources res = getResources(); final Calendar date = Calendar.getInstance(); // yesterday: date.add(Calendar.DAY_OF_YEAR, -1); insertAdapterItem(new DateItem(res.getString(R.string.date_yesterday), date, R.id.date_yesterday), 0); // last weekday item: date.add(Calendar.DAY_OF_YEAR, -6); int weekday = date.get(Calendar.DAY_OF_WEEK); insertAdapterItem(new DateItem(getWeekDay(weekday, R.string.date_last_weekday), date, R.id.date_last_week), 0); } else if(!enable && showPastItems) { // delete the yesterday and last weekday items: removeAdapterItemById(R.id.date_last_week); removeAdapterItemById(R.id.date_yesterday); // we set the minimum date to today as we don't allow past items setMinDate(Calendar.getInstance()); } showPastItems = enable; }
java
public void setShowPastItems(boolean enable) { if(enable && !showPastItems) { // first reset the minimum date if necessary: if(getMinDate() != null && compareCalendarDates(getMinDate(), Calendar.getInstance()) == 0) setMinDate(null); // create the yesterday and last Monday item: final Resources res = getResources(); final Calendar date = Calendar.getInstance(); // yesterday: date.add(Calendar.DAY_OF_YEAR, -1); insertAdapterItem(new DateItem(res.getString(R.string.date_yesterday), date, R.id.date_yesterday), 0); // last weekday item: date.add(Calendar.DAY_OF_YEAR, -6); int weekday = date.get(Calendar.DAY_OF_WEEK); insertAdapterItem(new DateItem(getWeekDay(weekday, R.string.date_last_weekday), date, R.id.date_last_week), 0); } else if(!enable && showPastItems) { // delete the yesterday and last weekday items: removeAdapterItemById(R.id.date_last_week); removeAdapterItemById(R.id.date_yesterday); // we set the minimum date to today as we don't allow past items setMinDate(Calendar.getInstance()); } showPastItems = enable; }
[ "public", "void", "setShowPastItems", "(", "boolean", "enable", ")", "{", "if", "(", "enable", "&&", "!", "showPastItems", ")", "{", "// first reset the minimum date if necessary:", "if", "(", "getMinDate", "(", ")", "!=", "null", "&&", "compareCalendarDates", "("...
Toggles showing the past items. Past mode shows the yesterday and last weekday item. @param enable True to enable, false to disable past mode.
[ "Toggles", "showing", "the", "past", "items", ".", "Past", "mode", "shows", "the", "yesterday", "and", "last", "weekday", "item", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L488-L515
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java
DateSpinner.setShowMonthItem
public void setShowMonthItem(boolean enable) { if(enable && !showMonthItem) { // create the in 1 month item final Calendar date = Calendar.getInstance(); date.add(Calendar.MONTH, 1); addAdapterItem(new DateItem(formatDate(date), date, R.id.date_month)); } else if(!enable && showMonthItem) { removeAdapterItemById(R.id.date_month); } showMonthItem = enable; }
java
public void setShowMonthItem(boolean enable) { if(enable && !showMonthItem) { // create the in 1 month item final Calendar date = Calendar.getInstance(); date.add(Calendar.MONTH, 1); addAdapterItem(new DateItem(formatDate(date), date, R.id.date_month)); } else if(!enable && showMonthItem) { removeAdapterItemById(R.id.date_month); } showMonthItem = enable; }
[ "public", "void", "setShowMonthItem", "(", "boolean", "enable", ")", "{", "if", "(", "enable", "&&", "!", "showMonthItem", ")", "{", "// create the in 1 month item", "final", "Calendar", "date", "=", "Calendar", ".", "getInstance", "(", ")", ";", "date", ".", ...
Toggles showing the month item. Month mode an item in exactly one month from now. @param enable True to enable, false to disable month mode.
[ "Toggles", "showing", "the", "month", "item", ".", "Month", "mode", "an", "item", "in", "exactly", "one", "month", "from", "now", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L521-L532
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java
DateSpinner.setFlags
public void setFlags(int modeOrFlags) { setShowPastItems((modeOrFlags & ReminderDatePicker.FLAG_PAST) != 0); setShowMonthItem((modeOrFlags & ReminderDatePicker.FLAG_MONTH) != 0); setShowWeekdayNames((modeOrFlags & ReminderDatePicker.FLAG_WEEKDAY_NAMES) != 0); setShowNumbersInView((modeOrFlags & ReminderDatePicker.FLAG_NUMBERS) != 0); }
java
public void setFlags(int modeOrFlags) { setShowPastItems((modeOrFlags & ReminderDatePicker.FLAG_PAST) != 0); setShowMonthItem((modeOrFlags & ReminderDatePicker.FLAG_MONTH) != 0); setShowWeekdayNames((modeOrFlags & ReminderDatePicker.FLAG_WEEKDAY_NAMES) != 0); setShowNumbersInView((modeOrFlags & ReminderDatePicker.FLAG_NUMBERS) != 0); }
[ "public", "void", "setFlags", "(", "int", "modeOrFlags", ")", "{", "setShowPastItems", "(", "(", "modeOrFlags", "&", "ReminderDatePicker", ".", "FLAG_PAST", ")", "!=", "0", ")", ";", "setShowMonthItem", "(", "(", "modeOrFlags", "&", "ReminderDatePicker", ".", ...
Set the flags to use for this date spinner. @param modeOrFlags A mode of ReminderDatePicker.MODE_... or multiple ReminderDatePicker.FLAG_... combined with the | operator.
[ "Set", "the", "flags", "to", "use", "for", "this", "date", "spinner", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L575-L580
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/PickerSpinnerAdapter.java
PickerSpinnerAdapter.brightness
private float brightness(int color) { int r = (color >> 16) & 0xFF; int g = (color >> 8) & 0xFF; int b = color & 0xFF; int V = Math.max(b, Math.max(r, g)); return (V / 255.f); }
java
private float brightness(int color) { int r = (color >> 16) & 0xFF; int g = (color >> 8) & 0xFF; int b = color & 0xFF; int V = Math.max(b, Math.max(r, g)); return (V / 255.f); }
[ "private", "float", "brightness", "(", "int", "color", ")", "{", "int", "r", "=", "(", "color", ">>", "16", ")", "&", "0xFF", ";", "int", "g", "=", "(", "color", ">>", "8", ")", "&", "0xFF", ";", "int", "b", "=", "color", "&", "0xFF", ";", "i...
Returns the brightness component of a color int. Taken from android.graphics.Color. @return A value between 0.0f and 1.0f
[ "Returns", "the", "brightness", "component", "of", "a", "color", "int", ".", "Taken", "from", "android", ".", "graphics", ".", "Color", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/PickerSpinnerAdapter.java#L313-L320
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java
ReminderDatePicker.getNextItemDate
private @Nullable Calendar getNextItemDate(Calendar searchDate) { final int last = dateSpinner.getLastItemPosition(); for (int i=0; i<=last; i++) { final Calendar date = ((DateItem) dateSpinner.getItemAtPosition(i)).getDate(); // use the DateSpinner's compare method so hours and minutes are not considered if(DateSpinner.compareCalendarDates(date, searchDate) >= 0) return date; } // not found return null; }
java
private @Nullable Calendar getNextItemDate(Calendar searchDate) { final int last = dateSpinner.getLastItemPosition(); for (int i=0; i<=last; i++) { final Calendar date = ((DateItem) dateSpinner.getItemAtPosition(i)).getDate(); // use the DateSpinner's compare method so hours and minutes are not considered if(DateSpinner.compareCalendarDates(date, searchDate) >= 0) return date; } // not found return null; }
[ "private", "@", "Nullable", "Calendar", "getNextItemDate", "(", "Calendar", "searchDate", ")", "{", "final", "int", "last", "=", "dateSpinner", ".", "getLastItemPosition", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "last", ";", "i",...
Gets the next date item's date equal to or later than the given date in the DateSpinner. Requires that the items are in ascending order. @return A date from the next item in the DateSpinner, or no such date was found.
[ "Gets", "the", "next", "date", "item", "s", "date", "equal", "to", "or", "later", "than", "the", "given", "date", "in", "the", "DateSpinner", ".", "Requires", "that", "the", "items", "are", "in", "ascending", "order", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java#L216-L226
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java
ReminderDatePicker.setSelectedDate
public void setSelectedDate(Calendar date) { if(date!=null) { dateSpinner.setSelectedDate(date); timeSpinner.setSelectedTime(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE)); // a custom selection has been set, don't select the default date: shouldSelectDefault = false; } }
java
public void setSelectedDate(Calendar date) { if(date!=null) { dateSpinner.setSelectedDate(date); timeSpinner.setSelectedTime(date.get(Calendar.HOUR_OF_DAY), date.get(Calendar.MINUTE)); // a custom selection has been set, don't select the default date: shouldSelectDefault = false; } }
[ "public", "void", "setSelectedDate", "(", "Calendar", "date", ")", "{", "if", "(", "date", "!=", "null", ")", "{", "dateSpinner", ".", "setSelectedDate", "(", "date", ")", ";", "timeSpinner", ".", "setSelectedTime", "(", "date", ".", "get", "(", "Calendar"...
Sets the Spinners' selection as date considering both time and day. @param date The date to be selected.
[ "Sets", "the", "Spinners", "selection", "as", "date", "considering", "both", "time", "and", "day", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java#L247-L254
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java
ReminderDatePicker.setSelectedDate
public void setSelectedDate(int year, int month, int day) { dateSpinner.setSelectedDate(new GregorianCalendar(year, month, day)); // a custom selection has been set, don't select the default date: shouldSelectDefault = false; }
java
public void setSelectedDate(int year, int month, int day) { dateSpinner.setSelectedDate(new GregorianCalendar(year, month, day)); // a custom selection has been set, don't select the default date: shouldSelectDefault = false; }
[ "public", "void", "setSelectedDate", "(", "int", "year", ",", "int", "month", ",", "int", "day", ")", "{", "dateSpinner", ".", "setSelectedDate", "(", "new", "GregorianCalendar", "(", "year", ",", "month", ",", "day", ")", ")", ";", "// a custom selection ha...
Sets the Spinners' date selection as integers considering only day.
[ "Sets", "the", "Spinners", "date", "selection", "as", "integers", "considering", "only", "day", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java#L259-L263
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java
ReminderDatePicker.setHideTime
public void setHideTime(boolean enable, final boolean useDarkTheme) { if(enable && !shouldHideTime) { // hide the time spinner and show a button to show it instead timeSpinner.setVisibility(GONE); ImageButton timeButton = (ImageButton) LayoutInflater.from(getContext()).inflate(R.layout.time_button, null); timeButton.setImageResource(useDarkTheme ? R.drawable.ic_action_time_dark : R.drawable.ic_action_time_light); timeButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setHideTime(false, useDarkTheme); } }); this.addView(timeButton); } else if(!enable && shouldHideTime) { timeSpinner.setVisibility(VISIBLE); this.removeViewAt(2); } shouldHideTime = enable; }
java
public void setHideTime(boolean enable, final boolean useDarkTheme) { if(enable && !shouldHideTime) { // hide the time spinner and show a button to show it instead timeSpinner.setVisibility(GONE); ImageButton timeButton = (ImageButton) LayoutInflater.from(getContext()).inflate(R.layout.time_button, null); timeButton.setImageResource(useDarkTheme ? R.drawable.ic_action_time_dark : R.drawable.ic_action_time_light); timeButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setHideTime(false, useDarkTheme); } }); this.addView(timeButton); } else if(!enable && shouldHideTime) { timeSpinner.setVisibility(VISIBLE); this.removeViewAt(2); } shouldHideTime = enable; }
[ "public", "void", "setHideTime", "(", "boolean", "enable", ",", "final", "boolean", "useDarkTheme", ")", "{", "if", "(", "enable", "&&", "!", "shouldHideTime", ")", "{", "// hide the time spinner and show a button to show it instead", "timeSpinner", ".", "setVisibility"...
Toggles hiding the Time Spinner and replaces it with a Button. @param enable True to hide the Spinner, false to show it. @param useDarkTheme True if a white icon shall be used, false for a dark one.
[ "Toggles", "hiding", "the", "Time", "Spinner", "and", "replaces", "it", "with", "a", "Button", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java#L330-L348
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java
ReminderDatePicker.setFlags
public void setFlags(int modeOrFlags) { // check each flag and pass it on if needed: setHideTime((modeOrFlags & FLAG_HIDE_TIME) != 0, isActivityUsingDarkTheme()); dateSpinner.setFlags(modeOrFlags); timeSpinner.setFlags(modeOrFlags); }
java
public void setFlags(int modeOrFlags) { // check each flag and pass it on if needed: setHideTime((modeOrFlags & FLAG_HIDE_TIME) != 0, isActivityUsingDarkTheme()); dateSpinner.setFlags(modeOrFlags); timeSpinner.setFlags(modeOrFlags); }
[ "public", "void", "setFlags", "(", "int", "modeOrFlags", ")", "{", "// check each flag and pass it on if needed:", "setHideTime", "(", "(", "modeOrFlags", "&", "FLAG_HIDE_TIME", ")", "!=", "0", ",", "isActivityUsingDarkTheme", "(", ")", ")", ";", "dateSpinner", ".",...
Set the flags to use for the picker. @param modeOrFlags A mode of ReminderDatePicker.MODE_... or multiple ReminderDatePicker.FLAG_... combined with the | operator.
[ "Set", "the", "flags", "to", "use", "for", "the", "picker", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/ReminderDatePicker.java#L448-L453
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/TimeSpinner.java
TimeSpinner.setTimeFormat
public void setTimeFormat(java.text.DateFormat timeFormat) { this.timeFormat = timeFormat; // update our pre-built timePickerDialog with the new timeFormat: initTimePickerDialog(getContext()); // save the flags and selection first: final PickerSpinnerAdapter adapter = ((PickerSpinnerAdapter)getAdapter()); final boolean moreTimeItems = isShowingMoreTimeItems(); final boolean numbersInView = adapter.isShowingSecondaryTextInView(); final Calendar selection = getSelectedTime(); // we need to restore differently if we have a temporary selection: final boolean temporarySelected = getSelectedItemPosition() == adapter.getCount(); // to rebuild the spinner items, we need to recreate our adapter: initAdapter(getContext()); // force restore flags and selection to the new Adapter: setShowNumbersInView(numbersInView); this.showMoreTimeItems = false; if(temporarySelected) { // for some reason these calls have to be exactly in this order! setSelectedTime(selection.get(Calendar.HOUR_OF_DAY), selection.get(Calendar.MINUTE)); setShowMoreTimeItems(moreTimeItems); } else { // this way it works when a date from the array is selected (like the default) setShowMoreTimeItems(moreTimeItems); setSelectedTime(selection.get(Calendar.HOUR_OF_DAY), selection.get(Calendar.MINUTE)); } }
java
public void setTimeFormat(java.text.DateFormat timeFormat) { this.timeFormat = timeFormat; // update our pre-built timePickerDialog with the new timeFormat: initTimePickerDialog(getContext()); // save the flags and selection first: final PickerSpinnerAdapter adapter = ((PickerSpinnerAdapter)getAdapter()); final boolean moreTimeItems = isShowingMoreTimeItems(); final boolean numbersInView = adapter.isShowingSecondaryTextInView(); final Calendar selection = getSelectedTime(); // we need to restore differently if we have a temporary selection: final boolean temporarySelected = getSelectedItemPosition() == adapter.getCount(); // to rebuild the spinner items, we need to recreate our adapter: initAdapter(getContext()); // force restore flags and selection to the new Adapter: setShowNumbersInView(numbersInView); this.showMoreTimeItems = false; if(temporarySelected) { // for some reason these calls have to be exactly in this order! setSelectedTime(selection.get(Calendar.HOUR_OF_DAY), selection.get(Calendar.MINUTE)); setShowMoreTimeItems(moreTimeItems); } else { // this way it works when a date from the array is selected (like the default) setShowMoreTimeItems(moreTimeItems); setSelectedTime(selection.get(Calendar.HOUR_OF_DAY), selection.get(Calendar.MINUTE)); } }
[ "public", "void", "setTimeFormat", "(", "java", ".", "text", ".", "DateFormat", "timeFormat", ")", "{", "this", ".", "timeFormat", "=", "timeFormat", ";", "// update our pre-built timePickerDialog with the new timeFormat:", "initTimePickerDialog", "(", "getContext", "(", ...
Sets the time format to use for formatting Calendar objects to displayable strings. @param timeFormat The new time format (as java.text.DateFormat), or null to use the default format.
[ "Sets", "the", "time", "format", "to", "use", "for", "formatting", "Calendar", "objects", "to", "displayable", "strings", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/TimeSpinner.java#L264-L292
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/TimeSpinner.java
TimeSpinner.setShowMoreTimeItems
public void setShowMoreTimeItems(boolean enable) { if(enable && !showMoreTimeItems) { // create the noon and late night item: final Resources res = getResources(); // switch the afternoon item to 2pm: insertAdapterItem(new TimeItem(res.getString(R.string.time_afternoon_2), formatTime(14, 0), 14, 0, R.id.time_afternoon_2), 2); removeAdapterItemById(R.id.time_afternoon); // noon item: insertAdapterItem(new TimeItem(res.getString(R.string.time_noon), formatTime(12, 0), 12, 0, R.id.time_noon), 1); // late night item: addAdapterItem(new TimeItem(res.getString(R.string.time_late_night), formatTime(23, 0), 23, 0, R.id.time_late_night)); } else if(!enable && showMoreTimeItems) { // switch back the afternoon item: insertAdapterItem(new TimeItem(getResources().getString(R.string.time_afternoon), formatTime(13, 0), 13, 0, R.id.time_afternoon), 3); removeAdapterItemById(R.id.time_afternoon_2); removeAdapterItemById(R.id.time_noon); removeAdapterItemById(R.id.time_late_night); } showMoreTimeItems = enable; }
java
public void setShowMoreTimeItems(boolean enable) { if(enable && !showMoreTimeItems) { // create the noon and late night item: final Resources res = getResources(); // switch the afternoon item to 2pm: insertAdapterItem(new TimeItem(res.getString(R.string.time_afternoon_2), formatTime(14, 0), 14, 0, R.id.time_afternoon_2), 2); removeAdapterItemById(R.id.time_afternoon); // noon item: insertAdapterItem(new TimeItem(res.getString(R.string.time_noon), formatTime(12, 0), 12, 0, R.id.time_noon), 1); // late night item: addAdapterItem(new TimeItem(res.getString(R.string.time_late_night), formatTime(23, 0), 23, 0, R.id.time_late_night)); } else if(!enable && showMoreTimeItems) { // switch back the afternoon item: insertAdapterItem(new TimeItem(getResources().getString(R.string.time_afternoon), formatTime(13, 0), 13, 0, R.id.time_afternoon), 3); removeAdapterItemById(R.id.time_afternoon_2); removeAdapterItemById(R.id.time_noon); removeAdapterItemById(R.id.time_late_night); } showMoreTimeItems = enable; }
[ "public", "void", "setShowMoreTimeItems", "(", "boolean", "enable", ")", "{", "if", "(", "enable", "&&", "!", "showMoreTimeItems", ")", "{", "// create the noon and late night item:", "final", "Resources", "res", "=", "getResources", "(", ")", ";", "// switch the af...
Toggles showing more time items. If enabled, a noon and a late night time item are shown. @param enable True to enable, false to disable more time items.
[ "Toggles", "showing", "more", "time", "items", ".", "If", "enabled", "a", "noon", "and", "a", "late", "night", "time", "item", "are", "shown", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/TimeSpinner.java#L333-L353
train
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/TimeSpinner.java
TimeSpinner.setFlags
public void setFlags(int modeOrFlags) { setShowMoreTimeItems((modeOrFlags & ReminderDatePicker.FLAG_MORE_TIME) != 0); setShowNumbersInView((modeOrFlags & ReminderDatePicker.FLAG_NUMBERS) != 0); }
java
public void setFlags(int modeOrFlags) { setShowMoreTimeItems((modeOrFlags & ReminderDatePicker.FLAG_MORE_TIME) != 0); setShowNumbersInView((modeOrFlags & ReminderDatePicker.FLAG_NUMBERS) != 0); }
[ "public", "void", "setFlags", "(", "int", "modeOrFlags", ")", "{", "setShowMoreTimeItems", "(", "(", "modeOrFlags", "&", "ReminderDatePicker", ".", "FLAG_MORE_TIME", ")", "!=", "0", ")", ";", "setShowNumbersInView", "(", "(", "modeOrFlags", "&", "ReminderDatePicke...
Set the flags to use for this time spinner. @param modeOrFlags A mode of ReminderDatePicker.MODE_... or multiple ReminderDatePicker.FLAG_... combined with the | operator.
[ "Set", "the", "flags", "to", "use", "for", "this", "time", "spinner", "." ]
7596fbac77a5d26f687fec11758935a2b7db156f
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/TimeSpinner.java#L372-L375
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getTables
public Map<String, Map<Long, FeatureShape>> getTables(String database) { Map<String, Map<Long, FeatureShape>> tables = databases.get(database); if (tables == null) { tables = new HashMap<>(); databases.put(database, tables); } return tables; }
java
public Map<String, Map<Long, FeatureShape>> getTables(String database) { Map<String, Map<Long, FeatureShape>> tables = databases.get(database); if (tables == null) { tables = new HashMap<>(); databases.put(database, tables); } return tables; }
[ "public", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "getTables", "(", "String", "database", ")", "{", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "tables", "=", "databases", ".", "...
Get the mapping between tables and feature ids for the database @param database GeoPackage database @return tables to features ids mapping @since 3.2.0
[ "Get", "the", "mapping", "between", "tables", "and", "feature", "ids", "for", "the", "database" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L65-L73
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getFeatureIds
public Map<Long, FeatureShape> getFeatureIds(String database, String table) { Map<String, Map<Long, FeatureShape>> tables = getTables(database); Map<Long, FeatureShape> featureIds = getFeatureIds(tables, table); return featureIds; }
java
public Map<Long, FeatureShape> getFeatureIds(String database, String table) { Map<String, Map<Long, FeatureShape>> tables = getTables(database); Map<Long, FeatureShape> featureIds = getFeatureIds(tables, table); return featureIds; }
[ "public", "Map", "<", "Long", ",", "FeatureShape", ">", "getFeatureIds", "(", "String", "database", ",", "String", "table", ")", "{", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "tables", "=", "getTables", "(", "database...
Get the mapping between feature ids and map shapes for the database and table @param database GeoPackage database @param table table name @return feature ids to map shapes mapping @since 3.2.0
[ "Get", "the", "mapping", "between", "feature", "ids", "and", "map", "shapes", "for", "the", "database", "and", "table" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L93-L97
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getFeatureIds
private Map<Long, FeatureShape> getFeatureIds(Map<String, Map<Long, FeatureShape>> tables, String table) { Map<Long, FeatureShape> featureIds = tables.get(table); if (featureIds == null) { featureIds = new HashMap<>(); tables.put(table, featureIds); } return featureIds; }
java
private Map<Long, FeatureShape> getFeatureIds(Map<String, Map<Long, FeatureShape>> tables, String table) { Map<Long, FeatureShape> featureIds = tables.get(table); if (featureIds == null) { featureIds = new HashMap<>(); tables.put(table, featureIds); } return featureIds; }
[ "private", "Map", "<", "Long", ",", "FeatureShape", ">", "getFeatureIds", "(", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "tables", ",", "String", "table", ")", "{", "Map", "<", "Long", ",", "FeatureShape", ">", "feat...
Get the feature ids and map shapes for the tables and table @param tables tables @param table table name @return feature ids to map shapes mapping
[ "Get", "the", "feature", "ids", "and", "map", "shapes", "for", "the", "tables", "and", "table" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L117-L125
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getFeatureShape
public FeatureShape getFeatureShape(String database, String table, long featureId) { Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); FeatureShape featureShape = getFeatureShape(featureIds, featureId); return featureShape; }
java
public FeatureShape getFeatureShape(String database, String table, long featureId) { Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); FeatureShape featureShape = getFeatureShape(featureIds, featureId); return featureShape; }
[ "public", "FeatureShape", "getFeatureShape", "(", "String", "database", ",", "String", "table", ",", "long", "featureId", ")", "{", "Map", "<", "Long", ",", "FeatureShape", ">", "featureIds", "=", "getFeatureIds", "(", "database", ",", "table", ")", ";", "Fe...
Get the feature shape for the database, table, and feature id @param database GeoPackage database @param table table name @param featureId feature id @return feature shape @since 3.2.0
[ "Get", "the", "feature", "shape", "for", "the", "database", "table", "and", "feature", "id" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L136-L140
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getFeatureShapeCount
public int getFeatureShapeCount(String database, String table, long featureId) { return getFeatureShape(database, table, featureId).count(); }
java
public int getFeatureShapeCount(String database, String table, long featureId) { return getFeatureShape(database, table, featureId).count(); }
[ "public", "int", "getFeatureShapeCount", "(", "String", "database", ",", "String", "table", ",", "long", "featureId", ")", "{", "return", "getFeatureShape", "(", "database", ",", "table", ",", "featureId", ")", ".", "count", "(", ")", ";", "}" ]
Get the feature shape count for the database, table, and feature id @param database GeoPackage database @param table table name @param featureId feature id @return map shapes count @since 3.2.0
[ "Get", "the", "feature", "shape", "count", "for", "the", "database", "table", "and", "feature", "id" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L151-L153
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getFeatureShape
private FeatureShape getFeatureShape(Map<Long, FeatureShape> featureIds, long featureId) { FeatureShape featureShape = featureIds.get(featureId); if (featureShape == null) { featureShape = new FeatureShape(featureId); featureIds.put(featureId, featureShape); } return featureShape; }
java
private FeatureShape getFeatureShape(Map<Long, FeatureShape> featureIds, long featureId) { FeatureShape featureShape = featureIds.get(featureId); if (featureShape == null) { featureShape = new FeatureShape(featureId); featureIds.put(featureId, featureShape); } return featureShape; }
[ "private", "FeatureShape", "getFeatureShape", "(", "Map", "<", "Long", ",", "FeatureShape", ">", "featureIds", ",", "long", "featureId", ")", "{", "FeatureShape", "featureShape", "=", "featureIds", ".", "get", "(", "featureId", ")", ";", "if", "(", "featureSha...
Get the map shapes for the feature ids and feature id @param featureIds feature ids @param featureId feature id @return feature shape
[ "Get", "the", "map", "shapes", "for", "the", "feature", "ids", "and", "feature", "id" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L162-L170
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.addMapShape
public void addMapShape(GoogleMapShape mapShape, long featureId, String database, String table) { FeatureShape featureShape = getFeatureShape(database, table, featureId); featureShape.addShape(mapShape); }
java
public void addMapShape(GoogleMapShape mapShape, long featureId, String database, String table) { FeatureShape featureShape = getFeatureShape(database, table, featureId); featureShape.addShape(mapShape); }
[ "public", "void", "addMapShape", "(", "GoogleMapShape", "mapShape", ",", "long", "featureId", ",", "String", "database", ",", "String", "table", ")", "{", "FeatureShape", "featureShape", "=", "getFeatureShape", "(", "database", ",", "table", ",", "featureId", ")...
Add a map shape with the feature id, database, and table @param mapShape map shape @param featureId feature id @param database GeoPackage database @param table table name
[ "Add", "a", "map", "shape", "with", "the", "feature", "id", "database", "and", "table" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L180-L183
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.addMapMetadataShape
public void addMapMetadataShape(GoogleMapShape mapShape, long featureId, String database, String table) { FeatureShape featureShape = getFeatureShape(database, table, featureId); featureShape.addMetadataShape(mapShape); }
java
public void addMapMetadataShape(GoogleMapShape mapShape, long featureId, String database, String table) { FeatureShape featureShape = getFeatureShape(database, table, featureId); featureShape.addMetadataShape(mapShape); }
[ "public", "void", "addMapMetadataShape", "(", "GoogleMapShape", "mapShape", ",", "long", "featureId", ",", "String", "database", ",", "String", "table", ")", "{", "FeatureShape", "featureShape", "=", "getFeatureShape", "(", "database", ",", "table", ",", "featureI...
Add a map metadata shape with the feature id, database, and table @param mapShape map metadata shape @param featureId feature id @param database GeoPackage database @param table table name @since 3.2.0
[ "Add", "a", "map", "metadata", "shape", "with", "the", "feature", "id", "database", "and", "table" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L194-L197
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.exists
public boolean exists(long featureId, String database, String table) { boolean exists = false; Map<String, Map<Long, FeatureShape>> tables = databases.get(database); if (tables != null) { Map<Long, FeatureShape> featureIds = tables.get(table); if (featureIds != null) { FeatureShape shapes = featureIds.get(featureId); exists = shapes != null && shapes.hasShapes(); } } return exists; }
java
public boolean exists(long featureId, String database, String table) { boolean exists = false; Map<String, Map<Long, FeatureShape>> tables = databases.get(database); if (tables != null) { Map<Long, FeatureShape> featureIds = tables.get(table); if (featureIds != null) { FeatureShape shapes = featureIds.get(featureId); exists = shapes != null && shapes.hasShapes(); } } return exists; }
[ "public", "boolean", "exists", "(", "long", "featureId", ",", "String", "database", ",", "String", "table", ")", "{", "boolean", "exists", "=", "false", ";", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "tables", "=", "...
Check if map shapes exist for the feature id, database, and table @param featureId feature id @param database GeoPackage database @param table table name @return true if exists
[ "Check", "if", "map", "shapes", "exist", "for", "the", "feature", "id", "database", "and", "table" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L207-L219
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesWithExclusions
public int removeShapesWithExclusions(String database, Set<GoogleMapShapeType> excludedTypes) { int count = 0; Map<String, Map<Long, FeatureShape>> tables = getTables(database); if (tables != null) { Iterator<String> iterator = tables.keySet().iterator(); while (iterator.hasNext()) { String table = iterator.next(); count += removeShapesWithExclusions(database, table, excludedTypes); if (getFeatureIdsCount(database, table) <= 0) { iterator.remove(); } } } return count; }
java
public int removeShapesWithExclusions(String database, Set<GoogleMapShapeType> excludedTypes) { int count = 0; Map<String, Map<Long, FeatureShape>> tables = getTables(database); if (tables != null) { Iterator<String> iterator = tables.keySet().iterator(); while (iterator.hasNext()) { String table = iterator.next(); count += removeShapesWithExclusions(database, table, excludedTypes); if (getFeatureIdsCount(database, table) <= 0) { iterator.remove(); } } } return count; }
[ "public", "int", "removeShapesWithExclusions", "(", "String", "database", ",", "Set", "<", "GoogleMapShapeType", ">", "excludedTypes", ")", "{", "int", "count", "=", "0", ";", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "t...
Remove all map shapes in the database from the map, excluding shapes with the excluded types @param database GeoPackage database @param excludedTypes Google Map Shape Types to exclude from map removal @return count of removed features @since 3.2.0
[ "Remove", "all", "map", "shapes", "in", "the", "database", "from", "the", "map", "excluding", "shapes", "with", "the", "excluded", "types" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L329-L351
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesWithExclusion
public int removeShapesWithExclusion(String database, String table, GoogleMapShapeType excludedType) { Set<GoogleMapShapeType> excludedTypes = new HashSet<>(); excludedTypes.add(excludedType); return removeShapesWithExclusions(database, table, excludedTypes); }
java
public int removeShapesWithExclusion(String database, String table, GoogleMapShapeType excludedType) { Set<GoogleMapShapeType> excludedTypes = new HashSet<>(); excludedTypes.add(excludedType); return removeShapesWithExclusions(database, table, excludedTypes); }
[ "public", "int", "removeShapesWithExclusion", "(", "String", "database", ",", "String", "table", ",", "GoogleMapShapeType", "excludedType", ")", "{", "Set", "<", "GoogleMapShapeType", ">", "excludedTypes", "=", "new", "HashSet", "<>", "(", ")", ";", "excludedTypes...
Remove all map shapes in the database and table from the map, excluding shapes with the excluded type @param database GeoPackage database @param table table name @param excludedType Google Map Shape Type to exclude from map removal @return count of removed features @since 3.2.0
[ "Remove", "all", "map", "shapes", "in", "the", "database", "and", "table", "from", "the", "map", "excluding", "shapes", "with", "the", "excluded", "type" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L373-L377
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesWithExclusions
public int removeShapesWithExclusions(String database, String table, Set<GoogleMapShapeType> excludedTypes) { int count = 0; Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); if (featureIds != null) { Iterator<Long> iterator = featureIds.keySet().iterator(); while (iterator.hasNext()) { long featureId = iterator.next(); FeatureShape featureShape = getFeatureShape(featureIds, featureId); if (featureShape != null) { Iterator<GoogleMapShape> shapeIterator = featureShape.getShapes().iterator(); while (shapeIterator.hasNext()) { GoogleMapShape mapShape = shapeIterator.next(); if (excludedTypes == null || !excludedTypes.contains(mapShape.getShapeType())) { mapShape.remove(); shapeIterator.remove(); } } } if (featureShape == null || !featureShape.hasShapes()) { if(featureShape != null) { featureShape.removeMetadataShapes(); } iterator.remove(); count++; } } } return count; }
java
public int removeShapesWithExclusions(String database, String table, Set<GoogleMapShapeType> excludedTypes) { int count = 0; Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); if (featureIds != null) { Iterator<Long> iterator = featureIds.keySet().iterator(); while (iterator.hasNext()) { long featureId = iterator.next(); FeatureShape featureShape = getFeatureShape(featureIds, featureId); if (featureShape != null) { Iterator<GoogleMapShape> shapeIterator = featureShape.getShapes().iterator(); while (shapeIterator.hasNext()) { GoogleMapShape mapShape = shapeIterator.next(); if (excludedTypes == null || !excludedTypes.contains(mapShape.getShapeType())) { mapShape.remove(); shapeIterator.remove(); } } } if (featureShape == null || !featureShape.hasShapes()) { if(featureShape != null) { featureShape.removeMetadataShapes(); } iterator.remove(); count++; } } } return count; }
[ "public", "int", "removeShapesWithExclusions", "(", "String", "database", ",", "String", "table", ",", "Set", "<", "GoogleMapShapeType", ">", "excludedTypes", ")", "{", "int", "count", "=", "0", ";", "Map", "<", "Long", ",", "FeatureShape", ">", "featureIds", ...
Remove all map shapes in the database and table from the map, excluding shapes with the excluded types @param database GeoPackage database @param table table name @param excludedTypes Google Map Shape Types to exclude from map removal @return count of removed features @since 3.2.0
[ "Remove", "all", "map", "shapes", "in", "the", "database", "and", "table", "from", "the", "map", "excluding", "shapes", "with", "the", "excluded", "types" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L405-L445
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesNotWithinMap
public int removeShapesNotWithinMap(GoogleMap map) { int count = 0; BoundingBox boundingBox = MapUtils.getBoundingBox(map); for (String database : databases.keySet()) { count += removeShapesNotWithinMap(boundingBox, database); } return count; }
java
public int removeShapesNotWithinMap(GoogleMap map) { int count = 0; BoundingBox boundingBox = MapUtils.getBoundingBox(map); for (String database : databases.keySet()) { count += removeShapesNotWithinMap(boundingBox, database); } return count; }
[ "public", "int", "removeShapesNotWithinMap", "(", "GoogleMap", "map", ")", "{", "int", "count", "=", "0", ";", "BoundingBox", "boundingBox", "=", "MapUtils", ".", "getBoundingBox", "(", "map", ")", ";", "for", "(", "String", "database", ":", "databases", "."...
Remove all map shapes that are not visible in the map @param map map @return count of removed features
[ "Remove", "all", "map", "shapes", "that", "are", "not", "visible", "in", "the", "map" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L453-L464
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesNotWithinMap
public int removeShapesNotWithinMap(BoundingBox boundingBox, String database) { int count = 0; Map<String, Map<Long, FeatureShape>> tables = getTables(database); if (tables != null) { for (String table : tables.keySet()) { count += removeShapesNotWithinMap(boundingBox, database, table); } } return count; }
java
public int removeShapesNotWithinMap(BoundingBox boundingBox, String database) { int count = 0; Map<String, Map<Long, FeatureShape>> tables = getTables(database); if (tables != null) { for (String table : tables.keySet()) { count += removeShapesNotWithinMap(boundingBox, database, table); } } return count; }
[ "public", "int", "removeShapesNotWithinMap", "(", "BoundingBox", "boundingBox", ",", "String", "database", ")", "{", "int", "count", "=", "0", ";", "Map", "<", "String", ",", "Map", "<", "Long", ",", "FeatureShape", ">", ">", "tables", "=", "getTables", "(...
Remove all map shapes in the database that are not visible in the bounding box @param boundingBox bounding box @param database GeoPackage database @return count of removed features @since 3.2.0
[ "Remove", "all", "map", "shapes", "in", "the", "database", "that", "are", "not", "visible", "in", "the", "bounding", "box" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L490-L504
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeShapesNotWithinMap
public int removeShapesNotWithinMap(BoundingBox boundingBox, String database, String table) { int count = 0; Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); if (featureIds != null) { List<Long> deleteFeatureIds = new ArrayList<>(); for (long featureId : featureIds.keySet()) { FeatureShape featureShape = getFeatureShape(featureIds, featureId); if (featureShape != null) { boolean delete = true; for (GoogleMapShape mapShape : featureShape.getShapes()) { BoundingBox mapShapeBoundingBox = mapShape.boundingBox(); boolean allowEmpty = mapShape.getGeometryType() == GeometryType.POINT; if (TileBoundingBoxUtils.overlap(mapShapeBoundingBox, boundingBox, ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH, allowEmpty) != null) { delete = false; break; } } if (delete) { deleteFeatureIds.add(featureId); } } } for (long deleteFeatureId : deleteFeatureIds) { FeatureShape featureShape = getFeatureShape(featureIds, deleteFeatureId); if (featureShape != null) { featureShape.remove(); featureIds.remove(deleteFeatureId); } count++; } } return count; }
java
public int removeShapesNotWithinMap(BoundingBox boundingBox, String database, String table) { int count = 0; Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); if (featureIds != null) { List<Long> deleteFeatureIds = new ArrayList<>(); for (long featureId : featureIds.keySet()) { FeatureShape featureShape = getFeatureShape(featureIds, featureId); if (featureShape != null) { boolean delete = true; for (GoogleMapShape mapShape : featureShape.getShapes()) { BoundingBox mapShapeBoundingBox = mapShape.boundingBox(); boolean allowEmpty = mapShape.getGeometryType() == GeometryType.POINT; if (TileBoundingBoxUtils.overlap(mapShapeBoundingBox, boundingBox, ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH, allowEmpty) != null) { delete = false; break; } } if (delete) { deleteFeatureIds.add(featureId); } } } for (long deleteFeatureId : deleteFeatureIds) { FeatureShape featureShape = getFeatureShape(featureIds, deleteFeatureId); if (featureShape != null) { featureShape.remove(); featureIds.remove(deleteFeatureId); } count++; } } return count; }
[ "public", "int", "removeShapesNotWithinMap", "(", "BoundingBox", "boundingBox", ",", "String", "database", ",", "String", "table", ")", "{", "int", "count", "=", "0", ";", "Map", "<", "Long", ",", "FeatureShape", ">", "featureIds", "=", "getFeatureIds", "(", ...
Remove all map shapes in the database and table that are not visible in the bounding box @param boundingBox bounding box @param database GeoPackage database @return count of removed features
[ "Remove", "all", "map", "shapes", "in", "the", "database", "and", "table", "that", "are", "not", "visible", "in", "the", "bounding", "box" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L530-L574
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.removeFeatureShape
public boolean removeFeatureShape(String database, String table, long featureId) { boolean removed = false; Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); if (featureIds != null) { FeatureShape featureShape = featureIds.remove(featureId); if (featureShape != null) { featureShape.remove(); removed = true; } } return removed; }
java
public boolean removeFeatureShape(String database, String table, long featureId) { boolean removed = false; Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); if (featureIds != null) { FeatureShape featureShape = featureIds.remove(featureId); if (featureShape != null) { featureShape.remove(); removed = true; } } return removed; }
[ "public", "boolean", "removeFeatureShape", "(", "String", "database", ",", "String", "table", ",", "long", "featureId", ")", "{", "boolean", "removed", "=", "false", ";", "Map", "<", "Long", ",", "FeatureShape", ">", "featureIds", "=", "getFeatureIds", "(", ...
Remove the feature shape from the database and table @param database GeoPackage database @param table table name @param featureId feature id @return true if removed @since 3.2.0
[ "Remove", "the", "feature", "shape", "from", "the", "database", "and", "table" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L585-L599
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.remove
public void remove() { switch (shapeType) { case MARKER: ((Marker) shape).remove(); break; case POLYGON: ((Polygon) shape).remove(); break; case POLYLINE: ((Polyline) shape).remove(); break; case MULTI_MARKER: ((MultiMarker) shape).remove(); break; case MULTI_POLYLINE: ((MultiPolyline) shape).remove(); break; case MULTI_POLYGON: ((MultiPolygon) shape).remove(); break; case POLYLINE_MARKERS: ((PolylineMarkers) shape).remove(); break; case POLYGON_MARKERS: ((PolygonMarkers) shape).remove(); break; case MULTI_POLYLINE_MARKERS: ((MultiPolylineMarkers) shape).remove(); break; case MULTI_POLYGON_MARKERS: ((MultiPolygonMarkers) shape).remove(); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.remove(); } break; default: } }
java
public void remove() { switch (shapeType) { case MARKER: ((Marker) shape).remove(); break; case POLYGON: ((Polygon) shape).remove(); break; case POLYLINE: ((Polyline) shape).remove(); break; case MULTI_MARKER: ((MultiMarker) shape).remove(); break; case MULTI_POLYLINE: ((MultiPolyline) shape).remove(); break; case MULTI_POLYGON: ((MultiPolygon) shape).remove(); break; case POLYLINE_MARKERS: ((PolylineMarkers) shape).remove(); break; case POLYGON_MARKERS: ((PolygonMarkers) shape).remove(); break; case MULTI_POLYLINE_MARKERS: ((MultiPolylineMarkers) shape).remove(); break; case MULTI_POLYGON_MARKERS: ((MultiPolygonMarkers) shape).remove(); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.remove(); } break; default: } }
[ "public", "void", "remove", "(", ")", "{", "switch", "(", "shapeType", ")", "{", "case", "MARKER", ":", "(", "(", "Marker", ")", "shape", ")", ".", "remove", "(", ")", ";", "break", ";", "case", "POLYGON", ":", "(", "(", "Polygon", ")", "shape", ...
Removes all objects added to the map
[ "Removes", "all", "objects", "added", "to", "the", "map" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L110-L154
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.setVisible
public void setVisible(boolean visible) { switch (shapeType) { case MARKER_OPTIONS: ((MarkerOptions) shape).visible(visible); break; case POLYLINE_OPTIONS: ((PolylineOptions) shape).visible(visible); break; case POLYGON_OPTIONS: ((PolygonOptions) shape).visible(visible); break; case MULTI_POLYLINE_OPTIONS: ((MultiPolylineOptions) shape).visible(visible); break; case MULTI_POLYGON_OPTIONS: ((MultiPolygonOptions) shape).visible(visible); break; case MARKER: ((Marker) shape).setVisible(visible); break; case POLYGON: ((Polygon) shape).setVisible(visible); break; case POLYLINE: ((Polyline) shape).setVisible(visible); break; case MULTI_MARKER: ((MultiMarker) shape).setVisible(visible); break; case MULTI_POLYLINE: ((MultiPolyline) shape).setVisible(visible); break; case MULTI_POLYGON: ((MultiPolygon) shape).setVisible(visible); break; case POLYLINE_MARKERS: ((PolylineMarkers) shape).setVisible(visible); break; case POLYGON_MARKERS: ((PolygonMarkers) shape).setVisible(visible); break; case MULTI_POLYLINE_MARKERS: ((MultiPolylineMarkers) shape).setVisible(visible); break; case MULTI_POLYGON_MARKERS: ((MultiPolygonMarkers) shape).setVisible(visible); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.setVisible(visible); } break; default: } }
java
public void setVisible(boolean visible) { switch (shapeType) { case MARKER_OPTIONS: ((MarkerOptions) shape).visible(visible); break; case POLYLINE_OPTIONS: ((PolylineOptions) shape).visible(visible); break; case POLYGON_OPTIONS: ((PolygonOptions) shape).visible(visible); break; case MULTI_POLYLINE_OPTIONS: ((MultiPolylineOptions) shape).visible(visible); break; case MULTI_POLYGON_OPTIONS: ((MultiPolygonOptions) shape).visible(visible); break; case MARKER: ((Marker) shape).setVisible(visible); break; case POLYGON: ((Polygon) shape).setVisible(visible); break; case POLYLINE: ((Polyline) shape).setVisible(visible); break; case MULTI_MARKER: ((MultiMarker) shape).setVisible(visible); break; case MULTI_POLYLINE: ((MultiPolyline) shape).setVisible(visible); break; case MULTI_POLYGON: ((MultiPolygon) shape).setVisible(visible); break; case POLYLINE_MARKERS: ((PolylineMarkers) shape).setVisible(visible); break; case POLYGON_MARKERS: ((PolygonMarkers) shape).setVisible(visible); break; case MULTI_POLYLINE_MARKERS: ((MultiPolylineMarkers) shape).setVisible(visible); break; case MULTI_POLYGON_MARKERS: ((MultiPolygonMarkers) shape).setVisible(visible); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.setVisible(visible); } break; default: } }
[ "public", "void", "setVisible", "(", "boolean", "visible", ")", "{", "switch", "(", "shapeType", ")", "{", "case", "MARKER_OPTIONS", ":", "(", "(", "MarkerOptions", ")", "shape", ")", ".", "visible", "(", "visible", ")", ";", "break", ";", "case", "POLYL...
Updates visibility of all objects @param visible visible flag @since 1.3.2
[ "Updates", "visibility", "of", "all", "objects" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L162-L221
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.update
public void update() { switch (shapeType) { case POLYLINE_MARKERS: ((PolylineMarkers) shape).update(); break; case POLYGON_MARKERS: ((PolygonMarkers) shape).update(); break; case MULTI_POLYLINE_MARKERS: ((MultiPolylineMarkers) shape).update(); break; case MULTI_POLYGON_MARKERS: ((MultiPolygonMarkers) shape).update(); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.update(); } break; default: } }
java
public void update() { switch (shapeType) { case POLYLINE_MARKERS: ((PolylineMarkers) shape).update(); break; case POLYGON_MARKERS: ((PolygonMarkers) shape).update(); break; case MULTI_POLYLINE_MARKERS: ((MultiPolylineMarkers) shape).update(); break; case MULTI_POLYGON_MARKERS: ((MultiPolygonMarkers) shape).update(); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.update(); } break; default: } }
[ "public", "void", "update", "(", ")", "{", "switch", "(", "shapeType", ")", "{", "case", "POLYLINE_MARKERS", ":", "(", "(", "PolylineMarkers", ")", "shape", ")", ".", "update", "(", ")", ";", "break", ";", "case", "POLYGON_MARKERS", ":", "(", "(", "Pol...
Updates all objects that could have changed from moved markers
[ "Updates", "all", "objects", "that", "could", "have", "changed", "from", "moved", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L293-L319
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.isValid
public boolean isValid() { boolean valid = true; switch (shapeType) { case POLYLINE_MARKERS: valid = ((PolylineMarkers) shape).isValid(); break; case POLYGON_MARKERS: valid = ((PolygonMarkers) shape).isValid(); break; case MULTI_POLYLINE_MARKERS: valid = ((MultiPolylineMarkers) shape).isValid(); break; case MULTI_POLYGON_MARKERS: valid = ((MultiPolygonMarkers) shape).isValid(); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { valid = shapeListItem.isValid(); if (!valid) { break; } } break; default: } return valid; }
java
public boolean isValid() { boolean valid = true; switch (shapeType) { case POLYLINE_MARKERS: valid = ((PolylineMarkers) shape).isValid(); break; case POLYGON_MARKERS: valid = ((PolygonMarkers) shape).isValid(); break; case MULTI_POLYLINE_MARKERS: valid = ((MultiPolylineMarkers) shape).isValid(); break; case MULTI_POLYGON_MARKERS: valid = ((MultiPolygonMarkers) shape).isValid(); break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { valid = shapeListItem.isValid(); if (!valid) { break; } } break; default: } return valid; }
[ "public", "boolean", "isValid", "(", ")", "{", "boolean", "valid", "=", "true", ";", "switch", "(", "shapeType", ")", "{", "case", "POLYLINE_MARKERS", ":", "valid", "=", "(", "(", "PolylineMarkers", ")", "shape", ")", ".", "isValid", "(", ")", ";", "br...
Determines if the shape is in a valid state
[ "Determines", "if", "the", "shape", "is", "in", "a", "valid", "state" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L324-L356
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.boundingBox
public BoundingBox boundingBox() { BoundingBox boundingBox = new BoundingBox(Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE); expandBoundingBox(boundingBox); return boundingBox; }
java
public BoundingBox boundingBox() { BoundingBox boundingBox = new BoundingBox(Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE); expandBoundingBox(boundingBox); return boundingBox; }
[ "public", "BoundingBox", "boundingBox", "(", ")", "{", "BoundingBox", "boundingBox", "=", "new", "BoundingBox", "(", "Double", ".", "MAX_VALUE", ",", "Double", ".", "MAX_VALUE", ",", "-", "Double", ".", "MAX_VALUE", ",", "-", "Double", ".", "MAX_VALUE", ")",...
Get a bounding box that includes the shape @return bounding box
[ "Get", "a", "bounding", "box", "that", "includes", "the", "shape" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L363-L367
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.expandBoundingBox
public void expandBoundingBox(BoundingBox boundingBox) { switch (shapeType) { case LAT_LNG: expandBoundingBox(boundingBox, (LatLng) shape); break; case MARKER_OPTIONS: expandBoundingBox(boundingBox, ((MarkerOptions) shape).getPosition()); break; case POLYLINE_OPTIONS: expandBoundingBox(boundingBox, ((PolylineOptions) shape).getPoints()); break; case POLYGON_OPTIONS: expandBoundingBox(boundingBox, ((PolygonOptions) shape).getPoints()); break; case MULTI_LAT_LNG: expandBoundingBox(boundingBox, ((MultiLatLng) shape).getLatLngs()); break; case MULTI_POLYLINE_OPTIONS: MultiPolylineOptions multiPolylineOptions = (MultiPolylineOptions) shape; for (PolylineOptions polylineOptions : multiPolylineOptions .getPolylineOptions()) { expandBoundingBox(boundingBox, polylineOptions.getPoints()); } break; case MULTI_POLYGON_OPTIONS: MultiPolygonOptions multiPolygonOptions = (MultiPolygonOptions) shape; for (PolygonOptions polygonOptions : multiPolygonOptions .getPolygonOptions()) { expandBoundingBox(boundingBox, polygonOptions.getPoints()); } break; case MARKER: expandBoundingBox(boundingBox, ((Marker) shape).getPosition()); break; case POLYLINE: expandBoundingBox(boundingBox, ((Polyline) shape).getPoints()); break; case POLYGON: expandBoundingBox(boundingBox, ((Polygon) shape).getPoints()); break; case MULTI_MARKER: expandBoundingBoxMarkers(boundingBox, ((MultiMarker) shape).getMarkers()); break; case MULTI_POLYLINE: MultiPolyline multiPolyline = (MultiPolyline) shape; for (Polyline polyline : multiPolyline.getPolylines()) { expandBoundingBox(boundingBox, polyline.getPoints()); } break; case MULTI_POLYGON: MultiPolygon multiPolygon = (MultiPolygon) shape; for (Polygon polygon : multiPolygon.getPolygons()) { expandBoundingBox(boundingBox, polygon.getPoints()); } break; case POLYLINE_MARKERS: expandBoundingBoxMarkers(boundingBox, ((PolylineMarkers) shape).getMarkers()); break; case POLYGON_MARKERS: expandBoundingBoxMarkers(boundingBox, ((PolygonMarkers) shape).getMarkers()); break; case MULTI_POLYLINE_MARKERS: MultiPolylineMarkers multiPolylineMarkers = (MultiPolylineMarkers) shape; for (PolylineMarkers polylineMarkers : multiPolylineMarkers .getPolylineMarkers()) { expandBoundingBoxMarkers(boundingBox, polylineMarkers.getMarkers()); } break; case MULTI_POLYGON_MARKERS: MultiPolygonMarkers multiPolygonMarkers = (MultiPolygonMarkers) shape; for (PolygonMarkers polygonMarkers : multiPolygonMarkers .getPolygonMarkers()) { expandBoundingBoxMarkers(boundingBox, polygonMarkers.getMarkers()); } break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.expandBoundingBox(boundingBox); } break; } }
java
public void expandBoundingBox(BoundingBox boundingBox) { switch (shapeType) { case LAT_LNG: expandBoundingBox(boundingBox, (LatLng) shape); break; case MARKER_OPTIONS: expandBoundingBox(boundingBox, ((MarkerOptions) shape).getPosition()); break; case POLYLINE_OPTIONS: expandBoundingBox(boundingBox, ((PolylineOptions) shape).getPoints()); break; case POLYGON_OPTIONS: expandBoundingBox(boundingBox, ((PolygonOptions) shape).getPoints()); break; case MULTI_LAT_LNG: expandBoundingBox(boundingBox, ((MultiLatLng) shape).getLatLngs()); break; case MULTI_POLYLINE_OPTIONS: MultiPolylineOptions multiPolylineOptions = (MultiPolylineOptions) shape; for (PolylineOptions polylineOptions : multiPolylineOptions .getPolylineOptions()) { expandBoundingBox(boundingBox, polylineOptions.getPoints()); } break; case MULTI_POLYGON_OPTIONS: MultiPolygonOptions multiPolygonOptions = (MultiPolygonOptions) shape; for (PolygonOptions polygonOptions : multiPolygonOptions .getPolygonOptions()) { expandBoundingBox(boundingBox, polygonOptions.getPoints()); } break; case MARKER: expandBoundingBox(boundingBox, ((Marker) shape).getPosition()); break; case POLYLINE: expandBoundingBox(boundingBox, ((Polyline) shape).getPoints()); break; case POLYGON: expandBoundingBox(boundingBox, ((Polygon) shape).getPoints()); break; case MULTI_MARKER: expandBoundingBoxMarkers(boundingBox, ((MultiMarker) shape).getMarkers()); break; case MULTI_POLYLINE: MultiPolyline multiPolyline = (MultiPolyline) shape; for (Polyline polyline : multiPolyline.getPolylines()) { expandBoundingBox(boundingBox, polyline.getPoints()); } break; case MULTI_POLYGON: MultiPolygon multiPolygon = (MultiPolygon) shape; for (Polygon polygon : multiPolygon.getPolygons()) { expandBoundingBox(boundingBox, polygon.getPoints()); } break; case POLYLINE_MARKERS: expandBoundingBoxMarkers(boundingBox, ((PolylineMarkers) shape).getMarkers()); break; case POLYGON_MARKERS: expandBoundingBoxMarkers(boundingBox, ((PolygonMarkers) shape).getMarkers()); break; case MULTI_POLYLINE_MARKERS: MultiPolylineMarkers multiPolylineMarkers = (MultiPolylineMarkers) shape; for (PolylineMarkers polylineMarkers : multiPolylineMarkers .getPolylineMarkers()) { expandBoundingBoxMarkers(boundingBox, polylineMarkers.getMarkers()); } break; case MULTI_POLYGON_MARKERS: MultiPolygonMarkers multiPolygonMarkers = (MultiPolygonMarkers) shape; for (PolygonMarkers polygonMarkers : multiPolygonMarkers .getPolygonMarkers()) { expandBoundingBoxMarkers(boundingBox, polygonMarkers.getMarkers()); } break; case COLLECTION: @SuppressWarnings("unchecked") List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape; for (GoogleMapShape shapeListItem : shapeList) { shapeListItem.expandBoundingBox(boundingBox); } break; } }
[ "public", "void", "expandBoundingBox", "(", "BoundingBox", "boundingBox", ")", "{", "switch", "(", "shapeType", ")", "{", "case", "LAT_LNG", ":", "expandBoundingBox", "(", "boundingBox", ",", "(", "LatLng", ")", "shape", ")", ";", "break", ";", "case", "MARK...
Expand the bounding box to include the shape @param boundingBox bounding box
[ "Expand", "the", "bounding", "box", "to", "include", "the", "shape" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L374-L467
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.expandBoundingBox
private void expandBoundingBox(BoundingBox boundingBox, LatLng latLng) { double latitude = latLng.latitude; double longitude = latLng.longitude; if (boundingBox.getMinLongitude() <= 3 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH && boundingBox.getMaxLongitude() >= 3 * -ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) { if (longitude < boundingBox.getMinLongitude()) { if (boundingBox.getMinLongitude() - longitude > (longitude + (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)) - boundingBox.getMaxLongitude()) { longitude += (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH); } } else if (longitude > boundingBox.getMaxLongitude()) { if (longitude - boundingBox.getMaxLongitude() > boundingBox.getMinLongitude() - (longitude - (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH))) { longitude -= (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH); } } } if (latitude < boundingBox.getMinLatitude()) { boundingBox.setMinLatitude(latitude); } if (latitude > boundingBox.getMaxLatitude()) { boundingBox.setMaxLatitude(latitude); } if (longitude < boundingBox.getMinLongitude()) { boundingBox.setMinLongitude(longitude); } if (longitude > boundingBox.getMaxLongitude()) { boundingBox.setMaxLongitude(longitude); } }
java
private void expandBoundingBox(BoundingBox boundingBox, LatLng latLng) { double latitude = latLng.latitude; double longitude = latLng.longitude; if (boundingBox.getMinLongitude() <= 3 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH && boundingBox.getMaxLongitude() >= 3 * -ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) { if (longitude < boundingBox.getMinLongitude()) { if (boundingBox.getMinLongitude() - longitude > (longitude + (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)) - boundingBox.getMaxLongitude()) { longitude += (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH); } } else if (longitude > boundingBox.getMaxLongitude()) { if (longitude - boundingBox.getMaxLongitude() > boundingBox.getMinLongitude() - (longitude - (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH))) { longitude -= (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH); } } } if (latitude < boundingBox.getMinLatitude()) { boundingBox.setMinLatitude(latitude); } if (latitude > boundingBox.getMaxLatitude()) { boundingBox.setMaxLatitude(latitude); } if (longitude < boundingBox.getMinLongitude()) { boundingBox.setMinLongitude(longitude); } if (longitude > boundingBox.getMaxLongitude()) { boundingBox.setMaxLongitude(longitude); } }
[ "private", "void", "expandBoundingBox", "(", "BoundingBox", "boundingBox", ",", "LatLng", "latLng", ")", "{", "double", "latitude", "=", "latLng", ".", "latitude", ";", "double", "longitude", "=", "latLng", ".", "longitude", ";", "if", "(", "boundingBox", ".",...
Expand the bounding box by the LatLng @param boundingBox bounding box @param latLng lat lng
[ "Expand", "the", "bounding", "box", "by", "the", "LatLng" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L475-L507
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.expandBoundingBox
private void expandBoundingBox(BoundingBox boundingBox, List<LatLng> latLngs) { for (LatLng latLng : latLngs) { expandBoundingBox(boundingBox, latLng); } }
java
private void expandBoundingBox(BoundingBox boundingBox, List<LatLng> latLngs) { for (LatLng latLng : latLngs) { expandBoundingBox(boundingBox, latLng); } }
[ "private", "void", "expandBoundingBox", "(", "BoundingBox", "boundingBox", ",", "List", "<", "LatLng", ">", "latLngs", ")", "{", "for", "(", "LatLng", "latLng", ":", "latLngs", ")", "{", "expandBoundingBox", "(", "boundingBox", ",", "latLng", ")", ";", "}", ...
Expand the bounding box by the LatLngs @param boundingBox bounding box @param latLngs lat lngs
[ "Expand", "the", "bounding", "box", "by", "the", "LatLngs" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L515-L519
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java
GoogleMapShape.expandBoundingBoxMarkers
private void expandBoundingBoxMarkers(BoundingBox boundingBox, List<Marker> markers) { for (Marker marker : markers) { expandBoundingBox(boundingBox, marker.getPosition()); } }
java
private void expandBoundingBoxMarkers(BoundingBox boundingBox, List<Marker> markers) { for (Marker marker : markers) { expandBoundingBox(boundingBox, marker.getPosition()); } }
[ "private", "void", "expandBoundingBoxMarkers", "(", "BoundingBox", "boundingBox", ",", "List", "<", "Marker", ">", "markers", ")", "{", "for", "(", "Marker", "marker", ":", "markers", ")", "{", "expandBoundingBox", "(", "boundingBox", ",", "marker", ".", "getP...
Expand the bounding box by the markers @param boundingBox bounding box @param markers list of markers
[ "Expand", "the", "bounding", "box", "by", "the", "markers" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShape.java#L527-L532
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java
BoundedOverlay.setBoundingBox
public void setBoundingBox(BoundingBox boundingBox, Projection projection) { ProjectionTransform projectionToWebMercator = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); webMercatorBoundingBox = boundingBox .transform(projectionToWebMercator); }
java
public void setBoundingBox(BoundingBox boundingBox, Projection projection) { ProjectionTransform projectionToWebMercator = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); webMercatorBoundingBox = boundingBox .transform(projectionToWebMercator); }
[ "public", "void", "setBoundingBox", "(", "BoundingBox", "boundingBox", ",", "Projection", "projection", ")", "{", "ProjectionTransform", "projectionToWebMercator", "=", "projection", ".", "getTransformation", "(", "ProjectionConstants", ".", "EPSG_WEB_MERCATOR", ")", ";",...
Set the bounding box, provided as the indicated projection @param boundingBox bounding box @param projection projection
[ "Set", "the", "bounding", "box", "provided", "as", "the", "indicated", "projection" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java#L85-L90
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java
BoundedOverlay.getBoundingBox
public BoundingBox getBoundingBox(Projection projection) { ProjectionTransform webMercatorToProjection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WEB_MERCATOR) .getTransformation(projection); return webMercatorBoundingBox .transform(webMercatorToProjection); }
java
public BoundingBox getBoundingBox(Projection projection) { ProjectionTransform webMercatorToProjection = ProjectionFactory .getProjection(ProjectionConstants.EPSG_WEB_MERCATOR) .getTransformation(projection); return webMercatorBoundingBox .transform(webMercatorToProjection); }
[ "public", "BoundingBox", "getBoundingBox", "(", "Projection", "projection", ")", "{", "ProjectionTransform", "webMercatorToProjection", "=", "ProjectionFactory", ".", "getProjection", "(", "ProjectionConstants", ".", "EPSG_WEB_MERCATOR", ")", ".", "getTransformation", "(", ...
Get the bounding box as the provided projection @param projection projection
[ "Get", "the", "bounding", "box", "as", "the", "provided", "projection" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java#L106-L112
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java
BoundedOverlay.hasTile
public boolean hasTile(int x, int y, int zoom) { // Check if generating tiles for the zoom level and is within the bounding box boolean hasTile = isWithinBounds(x, y, zoom); if (hasTile) { // Check if there is a tile to retrieve hasTile = hasTileToRetrieve(x, y, zoom); } return hasTile; }
java
public boolean hasTile(int x, int y, int zoom) { // Check if generating tiles for the zoom level and is within the bounding box boolean hasTile = isWithinBounds(x, y, zoom); if (hasTile) { // Check if there is a tile to retrieve hasTile = hasTileToRetrieve(x, y, zoom); } return hasTile; }
[ "public", "boolean", "hasTile", "(", "int", "x", ",", "int", "y", ",", "int", "zoom", ")", "{", "// Check if generating tiles for the zoom level and is within the bounding box", "boolean", "hasTile", "=", "isWithinBounds", "(", "x", ",", "y", ",", "zoom", ")", ";"...
Determine if there is a tile for the x, y, and zoom @param x x coordinate @param y y coordinate @param zoom zoom value @return true if there is a tile @since 1.2.6
[ "Determine", "if", "there", "is", "a", "tile", "for", "the", "x", "y", "and", "zoom" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java#L151-L161
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java
BoundedOverlay.isWithinBounds
public boolean isWithinBounds(int x, int y, int zoom) { return isWithinZoom(zoom) && isWithinBoundingBox(x, y, zoom); }
java
public boolean isWithinBounds(int x, int y, int zoom) { return isWithinZoom(zoom) && isWithinBoundingBox(x, y, zoom); }
[ "public", "boolean", "isWithinBounds", "(", "int", "x", ",", "int", "y", ",", "int", "zoom", ")", "{", "return", "isWithinZoom", "(", "zoom", ")", "&&", "isWithinBoundingBox", "(", "x", ",", "y", ",", "zoom", ")", ";", "}" ]
Is the tile within the zoom and bounding box bounds @param x x coordinate @param y y coordinate @param zoom zoom value @return true if within bounds
[ "Is", "the", "tile", "within", "the", "zoom", "and", "bounding", "box", "bounds" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java#L191-L193
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java
BoundedOverlay.isWithinZoom
public boolean isWithinZoom(float zoom) { return (minZoom == null || zoom >= minZoom) && (maxZoom == null || zoom <= maxZoom); }
java
public boolean isWithinZoom(float zoom) { return (minZoom == null || zoom >= minZoom) && (maxZoom == null || zoom <= maxZoom); }
[ "public", "boolean", "isWithinZoom", "(", "float", "zoom", ")", "{", "return", "(", "minZoom", "==", "null", "||", "zoom", ">=", "minZoom", ")", "&&", "(", "maxZoom", "==", "null", "||", "zoom", "<=", "maxZoom", ")", ";", "}" ]
Check if the zoom is within the overlay zoom range @param zoom zoom value @return true if within zoom
[ "Check", "if", "the", "zoom", "is", "within", "the", "overlay", "zoom", "range" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java#L201-L203
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java
BoundedOverlay.isWithinBoundingBox
public boolean isWithinBoundingBox(int x, int y, int zoom) { boolean withinBounds = true; // If a bounding box is set, check if it overlaps with the request if (webMercatorBoundingBox != null) { // Get the bounding box of the requested tile BoundingBox tileWebMercatorBoundingBox = TileBoundingBoxUtils .getWebMercatorBoundingBox(x, y, zoom); // Adjust the bounding box if needed BoundingBox adjustedWebMercatorBoundingBox = getWebMercatorBoundingBox(tileWebMercatorBoundingBox); // Check if the request overlaps withinBounds = adjustedWebMercatorBoundingBox.intersects( tileWebMercatorBoundingBox, true); } return withinBounds; }
java
public boolean isWithinBoundingBox(int x, int y, int zoom) { boolean withinBounds = true; // If a bounding box is set, check if it overlaps with the request if (webMercatorBoundingBox != null) { // Get the bounding box of the requested tile BoundingBox tileWebMercatorBoundingBox = TileBoundingBoxUtils .getWebMercatorBoundingBox(x, y, zoom); // Adjust the bounding box if needed BoundingBox adjustedWebMercatorBoundingBox = getWebMercatorBoundingBox(tileWebMercatorBoundingBox); // Check if the request overlaps withinBounds = adjustedWebMercatorBoundingBox.intersects( tileWebMercatorBoundingBox, true); } return withinBounds; }
[ "public", "boolean", "isWithinBoundingBox", "(", "int", "x", ",", "int", "y", ",", "int", "zoom", ")", "{", "boolean", "withinBounds", "=", "true", ";", "// If a bounding box is set, check if it overlaps with the request", "if", "(", "webMercatorBoundingBox", "!=", "n...
Check if the tile request is within the desired tile bounds @param x x coordinate @param y y coordinate @param zoom zoom value @return true if within bounds
[ "Check", "if", "the", "tile", "request", "is", "within", "the", "desired", "tile", "bounds" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/BoundedOverlay.java#L213-L232
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java
FeatureOverlayQuery.isOnAtCurrentZoom
public boolean isOnAtCurrentZoom(GoogleMap map, LatLng latLng) { float zoom = MapUtils.getCurrentZoom(map); boolean on = isOnAtCurrentZoom(zoom, latLng); return on; }
java
public boolean isOnAtCurrentZoom(GoogleMap map, LatLng latLng) { float zoom = MapUtils.getCurrentZoom(map); boolean on = isOnAtCurrentZoom(zoom, latLng); return on; }
[ "public", "boolean", "isOnAtCurrentZoom", "(", "GoogleMap", "map", ",", "LatLng", "latLng", ")", "{", "float", "zoom", "=", "MapUtils", ".", "getCurrentZoom", "(", "map", ")", ";", "boolean", "on", "=", "isOnAtCurrentZoom", "(", "zoom", ",", "latLng", ")", ...
Determine if the the feature overlay is on for the current zoom level of the map at the location @param map google map @param latLng lat lon location @return true if on @since 1.2.6
[ "Determine", "if", "the", "the", "feature", "overlay", "is", "on", "for", "the", "current", "zoom", "level", "of", "the", "map", "at", "the", "location" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L173-L177
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java
FeatureOverlayQuery.isOnAtCurrentZoom
public boolean isOnAtCurrentZoom(double zoom, LatLng latLng) { Point point = new Point(latLng.longitude, latLng.latitude); TileGrid tileGrid = TileBoundingBoxUtils.getTileGridFromWGS84(point, (int) zoom); boolean on = boundedOverlay.hasTile((int) tileGrid.getMinX(), (int) tileGrid.getMinY(), (int) zoom); return on; }
java
public boolean isOnAtCurrentZoom(double zoom, LatLng latLng) { Point point = new Point(latLng.longitude, latLng.latitude); TileGrid tileGrid = TileBoundingBoxUtils.getTileGridFromWGS84(point, (int) zoom); boolean on = boundedOverlay.hasTile((int) tileGrid.getMinX(), (int) tileGrid.getMinY(), (int) zoom); return on; }
[ "public", "boolean", "isOnAtCurrentZoom", "(", "double", "zoom", ",", "LatLng", "latLng", ")", "{", "Point", "point", "=", "new", "Point", "(", "latLng", ".", "longitude", ",", "latLng", ".", "latitude", ")", ";", "TileGrid", "tileGrid", "=", "TileBoundingBo...
Determine if the feature overlay is on for the provided zoom level at the location @param zoom zoom level @param latLng lat lon location @return true if on @since 1.2.6
[ "Determine", "if", "the", "feature", "overlay", "is", "on", "for", "the", "provided", "zoom", "level", "at", "the", "location" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L187-L194
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java
FeatureOverlayQuery.buildClickBoundingBox
public BoundingBox buildClickBoundingBox(LatLng latLng, BoundingBox mapBounds) { // Get the screen width and height a click occurs from a feature double width = TileBoundingBoxMapUtils.getLongitudeDistance(mapBounds) * screenClickPercentage; double height = TileBoundingBoxMapUtils.getLatitudeDistance(mapBounds) * screenClickPercentage; LatLng leftCoordinate = SphericalUtil.computeOffset(latLng, width, 270); LatLng upCoordinate = SphericalUtil.computeOffset(latLng, height, 0); LatLng rightCoordinate = SphericalUtil.computeOffset(latLng, width, 90); LatLng downCoordinate = SphericalUtil.computeOffset(latLng, height, 180); BoundingBox boundingBox = new BoundingBox(leftCoordinate.longitude, downCoordinate.latitude, rightCoordinate.longitude, upCoordinate.latitude); return boundingBox; }
java
public BoundingBox buildClickBoundingBox(LatLng latLng, BoundingBox mapBounds) { // Get the screen width and height a click occurs from a feature double width = TileBoundingBoxMapUtils.getLongitudeDistance(mapBounds) * screenClickPercentage; double height = TileBoundingBoxMapUtils.getLatitudeDistance(mapBounds) * screenClickPercentage; LatLng leftCoordinate = SphericalUtil.computeOffset(latLng, width, 270); LatLng upCoordinate = SphericalUtil.computeOffset(latLng, height, 0); LatLng rightCoordinate = SphericalUtil.computeOffset(latLng, width, 90); LatLng downCoordinate = SphericalUtil.computeOffset(latLng, height, 180); BoundingBox boundingBox = new BoundingBox(leftCoordinate.longitude, downCoordinate.latitude, rightCoordinate.longitude, upCoordinate.latitude); return boundingBox; }
[ "public", "BoundingBox", "buildClickBoundingBox", "(", "LatLng", "latLng", ",", "BoundingBox", "mapBounds", ")", "{", "// Get the screen width and height a click occurs from a feature", "double", "width", "=", "TileBoundingBoxMapUtils", ".", "getLongitudeDistance", "(", "mapBou...
Build a bounding box using the location coordinate click location and map view bounds @param latLng click location @param mapBounds map bounds @return bounding box @since 1.2.7
[ "Build", "a", "bounding", "box", "using", "the", "location", "coordinate", "click", "location", "and", "map", "view", "bounds" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L265-L279
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java
FeatureOverlayQuery.queryFeatures
public FeatureIndexResults queryFeatures(BoundingBox boundingBox) { FeatureIndexResults results = queryFeatures(boundingBox, null); return results; }
java
public FeatureIndexResults queryFeatures(BoundingBox boundingBox) { FeatureIndexResults results = queryFeatures(boundingBox, null); return results; }
[ "public", "FeatureIndexResults", "queryFeatures", "(", "BoundingBox", "boundingBox", ")", "{", "FeatureIndexResults", "results", "=", "queryFeatures", "(", "boundingBox", ",", "null", ")", ";", "return", "results", ";", "}" ]
Query for features in the WGS84 projected bounding box @param boundingBox query bounding box in WGS84 projection @return feature index results, must be closed
[ "Query", "for", "features", "in", "the", "WGS84", "projected", "bounding", "box" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L287-L290
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java
FeatureOverlayQuery.queryFeatures
public FeatureIndexResults queryFeatures(BoundingBox boundingBox, Projection projection) { if (projection == null) { projection = ProjectionFactory.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); } // Query for features FeatureIndexManager indexManager = featureTiles.getIndexManager(); if (indexManager == null) { throw new GeoPackageException("Index Manager is not set on the Feature Tiles and is required to query indexed features"); } FeatureIndexResults results = indexManager.query(boundingBox, projection); return results; }
java
public FeatureIndexResults queryFeatures(BoundingBox boundingBox, Projection projection) { if (projection == null) { projection = ProjectionFactory.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); } // Query for features FeatureIndexManager indexManager = featureTiles.getIndexManager(); if (indexManager == null) { throw new GeoPackageException("Index Manager is not set on the Feature Tiles and is required to query indexed features"); } FeatureIndexResults results = indexManager.query(boundingBox, projection); return results; }
[ "public", "FeatureIndexResults", "queryFeatures", "(", "BoundingBox", "boundingBox", ",", "Projection", "projection", ")", "{", "if", "(", "projection", "==", "null", ")", "{", "projection", "=", "ProjectionFactory", ".", "getProjection", "(", "ProjectionConstants", ...
Query for features in the bounding box @param boundingBox query bounding box @param projection bounding box projection @return feature index results, must be closed
[ "Query", "for", "features", "in", "the", "bounding", "box" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L299-L312
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java
MapUtils.getToleranceDistance
public static double getToleranceDistance(View view, GoogleMap map) { BoundingBox boundingBox = getBoundingBox(map); double boundingBoxWidth = TileBoundingBoxMapUtils.getLongitudeDistance(boundingBox); double boundingBoxHeight = TileBoundingBoxMapUtils.getLatitudeDistance(boundingBox); int viewWidth = view.getWidth(); int viewHeight = view.getHeight(); double meters = 0; if (viewWidth > 0 && viewHeight > 0) { double widthMeters = boundingBoxWidth / viewWidth; double heightMeters = boundingBoxHeight / viewHeight; meters = Math.min(widthMeters, heightMeters); } return meters; }
java
public static double getToleranceDistance(View view, GoogleMap map) { BoundingBox boundingBox = getBoundingBox(map); double boundingBoxWidth = TileBoundingBoxMapUtils.getLongitudeDistance(boundingBox); double boundingBoxHeight = TileBoundingBoxMapUtils.getLatitudeDistance(boundingBox); int viewWidth = view.getWidth(); int viewHeight = view.getHeight(); double meters = 0; if (viewWidth > 0 && viewHeight > 0) { double widthMeters = boundingBoxWidth / viewWidth; double heightMeters = boundingBoxHeight / viewHeight; meters = Math.min(widthMeters, heightMeters); } return meters; }
[ "public", "static", "double", "getToleranceDistance", "(", "View", "view", ",", "GoogleMap", "map", ")", "{", "BoundingBox", "boundingBox", "=", "getBoundingBox", "(", "map", ")", ";", "double", "boundingBoxWidth", "=", "TileBoundingBoxMapUtils", ".", "getLongitudeD...
Get the tolerance distance meters in the current region of the map @param view view @param map google map @return tolerance distance in meters
[ "Get", "the", "tolerance", "distance", "meters", "in", "the", "current", "region", "of", "the", "map" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L51-L72
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java
MapUtils.getBoundingBox
public static BoundingBox getBoundingBox(GoogleMap map) { LatLngBounds visibleBounds = map.getProjection() .getVisibleRegion().latLngBounds; LatLng southwest = visibleBounds.southwest; LatLng northeast = visibleBounds.northeast; double minLatitude = southwest.latitude; double maxLatitude = northeast.latitude; double minLongitude = southwest.longitude; double maxLongitude = northeast.longitude; if (maxLongitude < minLongitude) { maxLongitude += (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH); } BoundingBox boundingBox = new BoundingBox(minLongitude, minLatitude, maxLongitude, maxLatitude); return boundingBox; }
java
public static BoundingBox getBoundingBox(GoogleMap map) { LatLngBounds visibleBounds = map.getProjection() .getVisibleRegion().latLngBounds; LatLng southwest = visibleBounds.southwest; LatLng northeast = visibleBounds.northeast; double minLatitude = southwest.latitude; double maxLatitude = northeast.latitude; double minLongitude = southwest.longitude; double maxLongitude = northeast.longitude; if (maxLongitude < minLongitude) { maxLongitude += (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH); } BoundingBox boundingBox = new BoundingBox(minLongitude, minLatitude, maxLongitude, maxLatitude); return boundingBox; }
[ "public", "static", "BoundingBox", "getBoundingBox", "(", "GoogleMap", "map", ")", "{", "LatLngBounds", "visibleBounds", "=", "map", ".", "getProjection", "(", ")", ".", "getVisibleRegion", "(", ")", ".", "latLngBounds", ";", "LatLng", "southwest", "=", "visible...
Get the WGS84 bounding box of the current map view screen. The max longitude will be larger than the min resulting in values larger than 180.0. @param map google map @return current bounding box
[ "Get", "the", "WGS84", "bounding", "box", "of", "the", "current", "map", "view", "screen", ".", "The", "max", "longitude", "will", "be", "larger", "than", "the", "min", "resulting", "in", "values", "larger", "than", "180", ".", "0", "." ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L81-L100
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java
MapUtils.buildClickBoundingBox
public static BoundingBox buildClickBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) { LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox(latLng, view, map, screenClickPercentage); // Create the bounding box to query for features BoundingBox boundingBox = new BoundingBox( latLngBoundingBox.getLeftCoordinate().longitude, latLngBoundingBox.getDownCoordinate().latitude, latLngBoundingBox.getRightCoordinate().longitude, latLngBoundingBox.getUpCoordinate().latitude); return boundingBox; }
java
public static BoundingBox buildClickBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) { LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox(latLng, view, map, screenClickPercentage); // Create the bounding box to query for features BoundingBox boundingBox = new BoundingBox( latLngBoundingBox.getLeftCoordinate().longitude, latLngBoundingBox.getDownCoordinate().latitude, latLngBoundingBox.getRightCoordinate().longitude, latLngBoundingBox.getUpCoordinate().latitude); return boundingBox; }
[ "public", "static", "BoundingBox", "buildClickBoundingBox", "(", "LatLng", "latLng", ",", "View", "view", ",", "GoogleMap", "map", ",", "float", "screenClickPercentage", ")", "{", "LatLngBoundingBox", "latLngBoundingBox", "=", "buildClickLatLngBoundingBox", "(", "latLng...
Build a bounding box using the click location, map view, map, and screen percentage tolerance. The bounding box can be used to query for features that were clicked @param latLng click location @param view view @param map Google map @param screenClickPercentage screen click percentage between 0.0 and 1.0 for how close a feature on the screen must be to be included in a click query @return bounding box
[ "Build", "a", "bounding", "box", "using", "the", "click", "location", "map", "view", "map", "and", "screen", "percentage", "tolerance", ".", "The", "bounding", "box", "can", "be", "used", "to", "query", "for", "features", "that", "were", "clicked" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L113-L125
train
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java
MapUtils.buildClickLatLngBounds
public static LatLngBounds buildClickLatLngBounds(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) { LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox(latLng, view, map, screenClickPercentage); double southWestLongitude = Math.min(latLngBoundingBox.getLeftCoordinate().longitude, latLngBoundingBox.getDownCoordinate().longitude); LatLng southWest = new LatLng(latLngBoundingBox.getDownCoordinate().latitude, latLngBoundingBox.getLeftCoordinate().longitude); LatLng northEast = new LatLng(latLngBoundingBox.getUpCoordinate().latitude, latLngBoundingBox.getRightCoordinate().longitude); LatLngBounds latLngBounds = new LatLngBounds(southWest, northEast); return latLngBounds; }
java
public static LatLngBounds buildClickLatLngBounds(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) { LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox(latLng, view, map, screenClickPercentage); double southWestLongitude = Math.min(latLngBoundingBox.getLeftCoordinate().longitude, latLngBoundingBox.getDownCoordinate().longitude); LatLng southWest = new LatLng(latLngBoundingBox.getDownCoordinate().latitude, latLngBoundingBox.getLeftCoordinate().longitude); LatLng northEast = new LatLng(latLngBoundingBox.getUpCoordinate().latitude, latLngBoundingBox.getRightCoordinate().longitude); LatLngBounds latLngBounds = new LatLngBounds(southWest, northEast); return latLngBounds; }
[ "public", "static", "LatLngBounds", "buildClickLatLngBounds", "(", "LatLng", "latLng", ",", "View", "view", ",", "GoogleMap", "map", ",", "float", "screenClickPercentage", ")", "{", "LatLngBoundingBox", "latLngBoundingBox", "=", "buildClickLatLngBoundingBox", "(", "latL...
Build a lat lng bounds using the click location, map view, map, and screen percentage tolerance. The bounding box can be used to query for features that were clicked @param latLng click location @param view view @param map Google map @param screenClickPercentage screen click percentage between 0.0 and 1.0 for how close a feature on the screen must be to be included in a click query @return bounding box
[ "Build", "a", "lat", "lng", "bounds", "using", "the", "click", "location", "map", "view", "map", "and", "screen", "percentage", "tolerance", ".", "The", "bounding", "box", "can", "be", "used", "to", "query", "for", "features", "that", "were", "clicked" ]
634d78468a5c52d2bc98791cc7ff03981ebf573b
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L138-L150
train