id
int32 0
165k
| 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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
147,200
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java
|
LineSegment.intersects
|
public boolean intersects(LineSegment lineSegment) {
double x1 = this.x1();
double y1 = this.y1();
double x2 = this.x2();
double y2 = this.y2();
double x3 = lineSegment.x1();
double y3 = lineSegment.y1();
double x4 = lineSegment.x2();
double y4 = lineSegment.y2();
double denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
if (denom == 0) {
return false;
}
double u1 = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom;
double u2 = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom;
return (u1 > 0 && u1 < 1 && u2 > 0 && u2 < 1);
}
|
java
|
public boolean intersects(LineSegment lineSegment) {
double x1 = this.x1();
double y1 = this.y1();
double x2 = this.x2();
double y2 = this.y2();
double x3 = lineSegment.x1();
double y3 = lineSegment.y1();
double x4 = lineSegment.x2();
double y4 = lineSegment.y2();
double denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
if (denom == 0) {
return false;
}
double u1 = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom;
double u2 = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom;
return (u1 > 0 && u1 < 1 && u2 > 0 && u2 < 1);
}
|
[
"public",
"boolean",
"intersects",
"(",
"LineSegment",
"lineSegment",
")",
"{",
"double",
"x1",
"=",
"this",
".",
"x1",
"(",
")",
";",
"double",
"y1",
"=",
"this",
".",
"y1",
"(",
")",
";",
"double",
"x2",
"=",
"this",
".",
"x2",
"(",
")",
";",
"double",
"y2",
"=",
"this",
".",
"y2",
"(",
")",
";",
"double",
"x3",
"=",
"lineSegment",
".",
"x1",
"(",
")",
";",
"double",
"y3",
"=",
"lineSegment",
".",
"y1",
"(",
")",
";",
"double",
"x4",
"=",
"lineSegment",
".",
"x2",
"(",
")",
";",
"double",
"y4",
"=",
"lineSegment",
".",
"y2",
"(",
")",
";",
"double",
"denom",
"=",
"(",
"y4",
"-",
"y3",
")",
"*",
"(",
"x2",
"-",
"x1",
")",
"-",
"(",
"x4",
"-",
"x3",
")",
"*",
"(",
"y2",
"-",
"y1",
")",
";",
"if",
"(",
"denom",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"double",
"u1",
"=",
"(",
"(",
"x4",
"-",
"x3",
")",
"*",
"(",
"y1",
"-",
"y3",
")",
"-",
"(",
"y4",
"-",
"y3",
")",
"*",
"(",
"x1",
"-",
"x3",
")",
")",
"/",
"denom",
";",
"double",
"u2",
"=",
"(",
"(",
"x2",
"-",
"x1",
")",
"*",
"(",
"y1",
"-",
"y3",
")",
"-",
"(",
"y2",
"-",
"y1",
")",
"*",
"(",
"x1",
"-",
"x3",
")",
")",
"/",
"denom",
";",
"return",
"(",
"u1",
">",
"0",
"&&",
"u1",
"<",
"1",
"&&",
"u2",
">",
"0",
"&&",
"u2",
"<",
"1",
")",
";",
"}"
] |
Does this linesegment intersect with another or not?
@param lineSegment
The other linesegment.
@return Returns true if they intersect in 1 point, false otherwise.
|
[
"Does",
"this",
"linesegment",
"intersect",
"with",
"another",
"or",
"not?"
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java#L90-L107
|
147,201
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java
|
LineSegment.getIntersectionSegments
|
public Coordinate getIntersectionSegments(LineSegment lineSegment) {
// http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/
double x1 = this.x1();
double y1 = this.y1();
double x2 = this.x2();
double y2 = this.y2();
double x3 = lineSegment.x1();
double y3 = lineSegment.y1();
double x4 = lineSegment.x2();
double y4 = lineSegment.y2();
double denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
if (denom == 0) {
return null;
}
double u1 = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom;
if (u1 <= 0 || u1 >= 1) {
return null;
}
double u2 = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom;
if (u2 <= 0 || u2 >= 1) {
return null;
}
double x = x1 + u1 * (x2 - x1);
double y = y1 + u1 * (y2 - y1);
return new Coordinate(x, y);
}
|
java
|
public Coordinate getIntersectionSegments(LineSegment lineSegment) {
// http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/
double x1 = this.x1();
double y1 = this.y1();
double x2 = this.x2();
double y2 = this.y2();
double x3 = lineSegment.x1();
double y3 = lineSegment.y1();
double x4 = lineSegment.x2();
double y4 = lineSegment.y2();
double denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
if (denom == 0) {
return null;
}
double u1 = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom;
if (u1 <= 0 || u1 >= 1) {
return null;
}
double u2 = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom;
if (u2 <= 0 || u2 >= 1) {
return null;
}
double x = x1 + u1 * (x2 - x1);
double y = y1 + u1 * (y2 - y1);
return new Coordinate(x, y);
}
|
[
"public",
"Coordinate",
"getIntersectionSegments",
"(",
"LineSegment",
"lineSegment",
")",
"{",
"// http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/",
"double",
"x1",
"=",
"this",
".",
"x1",
"(",
")",
";",
"double",
"y1",
"=",
"this",
".",
"y1",
"(",
")",
";",
"double",
"x2",
"=",
"this",
".",
"x2",
"(",
")",
";",
"double",
"y2",
"=",
"this",
".",
"y2",
"(",
")",
";",
"double",
"x3",
"=",
"lineSegment",
".",
"x1",
"(",
")",
";",
"double",
"y3",
"=",
"lineSegment",
".",
"y1",
"(",
")",
";",
"double",
"x4",
"=",
"lineSegment",
".",
"x2",
"(",
")",
";",
"double",
"y4",
"=",
"lineSegment",
".",
"y2",
"(",
")",
";",
"double",
"denom",
"=",
"(",
"y4",
"-",
"y3",
")",
"*",
"(",
"x2",
"-",
"x1",
")",
"-",
"(",
"x4",
"-",
"x3",
")",
"*",
"(",
"y2",
"-",
"y1",
")",
";",
"if",
"(",
"denom",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"double",
"u1",
"=",
"(",
"(",
"x4",
"-",
"x3",
")",
"*",
"(",
"y1",
"-",
"y3",
")",
"-",
"(",
"y4",
"-",
"y3",
")",
"*",
"(",
"x1",
"-",
"x3",
")",
")",
"/",
"denom",
";",
"if",
"(",
"u1",
"<=",
"0",
"||",
"u1",
">=",
"1",
")",
"{",
"return",
"null",
";",
"}",
"double",
"u2",
"=",
"(",
"(",
"x2",
"-",
"x1",
")",
"*",
"(",
"y1",
"-",
"y3",
")",
"-",
"(",
"y2",
"-",
"y1",
")",
"*",
"(",
"x1",
"-",
"x3",
")",
")",
"/",
"denom",
";",
"if",
"(",
"u2",
"<=",
"0",
"||",
"u2",
">=",
"1",
")",
"{",
"return",
"null",
";",
"}",
"double",
"x",
"=",
"x1",
"+",
"u1",
"*",
"(",
"x2",
"-",
"x1",
")",
";",
"double",
"y",
"=",
"y1",
"+",
"u1",
"*",
"(",
"y2",
"-",
"y1",
")",
";",
"return",
"new",
"Coordinate",
"(",
"x",
",",
"y",
")",
";",
"}"
] |
Return the intersection point of 2 line segments if they intersect in 1 point.
@param lineSegment
The other LineSegment.
@return A {@link Coordinate} representing the intersection point (so on both line segments), null if segments are
not intersecting or corresponding lines are coinciding.
|
[
"Return",
"the",
"intersection",
"point",
"of",
"2",
"line",
"segments",
"if",
"they",
"intersect",
"in",
"1",
"point",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java#L145-L172
|
147,202
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java
|
LineSegment.nearest
|
public Coordinate nearest(Coordinate c) {
double len = this.getLength();
double u = (c.getX() - this.c1.getX()) * (this.c2.getX() - this.c1.getX()) + (c.getY() - this.c1.getY())
* (this.c2.getY() - this.c1.getY());
u = u / (len * len);
if (u < 0.00001 || u > 1) {
// Shortest point not within LineSegment, so take closest end-point.
LineSegment ls1 = new LineSegment(c, this.c1);
LineSegment ls2 = new LineSegment(c, this.c2);
double len1 = ls1.getLength();
double len2 = ls2.getLength();
if (len1 < len2) {
return this.c1;
}
return this.c2;
} else {
// Intersecting point is on the line, use the formula: P = P1 + u (P2 - P1)
double x1 = this.c1.getX() + u * (this.c2.getX() - this.c1.getX());
double y1 = this.c1.getY() + u * (this.c2.getY() - this.c1.getY());
return new Coordinate(x1, y1);
}
}
|
java
|
public Coordinate nearest(Coordinate c) {
double len = this.getLength();
double u = (c.getX() - this.c1.getX()) * (this.c2.getX() - this.c1.getX()) + (c.getY() - this.c1.getY())
* (this.c2.getY() - this.c1.getY());
u = u / (len * len);
if (u < 0.00001 || u > 1) {
// Shortest point not within LineSegment, so take closest end-point.
LineSegment ls1 = new LineSegment(c, this.c1);
LineSegment ls2 = new LineSegment(c, this.c2);
double len1 = ls1.getLength();
double len2 = ls2.getLength();
if (len1 < len2) {
return this.c1;
}
return this.c2;
} else {
// Intersecting point is on the line, use the formula: P = P1 + u (P2 - P1)
double x1 = this.c1.getX() + u * (this.c2.getX() - this.c1.getX());
double y1 = this.c1.getY() + u * (this.c2.getY() - this.c1.getY());
return new Coordinate(x1, y1);
}
}
|
[
"public",
"Coordinate",
"nearest",
"(",
"Coordinate",
"c",
")",
"{",
"double",
"len",
"=",
"this",
".",
"getLength",
"(",
")",
";",
"double",
"u",
"=",
"(",
"c",
".",
"getX",
"(",
")",
"-",
"this",
".",
"c1",
".",
"getX",
"(",
")",
")",
"*",
"(",
"this",
".",
"c2",
".",
"getX",
"(",
")",
"-",
"this",
".",
"c1",
".",
"getX",
"(",
")",
")",
"+",
"(",
"c",
".",
"getY",
"(",
")",
"-",
"this",
".",
"c1",
".",
"getY",
"(",
")",
")",
"*",
"(",
"this",
".",
"c2",
".",
"getY",
"(",
")",
"-",
"this",
".",
"c1",
".",
"getY",
"(",
")",
")",
";",
"u",
"=",
"u",
"/",
"(",
"len",
"*",
"len",
")",
";",
"if",
"(",
"u",
"<",
"0.00001",
"||",
"u",
">",
"1",
")",
"{",
"// Shortest point not within LineSegment, so take closest end-point.",
"LineSegment",
"ls1",
"=",
"new",
"LineSegment",
"(",
"c",
",",
"this",
".",
"c1",
")",
";",
"LineSegment",
"ls2",
"=",
"new",
"LineSegment",
"(",
"c",
",",
"this",
".",
"c2",
")",
";",
"double",
"len1",
"=",
"ls1",
".",
"getLength",
"(",
")",
";",
"double",
"len2",
"=",
"ls2",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"len1",
"<",
"len2",
")",
"{",
"return",
"this",
".",
"c1",
";",
"}",
"return",
"this",
".",
"c2",
";",
"}",
"else",
"{",
"// Intersecting point is on the line, use the formula: P = P1 + u (P2 - P1)",
"double",
"x1",
"=",
"this",
".",
"c1",
".",
"getX",
"(",
")",
"+",
"u",
"*",
"(",
"this",
".",
"c2",
".",
"getX",
"(",
")",
"-",
"this",
".",
"c1",
".",
"getX",
"(",
")",
")",
";",
"double",
"y1",
"=",
"this",
".",
"c1",
".",
"getY",
"(",
")",
"+",
"u",
"*",
"(",
"this",
".",
"c2",
".",
"getY",
"(",
")",
"-",
"this",
".",
"c1",
".",
"getY",
"(",
")",
")",
";",
"return",
"new",
"Coordinate",
"(",
"x1",
",",
"y1",
")",
";",
"}",
"}"
] |
Calculate which point on the LineSegment is nearest to the given coordinate. Will be perpendicular or one of the
end-points.
@param c
The coordinate to check.
@return The point on the LineSegment nearest to the given coordinate.
|
[
"Calculate",
"which",
"point",
"on",
"the",
"LineSegment",
"is",
"nearest",
"to",
"the",
"given",
"coordinate",
".",
"Will",
"be",
"perpendicular",
"or",
"one",
"of",
"the",
"end",
"-",
"points",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java#L182-L205
|
147,203
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java
|
SvgGraphicsContext.unhide
|
public void unhide(Object group) {
if (isAttached()) {
Element element = helper.getGroup(group);
if (element != null) {
Dom.setElementAttribute(element, "display", "inline");
}
}
}
|
java
|
public void unhide(Object group) {
if (isAttached()) {
Element element = helper.getGroup(group);
if (element != null) {
Dom.setElementAttribute(element, "display", "inline");
}
}
}
|
[
"public",
"void",
"unhide",
"(",
"Object",
"group",
")",
"{",
"if",
"(",
"isAttached",
"(",
")",
")",
"{",
"Element",
"element",
"=",
"helper",
".",
"getGroup",
"(",
"group",
")",
";",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"Dom",
".",
"setElementAttribute",
"(",
"element",
",",
"\"display\"",
",",
"\"inline\"",
")",
";",
"}",
"}",
"}"
] |
Show the specified group. If the group does not exist, nothing will happen.
@param group
The group object.
|
[
"Show",
"the",
"specified",
"group",
".",
"If",
"the",
"group",
"does",
"not",
"exist",
"nothing",
"will",
"happen",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L745-L752
|
147,204
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/search/SearchEvent.java
|
SearchEvent.isSingleResult
|
public boolean isSingleResult() {
if (result == null) {
return false;
} else {
if (singleResult == null) {
if (result.size() == 1 && result.values().iterator().next().size() == 1) {
singleResult = true;
} else {
singleResult = false;
}
}
return singleResult;
}
}
|
java
|
public boolean isSingleResult() {
if (result == null) {
return false;
} else {
if (singleResult == null) {
if (result.size() == 1 && result.values().iterator().next().size() == 1) {
singleResult = true;
} else {
singleResult = false;
}
}
return singleResult;
}
}
|
[
"public",
"boolean",
"isSingleResult",
"(",
")",
"{",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"singleResult",
"==",
"null",
")",
"{",
"if",
"(",
"result",
".",
"size",
"(",
")",
"==",
"1",
"&&",
"result",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"singleResult",
"=",
"true",
";",
"}",
"else",
"{",
"singleResult",
"=",
"false",
";",
"}",
"}",
"return",
"singleResult",
";",
"}",
"}"
] |
Returns true if the search resulted in a single result in a single layer.
false in all other cases. Also returns false when search has not yet been
run.
@return
|
[
"Returns",
"true",
"if",
"the",
"search",
"resulted",
"in",
"a",
"single",
"result",
"in",
"a",
"single",
"layer",
".",
"false",
"in",
"all",
"other",
"cases",
".",
"Also",
"returns",
"false",
"when",
"search",
"has",
"not",
"yet",
"been",
"run",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/search/SearchEvent.java#L54-L67
|
147,205
|
seedstack/i18n-addon
|
rest/src/main/java/org/seedstack/i18n/rest/internal/locale/DefaultLanguageResource.java
|
DefaultLanguageResource.changeDefaultLocale
|
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.LOCALE_WRITE)
public Response changeDefaultLocale(LocaleRepresentation representation) throws URISyntaxException {
WebAssertions.assertNotNull(representation, "The locale should not be null");
WebAssertions.assertNotBlank(representation.getCode(), "The locale code should not be blank");
try {
localeService.changeDefaultLocaleTo(representation.getCode());
} catch (Exception e) {
logger.error(e.getMessage(), e);
return Response.status(Response.Status.NOT_FOUND).build();
}
return Response.ok(new URI(uriInfo.getRequestUri().toString()))
.entity(localeFinder.findDefaultLocale()).build();
}
|
java
|
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.LOCALE_WRITE)
public Response changeDefaultLocale(LocaleRepresentation representation) throws URISyntaxException {
WebAssertions.assertNotNull(representation, "The locale should not be null");
WebAssertions.assertNotBlank(representation.getCode(), "The locale code should not be blank");
try {
localeService.changeDefaultLocaleTo(representation.getCode());
} catch (Exception e) {
logger.error(e.getMessage(), e);
return Response.status(Response.Status.NOT_FOUND).build();
}
return Response.ok(new URI(uriInfo.getRequestUri().toString()))
.entity(localeFinder.findDefaultLocale()).build();
}
|
[
"@",
"PUT",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"RequiresPermissions",
"(",
"I18nPermissions",
".",
"LOCALE_WRITE",
")",
"public",
"Response",
"changeDefaultLocale",
"(",
"LocaleRepresentation",
"representation",
")",
"throws",
"URISyntaxException",
"{",
"WebAssertions",
".",
"assertNotNull",
"(",
"representation",
",",
"\"The locale should not be null\"",
")",
";",
"WebAssertions",
".",
"assertNotBlank",
"(",
"representation",
".",
"getCode",
"(",
")",
",",
"\"The locale code should not be blank\"",
")",
";",
"try",
"{",
"localeService",
".",
"changeDefaultLocaleTo",
"(",
"representation",
".",
"getCode",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"return",
"Response",
".",
"status",
"(",
"Response",
".",
"Status",
".",
"NOT_FOUND",
")",
".",
"build",
"(",
")",
";",
"}",
"return",
"Response",
".",
"ok",
"(",
"new",
"URI",
"(",
"uriInfo",
".",
"getRequestUri",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
".",
"entity",
"(",
"localeFinder",
".",
"findDefaultLocale",
"(",
")",
")",
".",
"build",
"(",
")",
";",
"}"
] |
Changes the default locale
@param representation locale representation
@return result
@throws java.net.URISyntaxException if URI is not valid
|
[
"Changes",
"the",
"default",
"locale"
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/locale/DefaultLanguageResource.java#L74-L90
|
147,206
|
geomajas/geomajas-project-client-gwt
|
plugin/editing/editing-gwt/src/main/java/org/geomajas/plugin/editing/gwt/client/handler/BaseDragLineHandler.java
|
BaseDragLineHandler.register
|
public void register() {
registrations.add(editService.addGeometryEditMoveHandler(this));
registrations.add(editService.addGeometryEditShapeChangedHandler(this));
registrations.add(editService.addGeometryEditTentativeMoveHandler(this));
registrations.add(editService.addGeometryEditChangeStateHandler(this));
}
|
java
|
public void register() {
registrations.add(editService.addGeometryEditMoveHandler(this));
registrations.add(editService.addGeometryEditShapeChangedHandler(this));
registrations.add(editService.addGeometryEditTentativeMoveHandler(this));
registrations.add(editService.addGeometryEditChangeStateHandler(this));
}
|
[
"public",
"void",
"register",
"(",
")",
"{",
"registrations",
".",
"add",
"(",
"editService",
".",
"addGeometryEditMoveHandler",
"(",
"this",
")",
")",
";",
"registrations",
".",
"add",
"(",
"editService",
".",
"addGeometryEditShapeChangedHandler",
"(",
"this",
")",
")",
";",
"registrations",
".",
"add",
"(",
"editService",
".",
"addGeometryEditTentativeMoveHandler",
"(",
"this",
")",
")",
";",
"registrations",
".",
"add",
"(",
"editService",
".",
"addGeometryEditChangeStateHandler",
"(",
"this",
")",
")",
";",
"}"
] |
Register handlers. Activates this handler.
|
[
"Register",
"handlers",
".",
"Activates",
"this",
"handler",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/editing/editing-gwt/src/main/java/org/geomajas/plugin/editing/gwt/client/handler/BaseDragLineHandler.java#L54-L59
|
147,207
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/action/toolbar/MultiLayerFeatureInfoListener.java
|
MultiLayerFeatureInfoListener.toBbox
|
private org.geomajas.geometry.Bbox toBbox(Bbox bounds) {
return new org.geomajas.geometry.Bbox(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());
}
|
java
|
private org.geomajas.geometry.Bbox toBbox(Bbox bounds) {
return new org.geomajas.geometry.Bbox(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());
}
|
[
"private",
"org",
".",
"geomajas",
".",
"geometry",
".",
"Bbox",
"toBbox",
"(",
"Bbox",
"bounds",
")",
"{",
"return",
"new",
"org",
".",
"geomajas",
".",
"geometry",
".",
"Bbox",
"(",
"bounds",
".",
"getX",
"(",
")",
",",
"bounds",
".",
"getY",
"(",
")",
",",
"bounds",
".",
"getWidth",
"(",
")",
",",
"bounds",
".",
"getHeight",
"(",
")",
")",
";",
"}"
] |
Convert to Bbox DTO.
@param bounds bounds
@return DTO
|
[
"Convert",
"to",
"Bbox",
"DTO",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/action/toolbar/MultiLayerFeatureInfoListener.java#L240-L242
|
147,208
|
geomajas/geomajas-project-client-gwt
|
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/service/ClientConfigurationService.java
|
ClientConfigurationService.addCallback
|
private static boolean addCallback(String applicationId, DelayedCallback callback) {
boolean isFirst = false;
List<DelayedCallback> list = BACKLOG.get(applicationId);
if (null == list) {
list = new ArrayList<DelayedCallback>();
BACKLOG.put(applicationId, list);
isFirst = true;
}
list.add(callback);
return isFirst;
}
|
java
|
private static boolean addCallback(String applicationId, DelayedCallback callback) {
boolean isFirst = false;
List<DelayedCallback> list = BACKLOG.get(applicationId);
if (null == list) {
list = new ArrayList<DelayedCallback>();
BACKLOG.put(applicationId, list);
isFirst = true;
}
list.add(callback);
return isFirst;
}
|
[
"private",
"static",
"boolean",
"addCallback",
"(",
"String",
"applicationId",
",",
"DelayedCallback",
"callback",
")",
"{",
"boolean",
"isFirst",
"=",
"false",
";",
"List",
"<",
"DelayedCallback",
">",
"list",
"=",
"BACKLOG",
".",
"get",
"(",
"applicationId",
")",
";",
"if",
"(",
"null",
"==",
"list",
")",
"{",
"list",
"=",
"new",
"ArrayList",
"<",
"DelayedCallback",
">",
"(",
")",
";",
"BACKLOG",
".",
"put",
"(",
"applicationId",
",",
"list",
")",
";",
"isFirst",
"=",
"true",
";",
"}",
"list",
".",
"add",
"(",
"callback",
")",
";",
"return",
"isFirst",
";",
"}"
] |
Add a delayed callback for the given application id. Returns whether this is the first request for the
application id.
@param applicationId application id
@param callback callback
@return true when first request for that application id
|
[
"Add",
"a",
"delayed",
"callback",
"for",
"the",
"given",
"application",
"id",
".",
"Returns",
"whether",
"this",
"is",
"the",
"first",
"request",
"for",
"the",
"application",
"id",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/service/ClientConfigurationService.java#L107-L117
|
147,209
|
geomajas/geomajas-project-client-gwt
|
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/service/ClientConfigurationService.java
|
ClientConfigurationService.getMapWidgetInfo
|
public static void getMapWidgetInfo(final String applicationId, final String mapId, final String name,
final WidgetConfigurationCallback callback) {
if (!CONFIG.containsKey(applicationId)) {
if (addCallback(applicationId, new DelayedCallback(mapId, name, callback))) {
configurationLoader.loadClientApplicationInfo(applicationId, SETTER);
}
} else {
execute(applicationId, mapId, name, callback);
}
}
|
java
|
public static void getMapWidgetInfo(final String applicationId, final String mapId, final String name,
final WidgetConfigurationCallback callback) {
if (!CONFIG.containsKey(applicationId)) {
if (addCallback(applicationId, new DelayedCallback(mapId, name, callback))) {
configurationLoader.loadClientApplicationInfo(applicationId, SETTER);
}
} else {
execute(applicationId, mapId, name, callback);
}
}
|
[
"public",
"static",
"void",
"getMapWidgetInfo",
"(",
"final",
"String",
"applicationId",
",",
"final",
"String",
"mapId",
",",
"final",
"String",
"name",
",",
"final",
"WidgetConfigurationCallback",
"callback",
")",
"{",
"if",
"(",
"!",
"CONFIG",
".",
"containsKey",
"(",
"applicationId",
")",
")",
"{",
"if",
"(",
"addCallback",
"(",
"applicationId",
",",
"new",
"DelayedCallback",
"(",
"mapId",
",",
"name",
",",
"callback",
")",
")",
")",
"{",
"configurationLoader",
".",
"loadClientApplicationInfo",
"(",
"applicationId",
",",
"SETTER",
")",
";",
"}",
"}",
"else",
"{",
"execute",
"(",
"applicationId",
",",
"mapId",
",",
"name",
",",
"callback",
")",
";",
"}",
"}"
] |
Get the configuration for a specific widget. This method will search within the context of a specific map. This
means that it will find maps, tool-bars and layer trees as well as the widget configurations within a map.
@param applicationId
The application name wherein to search for the widget configuration.
@param mapId
The map wherein to search for the widget configuration.
@param name
The actual widget configuration bean name (can also be a layer tree or a tool-bar).
@param callback
The call-back that is executed when the requested widget configuration is found. This is called
asynchronously. If the widget configuration is not found, null is passed as value!
|
[
"Get",
"the",
"configuration",
"for",
"a",
"specific",
"widget",
".",
"This",
"method",
"will",
"search",
"within",
"the",
"context",
"of",
"a",
"specific",
"map",
".",
"This",
"means",
"that",
"it",
"will",
"find",
"maps",
"tool",
"-",
"bars",
"and",
"layer",
"trees",
"as",
"well",
"as",
"the",
"widget",
"configurations",
"within",
"a",
"map",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/service/ClientConfigurationService.java#L134-L143
|
147,210
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/feature/FeatureTransaction.java
|
FeatureTransaction.execute
|
public void execute(FeatureOperation op) {
if (newFeatures != null && newFeatures.length > 0) {
operationQueue.add(op);
for (Feature newFeature : newFeatures) {
op.execute(newFeature);
}
}
}
|
java
|
public void execute(FeatureOperation op) {
if (newFeatures != null && newFeatures.length > 0) {
operationQueue.add(op);
for (Feature newFeature : newFeatures) {
op.execute(newFeature);
}
}
}
|
[
"public",
"void",
"execute",
"(",
"FeatureOperation",
"op",
")",
"{",
"if",
"(",
"newFeatures",
"!=",
"null",
"&&",
"newFeatures",
".",
"length",
">",
"0",
")",
"{",
"operationQueue",
".",
"add",
"(",
"op",
")",
";",
"for",
"(",
"Feature",
"newFeature",
":",
"newFeatures",
")",
"{",
"op",
".",
"execute",
"(",
"newFeature",
")",
";",
"}",
"}",
"}"
] |
Execute an operation on each of the features from the "newFeature" array. Also store the operation on a queue, so
it is possible to undo all the changes afterwards.
@param op
The operation to apply on each feature.
|
[
"Execute",
"an",
"operation",
"on",
"each",
"of",
"the",
"features",
"from",
"the",
"newFeature",
"array",
".",
"Also",
"store",
"the",
"operation",
"on",
"a",
"queue",
"so",
"it",
"is",
"possible",
"to",
"undo",
"all",
"the",
"changes",
"afterwards",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/feature/FeatureTransaction.java#L88-L95
|
147,211
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/feature/FeatureTransaction.java
|
FeatureTransaction.toDto
|
public org.geomajas.layer.feature.FeatureTransaction toDto() {
org.geomajas.layer.feature.FeatureTransaction dto = new org.geomajas.layer.feature.FeatureTransaction();
dto.setLayerId(layer.getServerLayerId());
if (oldFeatures != null) {
org.geomajas.layer.feature.Feature[] oldDto = new org.geomajas.layer.feature.Feature[oldFeatures.length];
for (int i = 0; i < oldFeatures.length; i++) {
oldDto[i] = oldFeatures[i].toDto();
}
dto.setOldFeatures(oldDto);
}
if (newFeatures != null) {
org.geomajas.layer.feature.Feature[] newDto = new org.geomajas.layer.feature.Feature[newFeatures.length];
for (int i = 0; i < newFeatures.length; i++) {
newDto[i] = newFeatures[i].toDto();
}
dto.setNewFeatures(newDto);
}
return dto;
}
|
java
|
public org.geomajas.layer.feature.FeatureTransaction toDto() {
org.geomajas.layer.feature.FeatureTransaction dto = new org.geomajas.layer.feature.FeatureTransaction();
dto.setLayerId(layer.getServerLayerId());
if (oldFeatures != null) {
org.geomajas.layer.feature.Feature[] oldDto = new org.geomajas.layer.feature.Feature[oldFeatures.length];
for (int i = 0; i < oldFeatures.length; i++) {
oldDto[i] = oldFeatures[i].toDto();
}
dto.setOldFeatures(oldDto);
}
if (newFeatures != null) {
org.geomajas.layer.feature.Feature[] newDto = new org.geomajas.layer.feature.Feature[newFeatures.length];
for (int i = 0; i < newFeatures.length; i++) {
newDto[i] = newFeatures[i].toDto();
}
dto.setNewFeatures(newDto);
}
return dto;
}
|
[
"public",
"org",
".",
"geomajas",
".",
"layer",
".",
"feature",
".",
"FeatureTransaction",
"toDto",
"(",
")",
"{",
"org",
".",
"geomajas",
".",
"layer",
".",
"feature",
".",
"FeatureTransaction",
"dto",
"=",
"new",
"org",
".",
"geomajas",
".",
"layer",
".",
"feature",
".",
"FeatureTransaction",
"(",
")",
";",
"dto",
".",
"setLayerId",
"(",
"layer",
".",
"getServerLayerId",
"(",
")",
")",
";",
"if",
"(",
"oldFeatures",
"!=",
"null",
")",
"{",
"org",
".",
"geomajas",
".",
"layer",
".",
"feature",
".",
"Feature",
"[",
"]",
"oldDto",
"=",
"new",
"org",
".",
"geomajas",
".",
"layer",
".",
"feature",
".",
"Feature",
"[",
"oldFeatures",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"oldFeatures",
".",
"length",
";",
"i",
"++",
")",
"{",
"oldDto",
"[",
"i",
"]",
"=",
"oldFeatures",
"[",
"i",
"]",
".",
"toDto",
"(",
")",
";",
"}",
"dto",
".",
"setOldFeatures",
"(",
"oldDto",
")",
";",
"}",
"if",
"(",
"newFeatures",
"!=",
"null",
")",
"{",
"org",
".",
"geomajas",
".",
"layer",
".",
"feature",
".",
"Feature",
"[",
"]",
"newDto",
"=",
"new",
"org",
".",
"geomajas",
".",
"layer",
".",
"feature",
".",
"Feature",
"[",
"newFeatures",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"newFeatures",
".",
"length",
";",
"i",
"++",
")",
"{",
"newDto",
"[",
"i",
"]",
"=",
"newFeatures",
"[",
"i",
"]",
".",
"toDto",
"(",
")",
";",
"}",
"dto",
".",
"setNewFeatures",
"(",
"newDto",
")",
";",
"}",
"return",
"dto",
";",
"}"
] |
Transform this object into a DTO feature transaction.
@return feature transaction DTO
|
[
"Transform",
"this",
"object",
"into",
"a",
"DTO",
"feature",
"transaction",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/feature/FeatureTransaction.java#L135-L153
|
147,212
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/gfx/paintable/Circle.java
|
Circle.setPosition
|
public void setPosition(Coordinate position) {
if (getOriginalLocation() != null) {
Bbox oldBounds = (Bbox) getOriginalLocation();
Bbox newBounds = (Bbox) oldBounds.clone();
newBounds.setCenterPoint(position);
setOriginalLocation(newBounds);
} else {
setOriginalLocation(new Bbox(position.getX(), position.getY(), 0, 0));
}
}
|
java
|
public void setPosition(Coordinate position) {
if (getOriginalLocation() != null) {
Bbox oldBounds = (Bbox) getOriginalLocation();
Bbox newBounds = (Bbox) oldBounds.clone();
newBounds.setCenterPoint(position);
setOriginalLocation(newBounds);
} else {
setOriginalLocation(new Bbox(position.getX(), position.getY(), 0, 0));
}
}
|
[
"public",
"void",
"setPosition",
"(",
"Coordinate",
"position",
")",
"{",
"if",
"(",
"getOriginalLocation",
"(",
")",
"!=",
"null",
")",
"{",
"Bbox",
"oldBounds",
"=",
"(",
"Bbox",
")",
"getOriginalLocation",
"(",
")",
";",
"Bbox",
"newBounds",
"=",
"(",
"Bbox",
")",
"oldBounds",
".",
"clone",
"(",
")",
";",
"newBounds",
".",
"setCenterPoint",
"(",
"position",
")",
";",
"setOriginalLocation",
"(",
"newBounds",
")",
";",
"}",
"else",
"{",
"setOriginalLocation",
"(",
"new",
"Bbox",
"(",
"position",
".",
"getX",
"(",
")",
",",
"position",
".",
"getY",
"(",
")",
",",
"0",
",",
"0",
")",
")",
";",
"}",
"}"
] |
Set circle position in world space.
@param position circle center
|
[
"Set",
"circle",
"position",
"in",
"world",
"space",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/paintable/Circle.java#L77-L86
|
147,213
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/gfx/paintable/Circle.java
|
Circle.setRadius
|
public void setRadius(float radius) {
if (getOriginalLocation() != null) {
Bbox oldBounds = (Bbox) getOriginalLocation();
Bbox newBounds = (Bbox) oldBounds.clone();
newBounds.setWidth(2 * radius);
newBounds.setHeight(2 * radius);
newBounds.setCenterPoint(oldBounds.getCenterPoint());
setOriginalLocation(newBounds);
} else {
setOriginalLocation(new Bbox(0, 0, 2 * radius, 2 * radius));
}
}
|
java
|
public void setRadius(float radius) {
if (getOriginalLocation() != null) {
Bbox oldBounds = (Bbox) getOriginalLocation();
Bbox newBounds = (Bbox) oldBounds.clone();
newBounds.setWidth(2 * radius);
newBounds.setHeight(2 * radius);
newBounds.setCenterPoint(oldBounds.getCenterPoint());
setOriginalLocation(newBounds);
} else {
setOriginalLocation(new Bbox(0, 0, 2 * radius, 2 * radius));
}
}
|
[
"public",
"void",
"setRadius",
"(",
"float",
"radius",
")",
"{",
"if",
"(",
"getOriginalLocation",
"(",
")",
"!=",
"null",
")",
"{",
"Bbox",
"oldBounds",
"=",
"(",
"Bbox",
")",
"getOriginalLocation",
"(",
")",
";",
"Bbox",
"newBounds",
"=",
"(",
"Bbox",
")",
"oldBounds",
".",
"clone",
"(",
")",
";",
"newBounds",
".",
"setWidth",
"(",
"2",
"*",
"radius",
")",
";",
"newBounds",
".",
"setHeight",
"(",
"2",
"*",
"radius",
")",
";",
"newBounds",
".",
"setCenterPoint",
"(",
"oldBounds",
".",
"getCenterPoint",
"(",
")",
")",
";",
"setOriginalLocation",
"(",
"newBounds",
")",
";",
"}",
"else",
"{",
"setOriginalLocation",
"(",
"new",
"Bbox",
"(",
"0",
",",
"0",
",",
"2",
"*",
"radius",
",",
"2",
"*",
"radius",
")",
")",
";",
"}",
"}"
] |
Set circle radius in world coordinates.
@param radius circle radius in world units
|
[
"Set",
"circle",
"radius",
"in",
"world",
"coordinates",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/paintable/Circle.java#L107-L118
|
147,214
|
geomajas/geomajas-project-client-gwt
|
plugin/editing/editing-javascript-api-gwt/src/main/java/org/geomajas/plugin/editing/jsapi/gwt/client/contextmenu/JsGeometryContextMenuRegistry.java
|
JsGeometryContextMenuRegistry.addVertexAction
|
public void addVertexAction(final JsGeometryContextMenuAction action, String title) {
delegate.addVertexAction(new GeometryContextMenuAction(title, null) {
@Override
public void onClick(MenuItemClickEvent event) {
action.execute(JsGeometryContextMenuRegistry.this);
}
});
}
|
java
|
public void addVertexAction(final JsGeometryContextMenuAction action, String title) {
delegate.addVertexAction(new GeometryContextMenuAction(title, null) {
@Override
public void onClick(MenuItemClickEvent event) {
action.execute(JsGeometryContextMenuRegistry.this);
}
});
}
|
[
"public",
"void",
"addVertexAction",
"(",
"final",
"JsGeometryContextMenuAction",
"action",
",",
"String",
"title",
")",
"{",
"delegate",
".",
"addVertexAction",
"(",
"new",
"GeometryContextMenuAction",
"(",
"title",
",",
"null",
")",
"{",
"@",
"Override",
"public",
"void",
"onClick",
"(",
"MenuItemClickEvent",
"event",
")",
"{",
"action",
".",
"execute",
"(",
"JsGeometryContextMenuRegistry",
".",
"this",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Adds a vertex context menu action.
@param action
@param title
|
[
"Adds",
"a",
"vertex",
"context",
"menu",
"action",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/editing/editing-javascript-api-gwt/src/main/java/org/geomajas/plugin/editing/jsapi/gwt/client/contextmenu/JsGeometryContextMenuRegistry.java#L60-L69
|
147,215
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/action/menu/InsertRingAction.java
|
InsertRingAction.onClick
|
public void onClick(MenuItemClickEvent event) {
final FeatureTransaction ft = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction();
if (ft != null && index != null) {
List<Feature> features = new ArrayList<Feature>();
features.add(ft.getNewFeatures()[index.getFeatureIndex()]);
LazyLoader.lazyLoad(features, GeomajasConstant.FEATURE_INCLUDE_GEOMETRY, new LazyLoadCallback() {
public void execute(List<Feature> response) {
controller.setEditMode(EditMode.INSERT_MODE);
Geometry geometry = response.get(0).getGeometry();
if (geometry instanceof Polygon) {
geometry = addRing((Polygon) geometry);
} else if (geometry instanceof MultiPolygon) {
geometry = addRing((MultiPolygon) geometry);
}
ft.getNewFeatures()[index.getFeatureIndex()].setGeometry(geometry);
controller.setGeometryIndex(index);
controller.hideGeometricInfo();
}
});
}
}
|
java
|
public void onClick(MenuItemClickEvent event) {
final FeatureTransaction ft = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction();
if (ft != null && index != null) {
List<Feature> features = new ArrayList<Feature>();
features.add(ft.getNewFeatures()[index.getFeatureIndex()]);
LazyLoader.lazyLoad(features, GeomajasConstant.FEATURE_INCLUDE_GEOMETRY, new LazyLoadCallback() {
public void execute(List<Feature> response) {
controller.setEditMode(EditMode.INSERT_MODE);
Geometry geometry = response.get(0).getGeometry();
if (geometry instanceof Polygon) {
geometry = addRing((Polygon) geometry);
} else if (geometry instanceof MultiPolygon) {
geometry = addRing((MultiPolygon) geometry);
}
ft.getNewFeatures()[index.getFeatureIndex()].setGeometry(geometry);
controller.setGeometryIndex(index);
controller.hideGeometricInfo();
}
});
}
}
|
[
"public",
"void",
"onClick",
"(",
"MenuItemClickEvent",
"event",
")",
"{",
"final",
"FeatureTransaction",
"ft",
"=",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getFeatureEditor",
"(",
")",
".",
"getFeatureTransaction",
"(",
")",
";",
"if",
"(",
"ft",
"!=",
"null",
"&&",
"index",
"!=",
"null",
")",
"{",
"List",
"<",
"Feature",
">",
"features",
"=",
"new",
"ArrayList",
"<",
"Feature",
">",
"(",
")",
";",
"features",
".",
"add",
"(",
"ft",
".",
"getNewFeatures",
"(",
")",
"[",
"index",
".",
"getFeatureIndex",
"(",
")",
"]",
")",
";",
"LazyLoader",
".",
"lazyLoad",
"(",
"features",
",",
"GeomajasConstant",
".",
"FEATURE_INCLUDE_GEOMETRY",
",",
"new",
"LazyLoadCallback",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
"List",
"<",
"Feature",
">",
"response",
")",
"{",
"controller",
".",
"setEditMode",
"(",
"EditMode",
".",
"INSERT_MODE",
")",
";",
"Geometry",
"geometry",
"=",
"response",
".",
"get",
"(",
"0",
")",
".",
"getGeometry",
"(",
")",
";",
"if",
"(",
"geometry",
"instanceof",
"Polygon",
")",
"{",
"geometry",
"=",
"addRing",
"(",
"(",
"Polygon",
")",
"geometry",
")",
";",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"MultiPolygon",
")",
"{",
"geometry",
"=",
"addRing",
"(",
"(",
"MultiPolygon",
")",
"geometry",
")",
";",
"}",
"ft",
".",
"getNewFeatures",
"(",
")",
"[",
"index",
".",
"getFeatureIndex",
"(",
")",
"]",
".",
"setGeometry",
"(",
"geometry",
")",
";",
"controller",
".",
"setGeometryIndex",
"(",
"index",
")",
";",
"controller",
".",
"hideGeometricInfo",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] |
Insert a new point in the geometry at a given index. The index is taken from the context menu event. This
function will add a new empty interior ring in the polygon in question.
@param event
The {@link MenuItemClickEvent} from clicking the action.
|
[
"Insert",
"a",
"new",
"point",
"in",
"the",
"geometry",
"at",
"a",
"given",
"index",
".",
"The",
"index",
"is",
"taken",
"from",
"the",
"context",
"menu",
"event",
".",
"This",
"function",
"will",
"add",
"a",
"new",
"empty",
"interior",
"ring",
"in",
"the",
"polygon",
"in",
"question",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/menu/InsertRingAction.java#L77-L98
|
147,216
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/FeatureListGrid.java
|
FeatureListGrid.setLayer
|
public void setLayer(VectorLayer layer) {
this.layer = layer;
if (layer == null) {
clear();
} else {
empty();
updateFields();
}
}
|
java
|
public void setLayer(VectorLayer layer) {
this.layer = layer;
if (layer == null) {
clear();
} else {
empty();
updateFields();
}
}
|
[
"public",
"void",
"setLayer",
"(",
"VectorLayer",
"layer",
")",
"{",
"this",
".",
"layer",
"=",
"layer",
";",
"if",
"(",
"layer",
"==",
"null",
")",
"{",
"clear",
"(",
")",
";",
"}",
"else",
"{",
"empty",
"(",
")",
";",
"updateFields",
"(",
")",
";",
"}",
"}"
] |
Apply a new layer onto the grid. This means that the table header will immediately take on the attributes of this
new layer.
@param layer
The layer from whom to display the features. If this is null, the table will be cleared.
|
[
"Apply",
"a",
"new",
"layer",
"onto",
"the",
"grid",
".",
"This",
"means",
"that",
"the",
"table",
"header",
"will",
"immediately",
"take",
"on",
"the",
"attributes",
"of",
"this",
"new",
"layer",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/FeatureListGrid.java#L288-L296
|
147,217
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/FeatureListGrid.java
|
FeatureListGrid.setSelectionEnabled
|
public void setSelectionEnabled(boolean selectionEnabled) {
// Clean up first! Otherwise the handler list would just keep on growing.
if (selectionRegistration != null) {
selectionRegistration.removeHandler();
selectionRegistration = null;
}
if (gridSelectionRegistration != null) {
gridSelectionRegistration.removeHandler();
gridSelectionRegistration = null;
}
this.selectionEnabled = selectionEnabled;
// If enabled renew the handlers, and adjust grid selection type:
if (selectionEnabled) {
setAttribute("selectionType", SelectionStyle.MULTIPLE.getValue(), true);
selectionRegistration = mapModel.addFeatureSelectionHandler(this);
gridSelectionRegistration = addSelectionChangedHandler(this);
} else {
setAttribute("selectionType", SelectionStyle.NONE.getValue(), true);
}
}
|
java
|
public void setSelectionEnabled(boolean selectionEnabled) {
// Clean up first! Otherwise the handler list would just keep on growing.
if (selectionRegistration != null) {
selectionRegistration.removeHandler();
selectionRegistration = null;
}
if (gridSelectionRegistration != null) {
gridSelectionRegistration.removeHandler();
gridSelectionRegistration = null;
}
this.selectionEnabled = selectionEnabled;
// If enabled renew the handlers, and adjust grid selection type:
if (selectionEnabled) {
setAttribute("selectionType", SelectionStyle.MULTIPLE.getValue(), true);
selectionRegistration = mapModel.addFeatureSelectionHandler(this);
gridSelectionRegistration = addSelectionChangedHandler(this);
} else {
setAttribute("selectionType", SelectionStyle.NONE.getValue(), true);
}
}
|
[
"public",
"void",
"setSelectionEnabled",
"(",
"boolean",
"selectionEnabled",
")",
"{",
"// Clean up first! Otherwise the handler list would just keep on growing.",
"if",
"(",
"selectionRegistration",
"!=",
"null",
")",
"{",
"selectionRegistration",
".",
"removeHandler",
"(",
")",
";",
"selectionRegistration",
"=",
"null",
";",
"}",
"if",
"(",
"gridSelectionRegistration",
"!=",
"null",
")",
"{",
"gridSelectionRegistration",
".",
"removeHandler",
"(",
")",
";",
"gridSelectionRegistration",
"=",
"null",
";",
"}",
"this",
".",
"selectionEnabled",
"=",
"selectionEnabled",
";",
"// If enabled renew the handlers, and adjust grid selection type:",
"if",
"(",
"selectionEnabled",
")",
"{",
"setAttribute",
"(",
"\"selectionType\"",
",",
"SelectionStyle",
".",
"MULTIPLE",
".",
"getValue",
"(",
")",
",",
"true",
")",
";",
"selectionRegistration",
"=",
"mapModel",
".",
"addFeatureSelectionHandler",
"(",
"this",
")",
";",
"gridSelectionRegistration",
"=",
"addSelectionChangedHandler",
"(",
"this",
")",
";",
"}",
"else",
"{",
"setAttribute",
"(",
"\"selectionType\"",
",",
"SelectionStyle",
".",
"NONE",
".",
"getValue",
"(",
")",
",",
"true",
")",
";",
"}",
"}"
] |
Adds or removes this widget as a handler for selection onto the MapModel. What this means is that when selection
is enabled, selected rows in the grid will result in selected features in the MapModel and vice versa.
@param selectionEnabled
is selection enabled?
|
[
"Adds",
"or",
"removes",
"this",
"widget",
"as",
"a",
"handler",
"for",
"selection",
"onto",
"the",
"MapModel",
".",
"What",
"this",
"means",
"is",
"that",
"when",
"selection",
"is",
"enabled",
"selected",
"rows",
"in",
"the",
"grid",
"will",
"result",
"in",
"selected",
"features",
"in",
"the",
"MapModel",
"and",
"vice",
"versa",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/FeatureListGrid.java#L315-L335
|
147,218
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/FeatureListGrid.java
|
FeatureListGrid.createAttributeGridField
|
private ListGridField createAttributeGridField(final AttributeInfo attributeInfo) {
ListGridField gridField = new ListGridField(attributeInfo.getName(), attributeInfo.getLabel());
gridField.setAlign(Alignment.LEFT);
gridField.setCanEdit(false);
gridField.setShowIfCondition(new IdentifyingListGridFieldIfFunction(attributeInfo.isIdentifying()));
if (attributeInfo instanceof PrimitiveAttributeInfo) {
PrimitiveAttributeInfo info = (PrimitiveAttributeInfo) attributeInfo;
if (info.getType().equals(PrimitiveType.BOOLEAN)) {
gridField.setType(ListGridFieldType.BOOLEAN);
} else if (info.getType().equals(PrimitiveType.STRING)) {
gridField.setType(ListGridFieldType.TEXT);
} else if (info.getType().equals(PrimitiveType.DATE)) {
gridField.setType(ListGridFieldType.DATE);
} else if (info.getType().equals(PrimitiveType.SHORT)) {
gridField.setType(ListGridFieldType.INTEGER);
} else if (info.getType().equals(PrimitiveType.INTEGER)) {
gridField.setType(ListGridFieldType.INTEGER);
} else if (info.getType().equals(PrimitiveType.LONG)) {
gridField.setType(ListGridFieldType.INTEGER);
} else if (info.getType().equals(PrimitiveType.FLOAT)) {
gridField.setType(ListGridFieldType.FLOAT);
} else if (info.getType().equals(PrimitiveType.DOUBLE)) {
gridField.setType(ListGridFieldType.FLOAT);
} else if (info.getType().equals(PrimitiveType.IMGURL)) {
gridField.setType(ListGridFieldType.IMAGE);
if (showImageAttributeOnHover) {
addCellOverHandler(new ImageCellHandler(attributeInfo));
}
} else if (info.getType().equals(PrimitiveType.CURRENCY)) {
gridField.setType(ListGridFieldType.TEXT);
} else if (info.getType().equals(PrimitiveType.URL)) {
gridField.setType(ListGridFieldType.LINK);
}
} else if (attributeInfo instanceof AssociationAttributeInfo) {
gridField.setType(ListGridFieldType.TEXT);
}
return gridField;
}
|
java
|
private ListGridField createAttributeGridField(final AttributeInfo attributeInfo) {
ListGridField gridField = new ListGridField(attributeInfo.getName(), attributeInfo.getLabel());
gridField.setAlign(Alignment.LEFT);
gridField.setCanEdit(false);
gridField.setShowIfCondition(new IdentifyingListGridFieldIfFunction(attributeInfo.isIdentifying()));
if (attributeInfo instanceof PrimitiveAttributeInfo) {
PrimitiveAttributeInfo info = (PrimitiveAttributeInfo) attributeInfo;
if (info.getType().equals(PrimitiveType.BOOLEAN)) {
gridField.setType(ListGridFieldType.BOOLEAN);
} else if (info.getType().equals(PrimitiveType.STRING)) {
gridField.setType(ListGridFieldType.TEXT);
} else if (info.getType().equals(PrimitiveType.DATE)) {
gridField.setType(ListGridFieldType.DATE);
} else if (info.getType().equals(PrimitiveType.SHORT)) {
gridField.setType(ListGridFieldType.INTEGER);
} else if (info.getType().equals(PrimitiveType.INTEGER)) {
gridField.setType(ListGridFieldType.INTEGER);
} else if (info.getType().equals(PrimitiveType.LONG)) {
gridField.setType(ListGridFieldType.INTEGER);
} else if (info.getType().equals(PrimitiveType.FLOAT)) {
gridField.setType(ListGridFieldType.FLOAT);
} else if (info.getType().equals(PrimitiveType.DOUBLE)) {
gridField.setType(ListGridFieldType.FLOAT);
} else if (info.getType().equals(PrimitiveType.IMGURL)) {
gridField.setType(ListGridFieldType.IMAGE);
if (showImageAttributeOnHover) {
addCellOverHandler(new ImageCellHandler(attributeInfo));
}
} else if (info.getType().equals(PrimitiveType.CURRENCY)) {
gridField.setType(ListGridFieldType.TEXT);
} else if (info.getType().equals(PrimitiveType.URL)) {
gridField.setType(ListGridFieldType.LINK);
}
} else if (attributeInfo instanceof AssociationAttributeInfo) {
gridField.setType(ListGridFieldType.TEXT);
}
return gridField;
}
|
[
"private",
"ListGridField",
"createAttributeGridField",
"(",
"final",
"AttributeInfo",
"attributeInfo",
")",
"{",
"ListGridField",
"gridField",
"=",
"new",
"ListGridField",
"(",
"attributeInfo",
".",
"getName",
"(",
")",
",",
"attributeInfo",
".",
"getLabel",
"(",
")",
")",
";",
"gridField",
".",
"setAlign",
"(",
"Alignment",
".",
"LEFT",
")",
";",
"gridField",
".",
"setCanEdit",
"(",
"false",
")",
";",
"gridField",
".",
"setShowIfCondition",
"(",
"new",
"IdentifyingListGridFieldIfFunction",
"(",
"attributeInfo",
".",
"isIdentifying",
"(",
")",
")",
")",
";",
"if",
"(",
"attributeInfo",
"instanceof",
"PrimitiveAttributeInfo",
")",
"{",
"PrimitiveAttributeInfo",
"info",
"=",
"(",
"PrimitiveAttributeInfo",
")",
"attributeInfo",
";",
"if",
"(",
"info",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"PrimitiveType",
".",
"BOOLEAN",
")",
")",
"{",
"gridField",
".",
"setType",
"(",
"ListGridFieldType",
".",
"BOOLEAN",
")",
";",
"}",
"else",
"if",
"(",
"info",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"PrimitiveType",
".",
"STRING",
")",
")",
"{",
"gridField",
".",
"setType",
"(",
"ListGridFieldType",
".",
"TEXT",
")",
";",
"}",
"else",
"if",
"(",
"info",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"PrimitiveType",
".",
"DATE",
")",
")",
"{",
"gridField",
".",
"setType",
"(",
"ListGridFieldType",
".",
"DATE",
")",
";",
"}",
"else",
"if",
"(",
"info",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"PrimitiveType",
".",
"SHORT",
")",
")",
"{",
"gridField",
".",
"setType",
"(",
"ListGridFieldType",
".",
"INTEGER",
")",
";",
"}",
"else",
"if",
"(",
"info",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"PrimitiveType",
".",
"INTEGER",
")",
")",
"{",
"gridField",
".",
"setType",
"(",
"ListGridFieldType",
".",
"INTEGER",
")",
";",
"}",
"else",
"if",
"(",
"info",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"PrimitiveType",
".",
"LONG",
")",
")",
"{",
"gridField",
".",
"setType",
"(",
"ListGridFieldType",
".",
"INTEGER",
")",
";",
"}",
"else",
"if",
"(",
"info",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"PrimitiveType",
".",
"FLOAT",
")",
")",
"{",
"gridField",
".",
"setType",
"(",
"ListGridFieldType",
".",
"FLOAT",
")",
";",
"}",
"else",
"if",
"(",
"info",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"PrimitiveType",
".",
"DOUBLE",
")",
")",
"{",
"gridField",
".",
"setType",
"(",
"ListGridFieldType",
".",
"FLOAT",
")",
";",
"}",
"else",
"if",
"(",
"info",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"PrimitiveType",
".",
"IMGURL",
")",
")",
"{",
"gridField",
".",
"setType",
"(",
"ListGridFieldType",
".",
"IMAGE",
")",
";",
"if",
"(",
"showImageAttributeOnHover",
")",
"{",
"addCellOverHandler",
"(",
"new",
"ImageCellHandler",
"(",
"attributeInfo",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"info",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"PrimitiveType",
".",
"CURRENCY",
")",
")",
"{",
"gridField",
".",
"setType",
"(",
"ListGridFieldType",
".",
"TEXT",
")",
";",
"}",
"else",
"if",
"(",
"info",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"PrimitiveType",
".",
"URL",
")",
")",
"{",
"gridField",
".",
"setType",
"(",
"ListGridFieldType",
".",
"LINK",
")",
";",
"}",
"}",
"else",
"if",
"(",
"attributeInfo",
"instanceof",
"AssociationAttributeInfo",
")",
"{",
"gridField",
".",
"setType",
"(",
"ListGridFieldType",
".",
"TEXT",
")",
";",
"}",
"return",
"gridField",
";",
"}"
] |
Create a single field definition from a attribute definition.
@param attributeInfo
attribute info
@return field for grid
|
[
"Create",
"a",
"single",
"field",
"definition",
"from",
"a",
"attribute",
"definition",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/FeatureListGrid.java#L552-L591
|
147,219
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/Polygon.java
|
Polygon.getInteriorRingN
|
public LinearRing getInteriorRingN(int n) {
if (!isEmpty()) {
if (interiorRings != null && interiorRings.length > n) {
return interiorRings[n];
}
}
return null;
}
|
java
|
public LinearRing getInteriorRingN(int n) {
if (!isEmpty()) {
if (interiorRings != null && interiorRings.length > n) {
return interiorRings[n];
}
}
return null;
}
|
[
"public",
"LinearRing",
"getInteriorRingN",
"(",
"int",
"n",
")",
"{",
"if",
"(",
"!",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"interiorRings",
"!=",
"null",
"&&",
"interiorRings",
".",
"length",
">",
"n",
")",
"{",
"return",
"interiorRings",
"[",
"n",
"]",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Get one of the interior LinearRing geometries. i.e. one of the holes.
@param n
Index in the geometry's interior rings.
@return Returns the hole if it exists, null otherwise.
|
[
"Get",
"one",
"of",
"the",
"interior",
"LinearRing",
"geometries",
".",
"i",
".",
"e",
".",
"one",
"of",
"the",
"holes",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/Polygon.java#L75-L82
|
147,220
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/Polygon.java
|
Polygon.getNumPoints
|
public int getNumPoints() {
if (isEmpty()) {
return 0;
}
int total = exteriorRing.getNumPoints();
if (interiorRings != null) {
for (LinearRing interiorRing : interiorRings) {
total += interiorRing.getNumPoints();
}
}
return total;
}
|
java
|
public int getNumPoints() {
if (isEmpty()) {
return 0;
}
int total = exteriorRing.getNumPoints();
if (interiorRings != null) {
for (LinearRing interiorRing : interiorRings) {
total += interiorRing.getNumPoints();
}
}
return total;
}
|
[
"public",
"int",
"getNumPoints",
"(",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"int",
"total",
"=",
"exteriorRing",
".",
"getNumPoints",
"(",
")",
";",
"if",
"(",
"interiorRings",
"!=",
"null",
")",
"{",
"for",
"(",
"LinearRing",
"interiorRing",
":",
"interiorRings",
")",
"{",
"total",
"+=",
"interiorRing",
".",
"getNumPoints",
"(",
")",
";",
"}",
"}",
"return",
"total",
";",
"}"
] |
Return the sum of all points in the exterior ring + the total number of points in all the interior rings.
|
[
"Return",
"the",
"sum",
"of",
"all",
"points",
"in",
"the",
"exterior",
"ring",
"+",
"the",
"total",
"number",
"of",
"points",
"in",
"all",
"the",
"interior",
"rings",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/Polygon.java#L130-L141
|
147,221
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/Polygon.java
|
Polygon.getArea
|
public double getArea() {
double area = 0;
if (!isEmpty()) {
area = exteriorRing.getArea();
if (interiorRings != null) {
for (LinearRing interiorRing : interiorRings) {
area -= interiorRing.getArea();
}
}
}
return area;
}
|
java
|
public double getArea() {
double area = 0;
if (!isEmpty()) {
area = exteriorRing.getArea();
if (interiorRings != null) {
for (LinearRing interiorRing : interiorRings) {
area -= interiorRing.getArea();
}
}
}
return area;
}
|
[
"public",
"double",
"getArea",
"(",
")",
"{",
"double",
"area",
"=",
"0",
";",
"if",
"(",
"!",
"isEmpty",
"(",
")",
")",
"{",
"area",
"=",
"exteriorRing",
".",
"getArea",
"(",
")",
";",
"if",
"(",
"interiorRings",
"!=",
"null",
")",
"{",
"for",
"(",
"LinearRing",
"interiorRing",
":",
"interiorRings",
")",
"{",
"area",
"-=",
"interiorRing",
".",
"getArea",
"(",
")",
";",
"}",
"}",
"}",
"return",
"area",
";",
"}"
] |
Return the shell area minus holes areas.
|
[
"Return",
"the",
"shell",
"area",
"minus",
"holes",
"areas",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/Polygon.java#L146-L157
|
147,222
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/Polygon.java
|
Polygon.getLength
|
public double getLength() {
double length = 0;
if (!isEmpty()) {
length = exteriorRing.getLength();
if (interiorRings != null) {
for (LinearRing interiorRing : interiorRings) {
length += interiorRing.getLength();
}
}
}
return length;
}
|
java
|
public double getLength() {
double length = 0;
if (!isEmpty()) {
length = exteriorRing.getLength();
if (interiorRings != null) {
for (LinearRing interiorRing : interiorRings) {
length += interiorRing.getLength();
}
}
}
return length;
}
|
[
"public",
"double",
"getLength",
"(",
")",
"{",
"double",
"length",
"=",
"0",
";",
"if",
"(",
"!",
"isEmpty",
"(",
")",
")",
"{",
"length",
"=",
"exteriorRing",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"interiorRings",
"!=",
"null",
")",
"{",
"for",
"(",
"LinearRing",
"interiorRing",
":",
"interiorRings",
")",
"{",
"length",
"+=",
"interiorRing",
".",
"getLength",
"(",
")",
";",
"}",
"}",
"}",
"return",
"length",
";",
"}"
] |
Return the total length of all rings.
|
[
"Return",
"the",
"total",
"length",
"of",
"all",
"rings",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/Polygon.java#L162-L173
|
147,223
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/Polygon.java
|
Polygon.getCoordinates
|
public Coordinate[] getCoordinates() {
if (isEmpty()) {
return null;
}
int len = getNumPoints();
Coordinate[] coordinates = new Coordinate[len];
int count;
for (count = 0; count < exteriorRing.getNumPoints(); count++) {
coordinates[count] = exteriorRing.getCoordinateN(count);
}
if (interiorRings != null) {
for (LinearRing interiorRing : interiorRings) {
for (int n = 0; n < interiorRing.getNumPoints(); n++) {
coordinates[count++] = interiorRing.getCoordinateN(n);
}
}
}
return coordinates;
}
|
java
|
public Coordinate[] getCoordinates() {
if (isEmpty()) {
return null;
}
int len = getNumPoints();
Coordinate[] coordinates = new Coordinate[len];
int count;
for (count = 0; count < exteriorRing.getNumPoints(); count++) {
coordinates[count] = exteriorRing.getCoordinateN(count);
}
if (interiorRings != null) {
for (LinearRing interiorRing : interiorRings) {
for (int n = 0; n < interiorRing.getNumPoints(); n++) {
coordinates[count++] = interiorRing.getCoordinateN(n);
}
}
}
return coordinates;
}
|
[
"public",
"Coordinate",
"[",
"]",
"getCoordinates",
"(",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"int",
"len",
"=",
"getNumPoints",
"(",
")",
";",
"Coordinate",
"[",
"]",
"coordinates",
"=",
"new",
"Coordinate",
"[",
"len",
"]",
";",
"int",
"count",
";",
"for",
"(",
"count",
"=",
"0",
";",
"count",
"<",
"exteriorRing",
".",
"getNumPoints",
"(",
")",
";",
"count",
"++",
")",
"{",
"coordinates",
"[",
"count",
"]",
"=",
"exteriorRing",
".",
"getCoordinateN",
"(",
"count",
")",
";",
"}",
"if",
"(",
"interiorRings",
"!=",
"null",
")",
"{",
"for",
"(",
"LinearRing",
"interiorRing",
":",
"interiorRings",
")",
"{",
"for",
"(",
"int",
"n",
"=",
"0",
";",
"n",
"<",
"interiorRing",
".",
"getNumPoints",
"(",
")",
";",
"n",
"++",
")",
"{",
"coordinates",
"[",
"count",
"++",
"]",
"=",
"interiorRing",
".",
"getCoordinateN",
"(",
"n",
")",
";",
"}",
"}",
"}",
"return",
"coordinates",
";",
"}"
] |
Return the concatenated coordinates of both the exterior ring and all the interior rings. If the polygon is
empty, null will be returned.
|
[
"Return",
"the",
"concatenated",
"coordinates",
"of",
"both",
"the",
"exterior",
"ring",
"and",
"all",
"the",
"interior",
"rings",
".",
"If",
"the",
"polygon",
"is",
"empty",
"null",
"will",
"be",
"returned",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/Polygon.java#L260-L278
|
147,224
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/Polygon.java
|
Polygon.intersects
|
public boolean intersects(Geometry geometry) {
if (isEmpty()) {
return false;
}
if (exteriorRing.intersects(geometry)) {
return true;
}
if (interiorRings != null) {
for (LinearRing interiorRing : interiorRings) {
if (interiorRing.intersects(geometry)) {
return true;
}
}
}
return false;
}
|
java
|
public boolean intersects(Geometry geometry) {
if (isEmpty()) {
return false;
}
if (exteriorRing.intersects(geometry)) {
return true;
}
if (interiorRings != null) {
for (LinearRing interiorRing : interiorRings) {
if (interiorRing.intersects(geometry)) {
return true;
}
}
}
return false;
}
|
[
"public",
"boolean",
"intersects",
"(",
"Geometry",
"geometry",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"exteriorRing",
".",
"intersects",
"(",
"geometry",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"interiorRings",
"!=",
"null",
")",
"{",
"for",
"(",
"LinearRing",
"interiorRing",
":",
"interiorRings",
")",
"{",
"if",
"(",
"interiorRing",
".",
"intersects",
"(",
"geometry",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Does this polygon intersects with the given geometry?
@param geometry
The other geometry.
@return Returns true of the polygon intersects the other geometry.
|
[
"Does",
"this",
"polygon",
"intersects",
"with",
"the",
"given",
"geometry?"
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/Polygon.java#L291-L306
|
147,225
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/snapping/Snapper.java
|
Snapper.snap
|
public Coordinate snap(Coordinate coordinate) {
if (rules == null || mapModel == null) {
return coordinate;
}
Coordinate snappedCoordinate = coordinate;
double snappedDistance = Double.MAX_VALUE;
for (SnappingRuleInfo rule : rules) {
// Check for supported snapping algorithms: TODO use factory
if (rule.getType() != SnappingType.CLOSEST_ENDPOINT && rule.getType() != SnappingType.NEAREST_POINT) {
throw new IllegalArgumentException("Unknown snapping rule type was found: " + rule.getType());
}
// Get the target snap layer:
VectorLayer snapLayer;
try {
snapLayer = mapModel.getVectorLayer(rule.getLayerId());
} catch (Exception e) { // NOSONAR
throw new IllegalArgumentException("Target snapping layer (" + rule.getLayerId()
+ ") was not a vector layer.");
}
SnapMode tempMode = this.mode;
if (snapLayer.getLayerInfo().getLayerType() != LayerType.POLYGON
&& snapLayer.getLayerInfo().getLayerType() != LayerType.MULTIPOLYGON) {
// For mode=MODE_PRIORITY_TO_INTERSECTING_GEOMETRIES, an area > 0 is required.
tempMode = SnapMode.ALL_GEOMETRIES_EQUAL;
}
// TODO: don't create the handler every time...
SnappingMode handler;
if (tempMode == SnapMode.ALL_GEOMETRIES_EQUAL) {
handler = new EqualSnappingMode(rule);
} else {
handler = new IntersectPriorityMode(rule);
}
// Calculate snapping:
handler.setCoordinate(coordinate);
iterateFeatures(snapLayer, handler);
if (handler.getDistance() < snappedDistance) {
snappedCoordinate = handler.getSnappedCoordinate();
snappedDistance = handler.getDistance();
}
}
return snappedCoordinate;
}
|
java
|
public Coordinate snap(Coordinate coordinate) {
if (rules == null || mapModel == null) {
return coordinate;
}
Coordinate snappedCoordinate = coordinate;
double snappedDistance = Double.MAX_VALUE;
for (SnappingRuleInfo rule : rules) {
// Check for supported snapping algorithms: TODO use factory
if (rule.getType() != SnappingType.CLOSEST_ENDPOINT && rule.getType() != SnappingType.NEAREST_POINT) {
throw new IllegalArgumentException("Unknown snapping rule type was found: " + rule.getType());
}
// Get the target snap layer:
VectorLayer snapLayer;
try {
snapLayer = mapModel.getVectorLayer(rule.getLayerId());
} catch (Exception e) { // NOSONAR
throw new IllegalArgumentException("Target snapping layer (" + rule.getLayerId()
+ ") was not a vector layer.");
}
SnapMode tempMode = this.mode;
if (snapLayer.getLayerInfo().getLayerType() != LayerType.POLYGON
&& snapLayer.getLayerInfo().getLayerType() != LayerType.MULTIPOLYGON) {
// For mode=MODE_PRIORITY_TO_INTERSECTING_GEOMETRIES, an area > 0 is required.
tempMode = SnapMode.ALL_GEOMETRIES_EQUAL;
}
// TODO: don't create the handler every time...
SnappingMode handler;
if (tempMode == SnapMode.ALL_GEOMETRIES_EQUAL) {
handler = new EqualSnappingMode(rule);
} else {
handler = new IntersectPriorityMode(rule);
}
// Calculate snapping:
handler.setCoordinate(coordinate);
iterateFeatures(snapLayer, handler);
if (handler.getDistance() < snappedDistance) {
snappedCoordinate = handler.getSnappedCoordinate();
snappedDistance = handler.getDistance();
}
}
return snappedCoordinate;
}
|
[
"public",
"Coordinate",
"snap",
"(",
"Coordinate",
"coordinate",
")",
"{",
"if",
"(",
"rules",
"==",
"null",
"||",
"mapModel",
"==",
"null",
")",
"{",
"return",
"coordinate",
";",
"}",
"Coordinate",
"snappedCoordinate",
"=",
"coordinate",
";",
"double",
"snappedDistance",
"=",
"Double",
".",
"MAX_VALUE",
";",
"for",
"(",
"SnappingRuleInfo",
"rule",
":",
"rules",
")",
"{",
"// Check for supported snapping algorithms: TODO use factory",
"if",
"(",
"rule",
".",
"getType",
"(",
")",
"!=",
"SnappingType",
".",
"CLOSEST_ENDPOINT",
"&&",
"rule",
".",
"getType",
"(",
")",
"!=",
"SnappingType",
".",
"NEAREST_POINT",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unknown snapping rule type was found: \"",
"+",
"rule",
".",
"getType",
"(",
")",
")",
";",
"}",
"// Get the target snap layer:",
"VectorLayer",
"snapLayer",
";",
"try",
"{",
"snapLayer",
"=",
"mapModel",
".",
"getVectorLayer",
"(",
"rule",
".",
"getLayerId",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// NOSONAR",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Target snapping layer (\"",
"+",
"rule",
".",
"getLayerId",
"(",
")",
"+",
"\") was not a vector layer.\"",
")",
";",
"}",
"SnapMode",
"tempMode",
"=",
"this",
".",
"mode",
";",
"if",
"(",
"snapLayer",
".",
"getLayerInfo",
"(",
")",
".",
"getLayerType",
"(",
")",
"!=",
"LayerType",
".",
"POLYGON",
"&&",
"snapLayer",
".",
"getLayerInfo",
"(",
")",
".",
"getLayerType",
"(",
")",
"!=",
"LayerType",
".",
"MULTIPOLYGON",
")",
"{",
"// For mode=MODE_PRIORITY_TO_INTERSECTING_GEOMETRIES, an area > 0 is required.",
"tempMode",
"=",
"SnapMode",
".",
"ALL_GEOMETRIES_EQUAL",
";",
"}",
"// TODO: don't create the handler every time...",
"SnappingMode",
"handler",
";",
"if",
"(",
"tempMode",
"==",
"SnapMode",
".",
"ALL_GEOMETRIES_EQUAL",
")",
"{",
"handler",
"=",
"new",
"EqualSnappingMode",
"(",
"rule",
")",
";",
"}",
"else",
"{",
"handler",
"=",
"new",
"IntersectPriorityMode",
"(",
"rule",
")",
";",
"}",
"// Calculate snapping:",
"handler",
".",
"setCoordinate",
"(",
"coordinate",
")",
";",
"iterateFeatures",
"(",
"snapLayer",
",",
"handler",
")",
";",
"if",
"(",
"handler",
".",
"getDistance",
"(",
")",
"<",
"snappedDistance",
")",
"{",
"snappedCoordinate",
"=",
"handler",
".",
"getSnappedCoordinate",
"(",
")",
";",
"snappedDistance",
"=",
"handler",
".",
"getDistance",
"(",
")",
";",
"}",
"}",
"return",
"snappedCoordinate",
";",
"}"
] |
Execute the actual snapping!
@param coordinate
The original coordinate that needs snapping.
@return Returns the given coordinate, or a snapped coordinate if one was
found.
|
[
"Execute",
"the",
"actual",
"snapping!"
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/snapping/Snapper.java#L134-L181
|
147,226
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/action/toolbar/ToolbarRegistry.java
|
ToolbarRegistry.getToolbarAction
|
public static ToolbarBaseAction getToolbarAction(String key, MapWidget mapWidget) {
ToolCreator toolCreator = REGISTRY.get(key);
if (null == toolCreator) {
return null;
}
return toolCreator.createTool(mapWidget);
}
|
java
|
public static ToolbarBaseAction getToolbarAction(String key, MapWidget mapWidget) {
ToolCreator toolCreator = REGISTRY.get(key);
if (null == toolCreator) {
return null;
}
return toolCreator.createTool(mapWidget);
}
|
[
"public",
"static",
"ToolbarBaseAction",
"getToolbarAction",
"(",
"String",
"key",
",",
"MapWidget",
"mapWidget",
")",
"{",
"ToolCreator",
"toolCreator",
"=",
"REGISTRY",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"null",
"==",
"toolCreator",
")",
"{",
"return",
"null",
";",
"}",
"return",
"toolCreator",
".",
"createTool",
"(",
"mapWidget",
")",
";",
"}"
] |
Get the toolbar action which matches the given key.
@param key
key for toolbar action
@param mapWidget
map which will contain this tool
@return toolbar action or null when key not found
|
[
"Get",
"the",
"toolbar",
"action",
"which",
"matches",
"the",
"given",
"key",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/toolbar/ToolbarRegistry.java#L179-L185
|
147,227
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java
|
GeometryFactory.createGeometry
|
public Geometry createGeometry(Geometry geometry) {
if (geometry instanceof Point) {
return createPoint(geometry.getCoordinate());
} else if (geometry instanceof LinearRing) {
return createLinearRing(geometry.getCoordinates());
} else if (geometry instanceof LineString) {
return createLineString(geometry.getCoordinates());
} else if (geometry instanceof Polygon) {
Polygon polygon = (Polygon) geometry;
LinearRing exteriorRing = createLinearRing(polygon.getExteriorRing().getCoordinates());
LinearRing[] interiorRings = new LinearRing[polygon.getNumInteriorRing()];
for (int n = 0; n < polygon.getNumInteriorRing(); n++) {
interiorRings[n] = createLinearRing(polygon.getInteriorRingN(n).getCoordinates());
}
return new Polygon(srid, precision, exteriorRing, interiorRings);
} else if (geometry instanceof MultiPoint) {
Point[] clones = new Point[geometry.getNumGeometries()];
for (int n = 0; n < geometry.getNumGeometries(); n++) {
clones[n] = createPoint(geometry.getGeometryN(n).getCoordinate());
}
return new MultiPoint(srid, precision, clones);
} else if (geometry instanceof MultiLineString) {
LineString[] clones = new LineString[geometry.getNumGeometries()];
for (int n = 0; n < geometry.getNumGeometries(); n++) {
clones[n] = createLineString(geometry.getGeometryN(n).getCoordinates());
}
return new MultiLineString(srid, precision, clones);
} else if (geometry instanceof MultiPolygon) {
Polygon[] clones = new Polygon[geometry.getNumGeometries()];
for (int n = 0; n < geometry.getNumGeometries(); n++) {
clones[n] = (Polygon) createGeometry(geometry.getGeometryN(n));
}
return new MultiPolygon(srid, precision, clones);
}
return null;
}
|
java
|
public Geometry createGeometry(Geometry geometry) {
if (geometry instanceof Point) {
return createPoint(geometry.getCoordinate());
} else if (geometry instanceof LinearRing) {
return createLinearRing(geometry.getCoordinates());
} else if (geometry instanceof LineString) {
return createLineString(geometry.getCoordinates());
} else if (geometry instanceof Polygon) {
Polygon polygon = (Polygon) geometry;
LinearRing exteriorRing = createLinearRing(polygon.getExteriorRing().getCoordinates());
LinearRing[] interiorRings = new LinearRing[polygon.getNumInteriorRing()];
for (int n = 0; n < polygon.getNumInteriorRing(); n++) {
interiorRings[n] = createLinearRing(polygon.getInteriorRingN(n).getCoordinates());
}
return new Polygon(srid, precision, exteriorRing, interiorRings);
} else if (geometry instanceof MultiPoint) {
Point[] clones = new Point[geometry.getNumGeometries()];
for (int n = 0; n < geometry.getNumGeometries(); n++) {
clones[n] = createPoint(geometry.getGeometryN(n).getCoordinate());
}
return new MultiPoint(srid, precision, clones);
} else if (geometry instanceof MultiLineString) {
LineString[] clones = new LineString[geometry.getNumGeometries()];
for (int n = 0; n < geometry.getNumGeometries(); n++) {
clones[n] = createLineString(geometry.getGeometryN(n).getCoordinates());
}
return new MultiLineString(srid, precision, clones);
} else if (geometry instanceof MultiPolygon) {
Polygon[] clones = new Polygon[geometry.getNumGeometries()];
for (int n = 0; n < geometry.getNumGeometries(); n++) {
clones[n] = (Polygon) createGeometry(geometry.getGeometryN(n));
}
return new MultiPolygon(srid, precision, clones);
}
return null;
}
|
[
"public",
"Geometry",
"createGeometry",
"(",
"Geometry",
"geometry",
")",
"{",
"if",
"(",
"geometry",
"instanceof",
"Point",
")",
"{",
"return",
"createPoint",
"(",
"geometry",
".",
"getCoordinate",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"LinearRing",
")",
"{",
"return",
"createLinearRing",
"(",
"geometry",
".",
"getCoordinates",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"LineString",
")",
"{",
"return",
"createLineString",
"(",
"geometry",
".",
"getCoordinates",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"Polygon",
")",
"{",
"Polygon",
"polygon",
"=",
"(",
"Polygon",
")",
"geometry",
";",
"LinearRing",
"exteriorRing",
"=",
"createLinearRing",
"(",
"polygon",
".",
"getExteriorRing",
"(",
")",
".",
"getCoordinates",
"(",
")",
")",
";",
"LinearRing",
"[",
"]",
"interiorRings",
"=",
"new",
"LinearRing",
"[",
"polygon",
".",
"getNumInteriorRing",
"(",
")",
"]",
";",
"for",
"(",
"int",
"n",
"=",
"0",
";",
"n",
"<",
"polygon",
".",
"getNumInteriorRing",
"(",
")",
";",
"n",
"++",
")",
"{",
"interiorRings",
"[",
"n",
"]",
"=",
"createLinearRing",
"(",
"polygon",
".",
"getInteriorRingN",
"(",
"n",
")",
".",
"getCoordinates",
"(",
")",
")",
";",
"}",
"return",
"new",
"Polygon",
"(",
"srid",
",",
"precision",
",",
"exteriorRing",
",",
"interiorRings",
")",
";",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"MultiPoint",
")",
"{",
"Point",
"[",
"]",
"clones",
"=",
"new",
"Point",
"[",
"geometry",
".",
"getNumGeometries",
"(",
")",
"]",
";",
"for",
"(",
"int",
"n",
"=",
"0",
";",
"n",
"<",
"geometry",
".",
"getNumGeometries",
"(",
")",
";",
"n",
"++",
")",
"{",
"clones",
"[",
"n",
"]",
"=",
"createPoint",
"(",
"geometry",
".",
"getGeometryN",
"(",
"n",
")",
".",
"getCoordinate",
"(",
")",
")",
";",
"}",
"return",
"new",
"MultiPoint",
"(",
"srid",
",",
"precision",
",",
"clones",
")",
";",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"MultiLineString",
")",
"{",
"LineString",
"[",
"]",
"clones",
"=",
"new",
"LineString",
"[",
"geometry",
".",
"getNumGeometries",
"(",
")",
"]",
";",
"for",
"(",
"int",
"n",
"=",
"0",
";",
"n",
"<",
"geometry",
".",
"getNumGeometries",
"(",
")",
";",
"n",
"++",
")",
"{",
"clones",
"[",
"n",
"]",
"=",
"createLineString",
"(",
"geometry",
".",
"getGeometryN",
"(",
"n",
")",
".",
"getCoordinates",
"(",
")",
")",
";",
"}",
"return",
"new",
"MultiLineString",
"(",
"srid",
",",
"precision",
",",
"clones",
")",
";",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"MultiPolygon",
")",
"{",
"Polygon",
"[",
"]",
"clones",
"=",
"new",
"Polygon",
"[",
"geometry",
".",
"getNumGeometries",
"(",
")",
"]",
";",
"for",
"(",
"int",
"n",
"=",
"0",
";",
"n",
"<",
"geometry",
".",
"getNumGeometries",
"(",
")",
";",
"n",
"++",
")",
"{",
"clones",
"[",
"n",
"]",
"=",
"(",
"Polygon",
")",
"createGeometry",
"(",
"geometry",
".",
"getGeometryN",
"(",
"n",
")",
")",
";",
"}",
"return",
"new",
"MultiPolygon",
"(",
"srid",
",",
"precision",
",",
"clones",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Create a new geometry from an existing geometry. This will basically create a clone.
@param geometry
The original geometry.
@return Returns a clone.
|
[
"Create",
"a",
"new",
"geometry",
"from",
"an",
"existing",
"geometry",
".",
"This",
"will",
"basically",
"create",
"a",
"clone",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java#L248-L283
|
147,228
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/ribbon/RibbonButton.java
|
RibbonButton.updateGui
|
protected void updateGui() {
ButtonLayoutStyle buttonButtonLayoutStyle = buttonAction.getButtonLayoutStyle();
if (ButtonLayoutStyle.ICON_TITLE_AND_DESCRIPTION.equals(buttonButtonLayoutStyle)) {
buildGuiWithDescription();
} else { // LayoutParameter.Layout.ICON_AND_TITLE || null || ...
setWidth(50);
if (titleAlignment.equals(TitleAlignment.BOTTOM)) {
setHeight100();
outer = new VStack();
outer.setOverflow(Overflow.VISIBLE);
outer.setWidth(GuwLayout.ribbonButtonWidth);
outer.setAutoHeight();
outer.addMember(icon);
if (showTitles && !GuwLayout.hideRibbonTitles) {
titleLabel.setBaseStyle(getBaseStyle() + "LargeTitle");
titleLabel.setAutoHeight();
titleLabel.setWidth(GuwLayout.ribbonButtonWidth);
outer.addMember(titleLabel);
}
outer.setAlign(Alignment.CENTER);
} else {
setAutoHeight();
outer = new HStack(GuwLayout.ribbonButtonInnerMargin);
outer.setOverflow(Overflow.VISIBLE);
outer.setWidth100();
outer.setAutoHeight();
outer.addMember(icon);
if (showTitles) {
titleLabel.setBaseStyle(getBaseStyle() + "SmallTitle");
titleLabel.setAutoHeight();
titleLabel.setAutoWidth();
outer.addMember(titleLabel);
}
}
}
}
|
java
|
protected void updateGui() {
ButtonLayoutStyle buttonButtonLayoutStyle = buttonAction.getButtonLayoutStyle();
if (ButtonLayoutStyle.ICON_TITLE_AND_DESCRIPTION.equals(buttonButtonLayoutStyle)) {
buildGuiWithDescription();
} else { // LayoutParameter.Layout.ICON_AND_TITLE || null || ...
setWidth(50);
if (titleAlignment.equals(TitleAlignment.BOTTOM)) {
setHeight100();
outer = new VStack();
outer.setOverflow(Overflow.VISIBLE);
outer.setWidth(GuwLayout.ribbonButtonWidth);
outer.setAutoHeight();
outer.addMember(icon);
if (showTitles && !GuwLayout.hideRibbonTitles) {
titleLabel.setBaseStyle(getBaseStyle() + "LargeTitle");
titleLabel.setAutoHeight();
titleLabel.setWidth(GuwLayout.ribbonButtonWidth);
outer.addMember(titleLabel);
}
outer.setAlign(Alignment.CENTER);
} else {
setAutoHeight();
outer = new HStack(GuwLayout.ribbonButtonInnerMargin);
outer.setOverflow(Overflow.VISIBLE);
outer.setWidth100();
outer.setAutoHeight();
outer.addMember(icon);
if (showTitles) {
titleLabel.setBaseStyle(getBaseStyle() + "SmallTitle");
titleLabel.setAutoHeight();
titleLabel.setAutoWidth();
outer.addMember(titleLabel);
}
}
}
}
|
[
"protected",
"void",
"updateGui",
"(",
")",
"{",
"ButtonLayoutStyle",
"buttonButtonLayoutStyle",
"=",
"buttonAction",
".",
"getButtonLayoutStyle",
"(",
")",
";",
"if",
"(",
"ButtonLayoutStyle",
".",
"ICON_TITLE_AND_DESCRIPTION",
".",
"equals",
"(",
"buttonButtonLayoutStyle",
")",
")",
"{",
"buildGuiWithDescription",
"(",
")",
";",
"}",
"else",
"{",
"// LayoutParameter.Layout.ICON_AND_TITLE || null || ...",
"setWidth",
"(",
"50",
")",
";",
"if",
"(",
"titleAlignment",
".",
"equals",
"(",
"TitleAlignment",
".",
"BOTTOM",
")",
")",
"{",
"setHeight100",
"(",
")",
";",
"outer",
"=",
"new",
"VStack",
"(",
")",
";",
"outer",
".",
"setOverflow",
"(",
"Overflow",
".",
"VISIBLE",
")",
";",
"outer",
".",
"setWidth",
"(",
"GuwLayout",
".",
"ribbonButtonWidth",
")",
";",
"outer",
".",
"setAutoHeight",
"(",
")",
";",
"outer",
".",
"addMember",
"(",
"icon",
")",
";",
"if",
"(",
"showTitles",
"&&",
"!",
"GuwLayout",
".",
"hideRibbonTitles",
")",
"{",
"titleLabel",
".",
"setBaseStyle",
"(",
"getBaseStyle",
"(",
")",
"+",
"\"LargeTitle\"",
")",
";",
"titleLabel",
".",
"setAutoHeight",
"(",
")",
";",
"titleLabel",
".",
"setWidth",
"(",
"GuwLayout",
".",
"ribbonButtonWidth",
")",
";",
"outer",
".",
"addMember",
"(",
"titleLabel",
")",
";",
"}",
"outer",
".",
"setAlign",
"(",
"Alignment",
".",
"CENTER",
")",
";",
"}",
"else",
"{",
"setAutoHeight",
"(",
")",
";",
"outer",
"=",
"new",
"HStack",
"(",
"GuwLayout",
".",
"ribbonButtonInnerMargin",
")",
";",
"outer",
".",
"setOverflow",
"(",
"Overflow",
".",
"VISIBLE",
")",
";",
"outer",
".",
"setWidth100",
"(",
")",
";",
"outer",
".",
"setAutoHeight",
"(",
")",
";",
"outer",
".",
"addMember",
"(",
"icon",
")",
";",
"if",
"(",
"showTitles",
")",
"{",
"titleLabel",
".",
"setBaseStyle",
"(",
"getBaseStyle",
"(",
")",
"+",
"\"SmallTitle\"",
")",
";",
"titleLabel",
".",
"setAutoHeight",
"(",
")",
";",
"titleLabel",
".",
"setAutoWidth",
"(",
")",
";",
"outer",
".",
"addMember",
"(",
"titleLabel",
")",
";",
"}",
"}",
"}",
"}"
] |
Update the GUI to reflect the settings.
|
[
"Update",
"the",
"GUI",
"to",
"reflect",
"the",
"settings",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/ribbon/RibbonButton.java#L293-L330
|
147,229
|
seedstack/i18n-addon
|
rest/src/it/java/org/seedstack/i18n/internal/infrastructure/jpa/KeyJpaFinderIT.java
|
KeyJpaFinderIT.setUp
|
@Before
public void setUp() {
defineApplicationLocales();
clearKeys();
List<Key> keys = new ArrayList<>();
keys.add(createKey(KEY_DEFAULT, false, false, false));
Key outdatedKey = createKey(KEY_OUTDATED, false, false, false);
outdatedKey.setOutdated();
keys.add(outdatedKey);
keys.add(createKey(KEY_TLN_APPROX, true, false, false));
keys.add(createKey(KEY_TLN_OUTDATED, false, true, false));
keys.add(createKey(KEY_TLN_MISSING, false, false, true));
Key key = keyFactory.createKey(KEY_WITH_MISSING_TRANSLATION);
key.addTranslation(FR, TRANSLATION_FR);
keys.add(key);
for (Key keyToPersist : keys) {
keyRepository.add(keyToPersist);
}
}
|
java
|
@Before
public void setUp() {
defineApplicationLocales();
clearKeys();
List<Key> keys = new ArrayList<>();
keys.add(createKey(KEY_DEFAULT, false, false, false));
Key outdatedKey = createKey(KEY_OUTDATED, false, false, false);
outdatedKey.setOutdated();
keys.add(outdatedKey);
keys.add(createKey(KEY_TLN_APPROX, true, false, false));
keys.add(createKey(KEY_TLN_OUTDATED, false, true, false));
keys.add(createKey(KEY_TLN_MISSING, false, false, true));
Key key = keyFactory.createKey(KEY_WITH_MISSING_TRANSLATION);
key.addTranslation(FR, TRANSLATION_FR);
keys.add(key);
for (Key keyToPersist : keys) {
keyRepository.add(keyToPersist);
}
}
|
[
"@",
"Before",
"public",
"void",
"setUp",
"(",
")",
"{",
"defineApplicationLocales",
"(",
")",
";",
"clearKeys",
"(",
")",
";",
"List",
"<",
"Key",
">",
"keys",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"keys",
".",
"add",
"(",
"createKey",
"(",
"KEY_DEFAULT",
",",
"false",
",",
"false",
",",
"false",
")",
")",
";",
"Key",
"outdatedKey",
"=",
"createKey",
"(",
"KEY_OUTDATED",
",",
"false",
",",
"false",
",",
"false",
")",
";",
"outdatedKey",
".",
"setOutdated",
"(",
")",
";",
"keys",
".",
"add",
"(",
"outdatedKey",
")",
";",
"keys",
".",
"add",
"(",
"createKey",
"(",
"KEY_TLN_APPROX",
",",
"true",
",",
"false",
",",
"false",
")",
")",
";",
"keys",
".",
"add",
"(",
"createKey",
"(",
"KEY_TLN_OUTDATED",
",",
"false",
",",
"true",
",",
"false",
")",
")",
";",
"keys",
".",
"add",
"(",
"createKey",
"(",
"KEY_TLN_MISSING",
",",
"false",
",",
"false",
",",
"true",
")",
")",
";",
"Key",
"key",
"=",
"keyFactory",
".",
"createKey",
"(",
"KEY_WITH_MISSING_TRANSLATION",
")",
";",
"key",
".",
"addTranslation",
"(",
"FR",
",",
"TRANSLATION_FR",
")",
";",
"keys",
".",
"add",
"(",
"key",
")",
";",
"for",
"(",
"Key",
"keyToPersist",
":",
"keys",
")",
"{",
"keyRepository",
".",
"add",
"(",
"keyToPersist",
")",
";",
"}",
"}"
] |
Initializes the test.
|
[
"Initializes",
"the",
"test",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/internal/infrastructure/jpa/KeyJpaFinderIT.java#L68-L92
|
147,230
|
seedstack/i18n-addon
|
rest/src/it/java/org/seedstack/i18n/internal/infrastructure/jpa/KeyJpaFinderIT.java
|
KeyJpaFinderIT.get_missing_default_translation
|
@Test
public void get_missing_default_translation() {
KeySearchCriteria criteria = new KeySearchCriteria(true, null, null, null);
PaginatedView<KeyRepresentation> keyRepresentations = keyFinder
.findKeysWithTheirDefaultTranslation(FIRST_RANGE, criteria);
assertThat(keyRepresentations.getPageSize()).isEqualTo(2);
KeyRepresentation representation = keyRepresentations.getView().get(0);
assertThat(StringUtils.isBlank(representation.getTranslation())).isTrue();
}
|
java
|
@Test
public void get_missing_default_translation() {
KeySearchCriteria criteria = new KeySearchCriteria(true, null, null, null);
PaginatedView<KeyRepresentation> keyRepresentations = keyFinder
.findKeysWithTheirDefaultTranslation(FIRST_RANGE, criteria);
assertThat(keyRepresentations.getPageSize()).isEqualTo(2);
KeyRepresentation representation = keyRepresentations.getView().get(0);
assertThat(StringUtils.isBlank(representation.getTranslation())).isTrue();
}
|
[
"@",
"Test",
"public",
"void",
"get_missing_default_translation",
"(",
")",
"{",
"KeySearchCriteria",
"criteria",
"=",
"new",
"KeySearchCriteria",
"(",
"true",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"PaginatedView",
"<",
"KeyRepresentation",
">",
"keyRepresentations",
"=",
"keyFinder",
".",
"findKeysWithTheirDefaultTranslation",
"(",
"FIRST_RANGE",
",",
"criteria",
")",
";",
"assertThat",
"(",
"keyRepresentations",
".",
"getPageSize",
"(",
")",
")",
".",
"isEqualTo",
"(",
"2",
")",
";",
"KeyRepresentation",
"representation",
"=",
"keyRepresentations",
".",
"getView",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"assertThat",
"(",
"StringUtils",
".",
"isBlank",
"(",
"representation",
".",
"getTranslation",
"(",
")",
")",
")",
".",
"isTrue",
"(",
")",
";",
"}"
] |
Request all the keys marked as missing.
|
[
"Request",
"all",
"the",
"keys",
"marked",
"as",
"missing",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/internal/infrastructure/jpa/KeyJpaFinderIT.java#L121-L131
|
147,231
|
seedstack/i18n-addon
|
rest/src/it/java/org/seedstack/i18n/internal/infrastructure/jpa/KeyJpaFinderIT.java
|
KeyJpaFinderIT.get_approx_default_translation
|
@Test
public void get_approx_default_translation() {
KeySearchCriteria criteria = new KeySearchCriteria(null, true, null, null);
PaginatedView<KeyRepresentation> keyRepresentations = keyFinder
.findKeysWithTheirDefaultTranslation(FIRST_RANGE, criteria);
assertThat(keyRepresentations.getPageSize()).isEqualTo(1);
KeyRepresentation representation = keyRepresentations.getView().get(0);
assertThat(representation.getDefaultLocale()).isEqualTo(EN);
assertThat(representation.getTranslation()).isEqualTo(TRANSLATION_EN);
}
|
java
|
@Test
public void get_approx_default_translation() {
KeySearchCriteria criteria = new KeySearchCriteria(null, true, null, null);
PaginatedView<KeyRepresentation> keyRepresentations = keyFinder
.findKeysWithTheirDefaultTranslation(FIRST_RANGE, criteria);
assertThat(keyRepresentations.getPageSize()).isEqualTo(1);
KeyRepresentation representation = keyRepresentations.getView().get(0);
assertThat(representation.getDefaultLocale()).isEqualTo(EN);
assertThat(representation.getTranslation()).isEqualTo(TRANSLATION_EN);
}
|
[
"@",
"Test",
"public",
"void",
"get_approx_default_translation",
"(",
")",
"{",
"KeySearchCriteria",
"criteria",
"=",
"new",
"KeySearchCriteria",
"(",
"null",
",",
"true",
",",
"null",
",",
"null",
")",
";",
"PaginatedView",
"<",
"KeyRepresentation",
">",
"keyRepresentations",
"=",
"keyFinder",
".",
"findKeysWithTheirDefaultTranslation",
"(",
"FIRST_RANGE",
",",
"criteria",
")",
";",
"assertThat",
"(",
"keyRepresentations",
".",
"getPageSize",
"(",
")",
")",
".",
"isEqualTo",
"(",
"1",
")",
";",
"KeyRepresentation",
"representation",
"=",
"keyRepresentations",
".",
"getView",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"assertThat",
"(",
"representation",
".",
"getDefaultLocale",
"(",
")",
")",
".",
"isEqualTo",
"(",
"EN",
")",
";",
"assertThat",
"(",
"representation",
".",
"getTranslation",
"(",
")",
")",
".",
"isEqualTo",
"(",
"TRANSLATION_EN",
")",
";",
"}"
] |
Request all the keys marked as approximate.
|
[
"Request",
"all",
"the",
"keys",
"marked",
"as",
"approximate",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/internal/infrastructure/jpa/KeyJpaFinderIT.java#L136-L147
|
147,232
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/layer/AbstractLayer.java
|
AbstractLayer.updateShowing
|
protected void updateShowing(boolean fireEvents) {
double scale = mapModel.getMapView().getCurrentScale();
if (visible) {
boolean oldShowing = showing;
showing = scale >= layerInfo.getMinimumScale().getPixelPerUnit()
&& scale <= layerInfo.getMaximumScale().getPixelPerUnit();
if (oldShowing != showing && fireEvents) {
handlerManager.fireEvent(new LayerShownEvent(this, true));
}
} else {
showing = false;
}
}
|
java
|
protected void updateShowing(boolean fireEvents) {
double scale = mapModel.getMapView().getCurrentScale();
if (visible) {
boolean oldShowing = showing;
showing = scale >= layerInfo.getMinimumScale().getPixelPerUnit()
&& scale <= layerInfo.getMaximumScale().getPixelPerUnit();
if (oldShowing != showing && fireEvents) {
handlerManager.fireEvent(new LayerShownEvent(this, true));
}
} else {
showing = false;
}
}
|
[
"protected",
"void",
"updateShowing",
"(",
"boolean",
"fireEvents",
")",
"{",
"double",
"scale",
"=",
"mapModel",
".",
"getMapView",
"(",
")",
".",
"getCurrentScale",
"(",
")",
";",
"if",
"(",
"visible",
")",
"{",
"boolean",
"oldShowing",
"=",
"showing",
";",
"showing",
"=",
"scale",
">=",
"layerInfo",
".",
"getMinimumScale",
"(",
")",
".",
"getPixelPerUnit",
"(",
")",
"&&",
"scale",
"<=",
"layerInfo",
".",
"getMaximumScale",
"(",
")",
".",
"getPixelPerUnit",
"(",
")",
";",
"if",
"(",
"oldShowing",
"!=",
"showing",
"&&",
"fireEvents",
")",
"{",
"handlerManager",
".",
"fireEvent",
"(",
"new",
"LayerShownEvent",
"(",
"this",
",",
"true",
")",
")",
";",
"}",
"}",
"else",
"{",
"showing",
"=",
"false",
";",
"}",
"}"
] |
Update showing state.
@param fireEvents Should events be fired if state changes?
|
[
"Update",
"showing",
"state",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/layer/AbstractLayer.java#L130-L142
|
147,233
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/layer/AbstractLayer.java
|
AbstractLayer.setVisible
|
@Api
public void setVisible(boolean visible) {
if (visible != this.visible) {
this.visible = visible;
updateShowing(false);
handlerManager.fireEvent(new LayerShownEvent(this));
}
}
|
java
|
@Api
public void setVisible(boolean visible) {
if (visible != this.visible) {
this.visible = visible;
updateShowing(false);
handlerManager.fireEvent(new LayerShownEvent(this));
}
}
|
[
"@",
"Api",
"public",
"void",
"setVisible",
"(",
"boolean",
"visible",
")",
"{",
"if",
"(",
"visible",
"!=",
"this",
".",
"visible",
")",
"{",
"this",
".",
"visible",
"=",
"visible",
";",
"updateShowing",
"(",
"false",
")",
";",
"handlerManager",
".",
"fireEvent",
"(",
"new",
"LayerShownEvent",
"(",
"this",
")",
")",
";",
"}",
"}"
] |
Make the layer visible or invisible.
@param visible
the visible to set
@since 1.10.0
|
[
"Make",
"the",
"layer",
"visible",
"or",
"invisible",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/layer/AbstractLayer.java#L268-L275
|
147,234
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/SearchCommService.java
|
SearchCommService.mergeAndBufferGeometries
|
public static void mergeAndBufferGeometries(List<Geometry> geometries, double buffer,
final DataCallback<Geometry[]> onFinished) {
GeometryUtilsRequest request = new GeometryUtilsRequest();
request.setActionFlags(GeometryUtilsRequest.ACTION_BUFFER | GeometryUtilsRequest.ACTION_MERGE);
request.setIntermediateResults(true);
request.setBuffer(buffer);
request.setGeometries(toDtoGeometries(geometries));
GwtCommand command = new GwtCommand(GeometryUtilsRequest.COMMAND);
command.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<GeometryUtilsResponse>() {
public void execute(GeometryUtilsResponse response) {
if (onFinished != null) {
Geometry[] geoms = new Geometry[2];
geoms[0] = GeometryConverter.toGwt(response.getGeometries()[0]);
geoms[1] = GeometryConverter.toGwt(response.getGeometries()[1]);
onFinished.execute(geoms);
}
}
});
}
|
java
|
public static void mergeAndBufferGeometries(List<Geometry> geometries, double buffer,
final DataCallback<Geometry[]> onFinished) {
GeometryUtilsRequest request = new GeometryUtilsRequest();
request.setActionFlags(GeometryUtilsRequest.ACTION_BUFFER | GeometryUtilsRequest.ACTION_MERGE);
request.setIntermediateResults(true);
request.setBuffer(buffer);
request.setGeometries(toDtoGeometries(geometries));
GwtCommand command = new GwtCommand(GeometryUtilsRequest.COMMAND);
command.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<GeometryUtilsResponse>() {
public void execute(GeometryUtilsResponse response) {
if (onFinished != null) {
Geometry[] geoms = new Geometry[2];
geoms[0] = GeometryConverter.toGwt(response.getGeometries()[0]);
geoms[1] = GeometryConverter.toGwt(response.getGeometries()[1]);
onFinished.execute(geoms);
}
}
});
}
|
[
"public",
"static",
"void",
"mergeAndBufferGeometries",
"(",
"List",
"<",
"Geometry",
">",
"geometries",
",",
"double",
"buffer",
",",
"final",
"DataCallback",
"<",
"Geometry",
"[",
"]",
">",
"onFinished",
")",
"{",
"GeometryUtilsRequest",
"request",
"=",
"new",
"GeometryUtilsRequest",
"(",
")",
";",
"request",
".",
"setActionFlags",
"(",
"GeometryUtilsRequest",
".",
"ACTION_BUFFER",
"|",
"GeometryUtilsRequest",
".",
"ACTION_MERGE",
")",
";",
"request",
".",
"setIntermediateResults",
"(",
"true",
")",
";",
"request",
".",
"setBuffer",
"(",
"buffer",
")",
";",
"request",
".",
"setGeometries",
"(",
"toDtoGeometries",
"(",
"geometries",
")",
")",
";",
"GwtCommand",
"command",
"=",
"new",
"GwtCommand",
"(",
"GeometryUtilsRequest",
".",
"COMMAND",
")",
";",
"command",
".",
"setCommandRequest",
"(",
"request",
")",
";",
"GwtCommandDispatcher",
".",
"getInstance",
"(",
")",
".",
"execute",
"(",
"command",
",",
"new",
"AbstractCommandCallback",
"<",
"GeometryUtilsResponse",
">",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
"GeometryUtilsResponse",
"response",
")",
"{",
"if",
"(",
"onFinished",
"!=",
"null",
")",
"{",
"Geometry",
"[",
"]",
"geoms",
"=",
"new",
"Geometry",
"[",
"2",
"]",
";",
"geoms",
"[",
"0",
"]",
"=",
"GeometryConverter",
".",
"toGwt",
"(",
"response",
".",
"getGeometries",
"(",
")",
"[",
"0",
"]",
")",
";",
"geoms",
"[",
"1",
"]",
"=",
"GeometryConverter",
".",
"toGwt",
"(",
"response",
".",
"getGeometries",
"(",
")",
"[",
"1",
"]",
")",
";",
"onFinished",
".",
"execute",
"(",
"geoms",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] |
The returned result will contain a merged-only and a merged and buffered result.
@param geometries geometries
@param buffer buffer size
@param onFinished
callback contains two geometries, one just merged, one buffered
|
[
"The",
"returned",
"result",
"will",
"contain",
"a",
"merged",
"-",
"only",
"and",
"a",
"merged",
"and",
"buffered",
"result",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/SearchCommService.java#L75-L95
|
147,235
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/SearchCommService.java
|
SearchCommService.searchByCriterion
|
public static void searchByCriterion(final Criterion criterion, final MapWidget mapWidget,
final DataCallback<Map<VectorLayer, List<Feature>>> onFinished, final Runnable onError) {
FeatureSearchRequest request = new FeatureSearchRequest();
request.setMapCrs(mapWidget.getMapModel().getCrs());
request.setCriterion(criterion);
request.setLayerFilters(getLayerFiltersForCriterion(criterion, mapWidget.getMapModel()));
request.setFeatureIncludes(featureIncludes);
request.setMax(searchResultSize);
GwtCommand commandRequest = new GwtCommand(FeatureSearchRequest.COMMAND);
commandRequest.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(commandRequest,
new AbstractCommandCallback<FeatureSearchResponse>() {
public void execute(FeatureSearchResponse response) {
onFinished.execute(convertFromDto(response.getFeatureMap(), mapWidget.getMapModel()));
}
@Override
public void onCommunicationException(Throwable error) {
if (null != onError) {
onError.run();
} else {
super.onCommunicationException(error);
}
}
});
}
|
java
|
public static void searchByCriterion(final Criterion criterion, final MapWidget mapWidget,
final DataCallback<Map<VectorLayer, List<Feature>>> onFinished, final Runnable onError) {
FeatureSearchRequest request = new FeatureSearchRequest();
request.setMapCrs(mapWidget.getMapModel().getCrs());
request.setCriterion(criterion);
request.setLayerFilters(getLayerFiltersForCriterion(criterion, mapWidget.getMapModel()));
request.setFeatureIncludes(featureIncludes);
request.setMax(searchResultSize);
GwtCommand commandRequest = new GwtCommand(FeatureSearchRequest.COMMAND);
commandRequest.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(commandRequest,
new AbstractCommandCallback<FeatureSearchResponse>() {
public void execute(FeatureSearchResponse response) {
onFinished.execute(convertFromDto(response.getFeatureMap(), mapWidget.getMapModel()));
}
@Override
public void onCommunicationException(Throwable error) {
if (null != onError) {
onError.run();
} else {
super.onCommunicationException(error);
}
}
});
}
|
[
"public",
"static",
"void",
"searchByCriterion",
"(",
"final",
"Criterion",
"criterion",
",",
"final",
"MapWidget",
"mapWidget",
",",
"final",
"DataCallback",
"<",
"Map",
"<",
"VectorLayer",
",",
"List",
"<",
"Feature",
">",
">",
">",
"onFinished",
",",
"final",
"Runnable",
"onError",
")",
"{",
"FeatureSearchRequest",
"request",
"=",
"new",
"FeatureSearchRequest",
"(",
")",
";",
"request",
".",
"setMapCrs",
"(",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getCrs",
"(",
")",
")",
";",
"request",
".",
"setCriterion",
"(",
"criterion",
")",
";",
"request",
".",
"setLayerFilters",
"(",
"getLayerFiltersForCriterion",
"(",
"criterion",
",",
"mapWidget",
".",
"getMapModel",
"(",
")",
")",
")",
";",
"request",
".",
"setFeatureIncludes",
"(",
"featureIncludes",
")",
";",
"request",
".",
"setMax",
"(",
"searchResultSize",
")",
";",
"GwtCommand",
"commandRequest",
"=",
"new",
"GwtCommand",
"(",
"FeatureSearchRequest",
".",
"COMMAND",
")",
";",
"commandRequest",
".",
"setCommandRequest",
"(",
"request",
")",
";",
"GwtCommandDispatcher",
".",
"getInstance",
"(",
")",
".",
"execute",
"(",
"commandRequest",
",",
"new",
"AbstractCommandCallback",
"<",
"FeatureSearchResponse",
">",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
"FeatureSearchResponse",
"response",
")",
"{",
"onFinished",
".",
"execute",
"(",
"convertFromDto",
"(",
"response",
".",
"getFeatureMap",
"(",
")",
",",
"mapWidget",
".",
"getMapModel",
"(",
")",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"onCommunicationException",
"(",
"Throwable",
"error",
")",
"{",
"if",
"(",
"null",
"!=",
"onError",
")",
"{",
"onError",
".",
"run",
"(",
")",
";",
"}",
"else",
"{",
"super",
".",
"onCommunicationException",
"(",
"error",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] |
Execute a search by criterion command.
@param criterion criterion
@param mapWidget map widget
@param onFinished callback
@param onError
callback to execute in case of error, optional use null if you
don't need it
|
[
"Execute",
"a",
"search",
"by",
"criterion",
"command",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/SearchCommService.java#L197-L223
|
147,236
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/SearchCommService.java
|
SearchCommService.getLayerFiltersForCriterion
|
public static Map<String, String> getLayerFiltersForCriterion(Criterion critter, MapModel mapModel) {
Map<String, String> filters = new HashMap<String, String>();
Set<String> serverLayerIds = new HashSet<String>();
critter.serverLayerIdVisitor(serverLayerIds);
for (VectorLayer vectorLayer : mapModel.getVectorLayers()) {
if (serverLayerIds.contains(vectorLayer.getServerLayerId())) {
if (vectorLayer.getFilter() != null && !"".equals(vectorLayer.getFilter())) {
filters.put(vectorLayer.getServerLayerId(), vectorLayer.getFilter());
}
}
}
return filters;
}
|
java
|
public static Map<String, String> getLayerFiltersForCriterion(Criterion critter, MapModel mapModel) {
Map<String, String> filters = new HashMap<String, String>();
Set<String> serverLayerIds = new HashSet<String>();
critter.serverLayerIdVisitor(serverLayerIds);
for (VectorLayer vectorLayer : mapModel.getVectorLayers()) {
if (serverLayerIds.contains(vectorLayer.getServerLayerId())) {
if (vectorLayer.getFilter() != null && !"".equals(vectorLayer.getFilter())) {
filters.put(vectorLayer.getServerLayerId(), vectorLayer.getFilter());
}
}
}
return filters;
}
|
[
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getLayerFiltersForCriterion",
"(",
"Criterion",
"critter",
",",
"MapModel",
"mapModel",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"filters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"Set",
"<",
"String",
">",
"serverLayerIds",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"critter",
".",
"serverLayerIdVisitor",
"(",
"serverLayerIds",
")",
";",
"for",
"(",
"VectorLayer",
"vectorLayer",
":",
"mapModel",
".",
"getVectorLayers",
"(",
")",
")",
"{",
"if",
"(",
"serverLayerIds",
".",
"contains",
"(",
"vectorLayer",
".",
"getServerLayerId",
"(",
")",
")",
")",
"{",
"if",
"(",
"vectorLayer",
".",
"getFilter",
"(",
")",
"!=",
"null",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"vectorLayer",
".",
"getFilter",
"(",
")",
")",
")",
"{",
"filters",
".",
"put",
"(",
"vectorLayer",
".",
"getServerLayerId",
"(",
")",
",",
"vectorLayer",
".",
"getFilter",
"(",
")",
")",
";",
"}",
"}",
"}",
"return",
"filters",
";",
"}"
] |
Builds a map with the filters for all layers that are used in the given criterion.
@param critter criterion
@param mapModel map model
@return filters for all layers
|
[
"Builds",
"a",
"map",
"with",
"the",
"filters",
"for",
"all",
"layers",
"that",
"are",
"used",
"in",
"the",
"given",
"criterion",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/SearchCommService.java#L232-L245
|
147,237
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/SearchCommService.java
|
SearchCommService.convertFromDto
|
private static Map<VectorLayer, List<Feature>> convertFromDto(
Map<String, List<org.geomajas.layer.feature.Feature>> dtoFeatures, MapModel model) {
Map<VectorLayer, List<Feature>> result = new LinkedHashMap<VectorLayer, List<Feature>>();
for (Entry<String, List<org.geomajas.layer.feature.Feature>> entry : dtoFeatures.entrySet()) {
if (!entry.getValue().isEmpty()) {
List<Feature> convertedFeatures = new ArrayList<Feature>();
VectorLayer layer = convertFromDto(entry.getKey(), entry.getValue(), convertedFeatures, model);
if (layer != null) {
result.put(layer, convertedFeatures);
} else {
// TODO couldn't find layer client-side ?? maybe should throw an error here
GWT.log("Couldn't find layer client-side ?? " + entry.getKey());
}
}
}
return result;
}
|
java
|
private static Map<VectorLayer, List<Feature>> convertFromDto(
Map<String, List<org.geomajas.layer.feature.Feature>> dtoFeatures, MapModel model) {
Map<VectorLayer, List<Feature>> result = new LinkedHashMap<VectorLayer, List<Feature>>();
for (Entry<String, List<org.geomajas.layer.feature.Feature>> entry : dtoFeatures.entrySet()) {
if (!entry.getValue().isEmpty()) {
List<Feature> convertedFeatures = new ArrayList<Feature>();
VectorLayer layer = convertFromDto(entry.getKey(), entry.getValue(), convertedFeatures, model);
if (layer != null) {
result.put(layer, convertedFeatures);
} else {
// TODO couldn't find layer client-side ?? maybe should throw an error here
GWT.log("Couldn't find layer client-side ?? " + entry.getKey());
}
}
}
return result;
}
|
[
"private",
"static",
"Map",
"<",
"VectorLayer",
",",
"List",
"<",
"Feature",
">",
">",
"convertFromDto",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"org",
".",
"geomajas",
".",
"layer",
".",
"feature",
".",
"Feature",
">",
">",
"dtoFeatures",
",",
"MapModel",
"model",
")",
"{",
"Map",
"<",
"VectorLayer",
",",
"List",
"<",
"Feature",
">",
">",
"result",
"=",
"new",
"LinkedHashMap",
"<",
"VectorLayer",
",",
"List",
"<",
"Feature",
">",
">",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"List",
"<",
"org",
".",
"geomajas",
".",
"layer",
".",
"feature",
".",
"Feature",
">",
">",
"entry",
":",
"dtoFeatures",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"!",
"entry",
".",
"getValue",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"List",
"<",
"Feature",
">",
"convertedFeatures",
"=",
"new",
"ArrayList",
"<",
"Feature",
">",
"(",
")",
";",
"VectorLayer",
"layer",
"=",
"convertFromDto",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
",",
"convertedFeatures",
",",
"model",
")",
";",
"if",
"(",
"layer",
"!=",
"null",
")",
"{",
"result",
".",
"put",
"(",
"layer",
",",
"convertedFeatures",
")",
";",
"}",
"else",
"{",
"// TODO couldn't find layer client-side ?? maybe should throw an error here",
"GWT",
".",
"log",
"(",
"\"Couldn't find layer client-side ?? \"",
"+",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] |
This also adds the features to their respective layers, so no need to do
that anymore.
@param dtoFeatures DTOPs for features
@param model map model
@return client features
|
[
"This",
"also",
"adds",
"the",
"features",
"to",
"their",
"respective",
"layers",
"so",
"no",
"need",
"to",
"do",
"that",
"anymore",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/SearchCommService.java#L257-L273
|
147,238
|
geomajas/geomajas-project-client-gwt
|
plugin/print/print-gwt/src/main/java/org/geomajas/plugin/printing/client/util/UrlBuilder.java
|
UrlBuilder.addPath
|
public UrlBuilder addPath(String path) {
if (path.charAt(0) == '/' && baseUrl.endsWith("/")) {
baseUrl = baseUrl + path.substring(1);
} else {
baseUrl = baseUrl + path;
}
return this;
}
|
java
|
public UrlBuilder addPath(String path) {
if (path.charAt(0) == '/' && baseUrl.endsWith("/")) {
baseUrl = baseUrl + path.substring(1);
} else {
baseUrl = baseUrl + path;
}
return this;
}
|
[
"public",
"UrlBuilder",
"addPath",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"path",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
"&&",
"baseUrl",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"baseUrl",
"=",
"baseUrl",
"+",
"path",
".",
"substring",
"(",
"1",
")",
";",
"}",
"else",
"{",
"baseUrl",
"=",
"baseUrl",
"+",
"path",
";",
"}",
"return",
"this",
";",
"}"
] |
Add a path extension.
@param path
path
@return this to allow concatenation
|
[
"Add",
"a",
"path",
"extension",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/print/print-gwt/src/main/java/org/geomajas/plugin/printing/client/util/UrlBuilder.java#L59-L66
|
147,239
|
seedstack/i18n-addon
|
rest/src/main/java/org/seedstack/i18n/rest/internal/locale/AvailableLocalesResource.java
|
AvailableLocalesResource.getAvailableLocales
|
@GET
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.LOCALE_READ)
public Response getAvailableLocales() {
List<LocaleRepresentation> availableLocales = localeFinder.findAvailableLocales();
if (!availableLocales.isEmpty()) {
return Response.ok(availableLocales).build();
}
return Response.noContent().build();
}
|
java
|
@GET
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.LOCALE_READ)
public Response getAvailableLocales() {
List<LocaleRepresentation> availableLocales = localeFinder.findAvailableLocales();
if (!availableLocales.isEmpty()) {
return Response.ok(availableLocales).build();
}
return Response.noContent().build();
}
|
[
"@",
"GET",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"RequiresPermissions",
"(",
"I18nPermissions",
".",
"LOCALE_READ",
")",
"public",
"Response",
"getAvailableLocales",
"(",
")",
"{",
"List",
"<",
"LocaleRepresentation",
">",
"availableLocales",
"=",
"localeFinder",
".",
"findAvailableLocales",
"(",
")",
";",
"if",
"(",
"!",
"availableLocales",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Response",
".",
"ok",
"(",
"availableLocales",
")",
".",
"build",
"(",
")",
";",
"}",
"return",
"Response",
".",
"noContent",
"(",
")",
".",
"build",
"(",
")",
";",
"}"
] |
Gets all the locales available in the application.
@return list of locale representation or 204 (no content)
|
[
"Gets",
"all",
"the",
"locales",
"available",
"in",
"the",
"application",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/locale/AvailableLocalesResource.java#L68-L77
|
147,240
|
seedstack/i18n-addon
|
rest/src/main/java/org/seedstack/i18n/rest/internal/locale/AvailableLocalesResource.java
|
AvailableLocalesResource.getAvailableLocale
|
@GET
@Path("/{localeId}")
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.LOCALE_READ)
public Response getAvailableLocale(@PathParam("localeId") String localeId) {
WebAssertions.assertNotBlank(localeId, LOCALE_SHOULD_NOT_BE_BLANK);
LocaleRepresentation availableLocale = localeFinder.findAvailableLocale(localeId);
if (availableLocale != null) {
return Response.ok(availableLocale).build();
}
return Response.status(Response.Status.NOT_FOUND).build();
}
|
java
|
@GET
@Path("/{localeId}")
@Produces(MediaType.APPLICATION_JSON)
@RequiresPermissions(I18nPermissions.LOCALE_READ)
public Response getAvailableLocale(@PathParam("localeId") String localeId) {
WebAssertions.assertNotBlank(localeId, LOCALE_SHOULD_NOT_BE_BLANK);
LocaleRepresentation availableLocale = localeFinder.findAvailableLocale(localeId);
if (availableLocale != null) {
return Response.ok(availableLocale).build();
}
return Response.status(Response.Status.NOT_FOUND).build();
}
|
[
"@",
"GET",
"@",
"Path",
"(",
"\"/{localeId}\"",
")",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"RequiresPermissions",
"(",
"I18nPermissions",
".",
"LOCALE_READ",
")",
"public",
"Response",
"getAvailableLocale",
"(",
"@",
"PathParam",
"(",
"\"localeId\"",
")",
"String",
"localeId",
")",
"{",
"WebAssertions",
".",
"assertNotBlank",
"(",
"localeId",
",",
"LOCALE_SHOULD_NOT_BE_BLANK",
")",
";",
"LocaleRepresentation",
"availableLocale",
"=",
"localeFinder",
".",
"findAvailableLocale",
"(",
"localeId",
")",
";",
"if",
"(",
"availableLocale",
"!=",
"null",
")",
"{",
"return",
"Response",
".",
"ok",
"(",
"availableLocale",
")",
".",
"build",
"(",
")",
";",
"}",
"return",
"Response",
".",
"status",
"(",
"Response",
".",
"Status",
".",
"NOT_FOUND",
")",
".",
"build",
"(",
")",
";",
"}"
] |
Gets the requested locale, if it is available in the application.
@param localeId locale code
@return http status code 200 (ok) with the locale or 404 if the locale is not available.
|
[
"Gets",
"the",
"requested",
"locale",
"if",
"it",
"is",
"available",
"in",
"the",
"application",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/locale/AvailableLocalesResource.java#L85-L96
|
147,241
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapViewState.java
|
MapViewState.isPannableFrom
|
public boolean isPannableFrom(MapViewState other) {
return Math.abs(scale - other.getScale()) < EQUAL_CHECK_DELTA
&& Math.abs(getPanX() - other.getPanX()) < EQUAL_CHECK_DELTA
&& Math.abs(getPanY() - other.getPanY()) < EQUAL_CHECK_DELTA;
}
|
java
|
public boolean isPannableFrom(MapViewState other) {
return Math.abs(scale - other.getScale()) < EQUAL_CHECK_DELTA
&& Math.abs(getPanX() - other.getPanX()) < EQUAL_CHECK_DELTA
&& Math.abs(getPanY() - other.getPanY()) < EQUAL_CHECK_DELTA;
}
|
[
"public",
"boolean",
"isPannableFrom",
"(",
"MapViewState",
"other",
")",
"{",
"return",
"Math",
".",
"abs",
"(",
"scale",
"-",
"other",
".",
"getScale",
"(",
")",
")",
"<",
"EQUAL_CHECK_DELTA",
"&&",
"Math",
".",
"abs",
"(",
"getPanX",
"(",
")",
"-",
"other",
".",
"getPanX",
"(",
")",
")",
"<",
"EQUAL_CHECK_DELTA",
"&&",
"Math",
".",
"abs",
"(",
"getPanY",
"(",
")",
"-",
"other",
".",
"getPanY",
"(",
")",
")",
"<",
"EQUAL_CHECK_DELTA",
";",
"}"
] |
Can this view state be reached by panning from another view state ?
@param viewState the view state to compare with
@return true if reachable by panning
|
[
"Can",
"this",
"view",
"state",
"be",
"reached",
"by",
"panning",
"from",
"another",
"view",
"state",
"?"
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapViewState.java#L97-L101
|
147,242
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/layer/RasterLayer.java
|
RasterLayer.setOpacity
|
public void setOpacity(double opacity) {
getLayerInfo().setStyle(Double.toString(opacity));
handlerManager.fireEvent(new LayerStyleChangeEvent(this));
}
|
java
|
public void setOpacity(double opacity) {
getLayerInfo().setStyle(Double.toString(opacity));
handlerManager.fireEvent(new LayerStyleChangeEvent(this));
}
|
[
"public",
"void",
"setOpacity",
"(",
"double",
"opacity",
")",
"{",
"getLayerInfo",
"(",
")",
".",
"setStyle",
"(",
"Double",
".",
"toString",
"(",
"opacity",
")",
")",
";",
"handlerManager",
".",
"fireEvent",
"(",
"new",
"LayerStyleChangeEvent",
"(",
"this",
")",
")",
";",
"}"
] |
Apply a new opacity on the entire raster layer.
@param opacity The new opacity value. Must be a value between 0 and 1, where 0 means invisible and 1 is totally
visible.
@since 1.8.0
|
[
"Apply",
"a",
"new",
"opacity",
"on",
"the",
"entire",
"raster",
"layer",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/layer/RasterLayer.java#L81-L84
|
147,243
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/WorldViewTransformer.java
|
WorldViewTransformer.viewToPan
|
public Coordinate viewToPan(Coordinate coordinate) {
if (coordinate != null) {
Vector2D position = new Vector2D(coordinate);
double scale = mapView.getCurrentScale();
Coordinate panOrigin = mapView.getPanOrigin();
double translateX = (mapView.getViewState().getX() - panOrigin.getX()) * scale - (mapView.getWidth() / 2);
double translateY = -(mapView.getViewState().getY() - panOrigin.getY()) * scale - (mapView.getHeight() / 2);
position.translate(translateX , translateY);
// TODO: implement rotation support.
return new Coordinate(position.getX(), position.getY());
}
return null;
}
|
java
|
public Coordinate viewToPan(Coordinate coordinate) {
if (coordinate != null) {
Vector2D position = new Vector2D(coordinate);
double scale = mapView.getCurrentScale();
Coordinate panOrigin = mapView.getPanOrigin();
double translateX = (mapView.getViewState().getX() - panOrigin.getX()) * scale - (mapView.getWidth() / 2);
double translateY = -(mapView.getViewState().getY() - panOrigin.getY()) * scale - (mapView.getHeight() / 2);
position.translate(translateX , translateY);
// TODO: implement rotation support.
return new Coordinate(position.getX(), position.getY());
}
return null;
}
|
[
"public",
"Coordinate",
"viewToPan",
"(",
"Coordinate",
"coordinate",
")",
"{",
"if",
"(",
"coordinate",
"!=",
"null",
")",
"{",
"Vector2D",
"position",
"=",
"new",
"Vector2D",
"(",
"coordinate",
")",
";",
"double",
"scale",
"=",
"mapView",
".",
"getCurrentScale",
"(",
")",
";",
"Coordinate",
"panOrigin",
"=",
"mapView",
".",
"getPanOrigin",
"(",
")",
";",
"double",
"translateX",
"=",
"(",
"mapView",
".",
"getViewState",
"(",
")",
".",
"getX",
"(",
")",
"-",
"panOrigin",
".",
"getX",
"(",
")",
")",
"*",
"scale",
"-",
"(",
"mapView",
".",
"getWidth",
"(",
")",
"/",
"2",
")",
";",
"double",
"translateY",
"=",
"-",
"(",
"mapView",
".",
"getViewState",
"(",
")",
".",
"getY",
"(",
")",
"-",
"panOrigin",
".",
"getY",
"(",
")",
")",
"*",
"scale",
"-",
"(",
"mapView",
".",
"getHeight",
"(",
")",
"/",
"2",
")",
";",
"position",
".",
"translate",
"(",
"translateX",
",",
"translateY",
")",
";",
"// TODO: implement rotation support.",
"return",
"new",
"Coordinate",
"(",
"position",
".",
"getX",
"(",
")",
",",
"position",
".",
"getY",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Transform a coordinate from view space to pan space.
@param coordinate
The views pace coordinate.
@return Returns the pan space equivalent of the given coordinate.
|
[
"Transform",
"a",
"coordinate",
"from",
"view",
"space",
"to",
"pan",
"space",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/WorldViewTransformer.java#L234-L247
|
147,244
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/WorldViewTransformer.java
|
WorldViewTransformer.viewToWorld
|
public Coordinate viewToWorld(Coordinate coordinate) {
if (coordinate != null) {
Vector2D position = new Vector2D(coordinate);
double inverseScale = 1 / mapView.getCurrentScale();
position.scale(inverseScale, -inverseScale);
Bbox bounds = mapView.getBounds();
// -cam: center X axis around cam. +bbox.w/2: to place the origin in the center of the screen
double translateX = -mapView.getViewState().getX() + (bounds.getWidth() / 2);
double translateY = -mapView.getViewState().getY() - (bounds.getHeight() / 2); // Inverted Y-axis here...
position.translate(-translateX, -translateY);
// TODO: implement rotation support.
return new Coordinate(position.getX(), position.getY());
}
return null;
}
|
java
|
public Coordinate viewToWorld(Coordinate coordinate) {
if (coordinate != null) {
Vector2D position = new Vector2D(coordinate);
double inverseScale = 1 / mapView.getCurrentScale();
position.scale(inverseScale, -inverseScale);
Bbox bounds = mapView.getBounds();
// -cam: center X axis around cam. +bbox.w/2: to place the origin in the center of the screen
double translateX = -mapView.getViewState().getX() + (bounds.getWidth() / 2);
double translateY = -mapView.getViewState().getY() - (bounds.getHeight() / 2); // Inverted Y-axis here...
position.translate(-translateX, -translateY);
// TODO: implement rotation support.
return new Coordinate(position.getX(), position.getY());
}
return null;
}
|
[
"public",
"Coordinate",
"viewToWorld",
"(",
"Coordinate",
"coordinate",
")",
"{",
"if",
"(",
"coordinate",
"!=",
"null",
")",
"{",
"Vector2D",
"position",
"=",
"new",
"Vector2D",
"(",
"coordinate",
")",
";",
"double",
"inverseScale",
"=",
"1",
"/",
"mapView",
".",
"getCurrentScale",
"(",
")",
";",
"position",
".",
"scale",
"(",
"inverseScale",
",",
"-",
"inverseScale",
")",
";",
"Bbox",
"bounds",
"=",
"mapView",
".",
"getBounds",
"(",
")",
";",
"// -cam: center X axis around cam. +bbox.w/2: to place the origin in the center of the screen",
"double",
"translateX",
"=",
"-",
"mapView",
".",
"getViewState",
"(",
")",
".",
"getX",
"(",
")",
"+",
"(",
"bounds",
".",
"getWidth",
"(",
")",
"/",
"2",
")",
";",
"double",
"translateY",
"=",
"-",
"mapView",
".",
"getViewState",
"(",
")",
".",
"getY",
"(",
")",
"-",
"(",
"bounds",
".",
"getHeight",
"(",
")",
"/",
"2",
")",
";",
"// Inverted Y-axis here...",
"position",
".",
"translate",
"(",
"-",
"translateX",
",",
"-",
"translateY",
")",
";",
"// TODO: implement rotation support.",
"return",
"new",
"Coordinate",
"(",
"position",
".",
"getX",
"(",
")",
",",
"position",
".",
"getY",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Transform a coordinate from view space to world space.
@param coordinate
The views pace coordinate.
@return Returns the world space equivalent of the given coordinate.
|
[
"Transform",
"a",
"coordinate",
"from",
"view",
"space",
"to",
"world",
"space",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/WorldViewTransformer.java#L315-L330
|
147,245
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/gfx/paintable/mapaddon/MapAddon.java
|
MapAddon.setMapSize
|
public void setMapSize(int mapWidth, int mapHeight) {
double x = horizontalMargin;
double y = verticalMargin;
// Calculate horizontal position:
switch (alignment) {
case LEFT:
break;
case CENTER:
x = Math.round((mapWidth - width) / 2);
break;
case RIGHT:
x = mapWidth - width - horizontalMargin;
}
// Calculate vertical position:
switch (verticalAlignment) {
case TOP:
break;
case CENTER:
y = Math.round((mapHeight - height) / 2);
break;
case BOTTOM:
y = mapHeight - height - verticalMargin;
}
upperLeftCorner = new Coordinate(x, y);
}
|
java
|
public void setMapSize(int mapWidth, int mapHeight) {
double x = horizontalMargin;
double y = verticalMargin;
// Calculate horizontal position:
switch (alignment) {
case LEFT:
break;
case CENTER:
x = Math.round((mapWidth - width) / 2);
break;
case RIGHT:
x = mapWidth - width - horizontalMargin;
}
// Calculate vertical position:
switch (verticalAlignment) {
case TOP:
break;
case CENTER:
y = Math.round((mapHeight - height) / 2);
break;
case BOTTOM:
y = mapHeight - height - verticalMargin;
}
upperLeftCorner = new Coordinate(x, y);
}
|
[
"public",
"void",
"setMapSize",
"(",
"int",
"mapWidth",
",",
"int",
"mapHeight",
")",
"{",
"double",
"x",
"=",
"horizontalMargin",
";",
"double",
"y",
"=",
"verticalMargin",
";",
"// Calculate horizontal position:",
"switch",
"(",
"alignment",
")",
"{",
"case",
"LEFT",
":",
"break",
";",
"case",
"CENTER",
":",
"x",
"=",
"Math",
".",
"round",
"(",
"(",
"mapWidth",
"-",
"width",
")",
"/",
"2",
")",
";",
"break",
";",
"case",
"RIGHT",
":",
"x",
"=",
"mapWidth",
"-",
"width",
"-",
"horizontalMargin",
";",
"}",
"// Calculate vertical position:",
"switch",
"(",
"verticalAlignment",
")",
"{",
"case",
"TOP",
":",
"break",
";",
"case",
"CENTER",
":",
"y",
"=",
"Math",
".",
"round",
"(",
"(",
"mapHeight",
"-",
"height",
")",
"/",
"2",
")",
";",
"break",
";",
"case",
"BOTTOM",
":",
"y",
"=",
"mapHeight",
"-",
"height",
"-",
"verticalMargin",
";",
"}",
"upperLeftCorner",
"=",
"new",
"Coordinate",
"(",
"x",
",",
"y",
")",
";",
"}"
] |
Apply a new width and height for the map onto whom this add-on is drawn. This method is triggered automatically
when the map resizes.
@param mapWidth
The map's new width.
@param mapHeight
The map's new height.
|
[
"Apply",
"a",
"new",
"width",
"and",
"height",
"for",
"the",
"map",
"onto",
"whom",
"this",
"add",
"-",
"on",
"is",
"drawn",
".",
"This",
"method",
"is",
"triggered",
"automatically",
"when",
"the",
"map",
"resizes",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/paintable/mapaddon/MapAddon.java#L99-L126
|
147,246
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/Mathlib.java
|
Mathlib.lineIntersects
|
public static boolean lineIntersects(Coordinate c1, Coordinate c2, Coordinate c3, Coordinate c4) {
LineSegment ls1 = new LineSegment(c1, c2);
LineSegment ls2 = new LineSegment(c3, c4);
return ls1.intersects(ls2);
}
|
java
|
public static boolean lineIntersects(Coordinate c1, Coordinate c2, Coordinate c3, Coordinate c4) {
LineSegment ls1 = new LineSegment(c1, c2);
LineSegment ls2 = new LineSegment(c3, c4);
return ls1.intersects(ls2);
}
|
[
"public",
"static",
"boolean",
"lineIntersects",
"(",
"Coordinate",
"c1",
",",
"Coordinate",
"c2",
",",
"Coordinate",
"c3",
",",
"Coordinate",
"c4",
")",
"{",
"LineSegment",
"ls1",
"=",
"new",
"LineSegment",
"(",
"c1",
",",
"c2",
")",
";",
"LineSegment",
"ls2",
"=",
"new",
"LineSegment",
"(",
"c3",
",",
"c4",
")",
";",
"return",
"ls1",
".",
"intersects",
"(",
"ls2",
")",
";",
"}"
] |
Calculates whether or not 2 line-segments intersect.
@param c1
First coordinate of the first line-segment.
@param c2
Second coordinate of the first line-segment.
@param c3
First coordinate of the second line-segment.
@param c4
Second coordinate of the second line-segment.
@return Returns true or false.
|
[
"Calculates",
"whether",
"or",
"not",
"2",
"line",
"-",
"segments",
"intersect",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Mathlib.java#L45-L49
|
147,247
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/Mathlib.java
|
Mathlib.lineSegmentIntersection
|
public Coordinate lineSegmentIntersection(Coordinate c1, Coordinate c2, Coordinate c3, Coordinate c4) {
LineSegment ls1 = new LineSegment(c1, c2);
LineSegment ls2 = new LineSegment(c3, c4);
return ls1.getIntersectionSegments(ls2);
}
|
java
|
public Coordinate lineSegmentIntersection(Coordinate c1, Coordinate c2, Coordinate c3, Coordinate c4) {
LineSegment ls1 = new LineSegment(c1, c2);
LineSegment ls2 = new LineSegment(c3, c4);
return ls1.getIntersectionSegments(ls2);
}
|
[
"public",
"Coordinate",
"lineSegmentIntersection",
"(",
"Coordinate",
"c1",
",",
"Coordinate",
"c2",
",",
"Coordinate",
"c3",
",",
"Coordinate",
"c4",
")",
"{",
"LineSegment",
"ls1",
"=",
"new",
"LineSegment",
"(",
"c1",
",",
"c2",
")",
";",
"LineSegment",
"ls2",
"=",
"new",
"LineSegment",
"(",
"c3",
",",
"c4",
")",
";",
"return",
"ls1",
".",
"getIntersectionSegments",
"(",
"ls2",
")",
";",
"}"
] |
Calculates the intersection point of 2 line segments.
@param c1
Start point of the first line segment.
@param c2
End point of the first line segment.
@param c3
Start point of the second line segment.
@param c4
End point of the second line segment.
@return Returns a coordinate or null if not a single intersection point.
|
[
"Calculates",
"the",
"intersection",
"point",
"of",
"2",
"line",
"segments",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Mathlib.java#L83-L87
|
147,248
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/Mathlib.java
|
Mathlib.distance
|
public static double distance(Coordinate c1, Coordinate c2, Coordinate c3) {
LineSegment ls = new LineSegment(c1, c2);
return ls.distance(c3);
}
|
java
|
public static double distance(Coordinate c1, Coordinate c2, Coordinate c3) {
LineSegment ls = new LineSegment(c1, c2);
return ls.distance(c3);
}
|
[
"public",
"static",
"double",
"distance",
"(",
"Coordinate",
"c1",
",",
"Coordinate",
"c2",
",",
"Coordinate",
"c3",
")",
"{",
"LineSegment",
"ls",
"=",
"new",
"LineSegment",
"(",
"c1",
",",
"c2",
")",
";",
"return",
"ls",
".",
"distance",
"(",
"c3",
")",
";",
"}"
] |
Distance between a point and a line.
@param c1
First coordinate of the line.
@param c2
Second coordinate of the line.
@param c3
Coordinate to calculate distance to line from.
|
[
"Distance",
"between",
"a",
"point",
"and",
"a",
"line",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Mathlib.java#L113-L116
|
147,249
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
|
MapView.getWorldToViewTransformation
|
public Matrix getWorldToViewTransformation() {
if (viewState.getScale() > 0) {
double dX = -(viewState.getX() * viewState.getScale()) + width / 2;
double dY = viewState.getY() * viewState.getScale() + height / 2;
return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
}
|
java
|
public Matrix getWorldToViewTransformation() {
if (viewState.getScale() > 0) {
double dX = -(viewState.getX() * viewState.getScale()) + width / 2;
double dY = viewState.getY() * viewState.getScale() + height / 2;
return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
}
|
[
"public",
"Matrix",
"getWorldToViewTransformation",
"(",
")",
"{",
"if",
"(",
"viewState",
".",
"getScale",
"(",
")",
">",
"0",
")",
"{",
"double",
"dX",
"=",
"-",
"(",
"viewState",
".",
"getX",
"(",
")",
"*",
"viewState",
".",
"getScale",
"(",
")",
")",
"+",
"width",
"/",
"2",
";",
"double",
"dY",
"=",
"viewState",
".",
"getY",
"(",
")",
"*",
"viewState",
".",
"getScale",
"(",
")",
"+",
"height",
"/",
"2",
";",
"return",
"new",
"Matrix",
"(",
"viewState",
".",
"getScale",
"(",
")",
",",
"0",
",",
"0",
",",
"-",
"viewState",
".",
"getScale",
"(",
")",
",",
"dX",
",",
"dY",
")",
";",
"}",
"return",
"new",
"Matrix",
"(",
"1",
",",
"0",
",",
"0",
",",
"1",
",",
"0",
",",
"0",
")",
";",
"}"
] |
Return the world-to-view space transformation matrix.
@return transformation matrix
|
[
"Return",
"the",
"world",
"-",
"to",
"-",
"view",
"space",
"transformation",
"matrix",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L141-L148
|
147,250
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
|
MapView.getWorldToPanTransformation
|
public Matrix getWorldToPanTransformation() {
if (viewState.getScale() > 0) {
double dX = -(viewState.getPanX() * viewState.getScale());
double dY = viewState.getPanY() * viewState.getScale();
return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
}
|
java
|
public Matrix getWorldToPanTransformation() {
if (viewState.getScale() > 0) {
double dX = -(viewState.getPanX() * viewState.getScale());
double dY = viewState.getPanY() * viewState.getScale();
return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
}
|
[
"public",
"Matrix",
"getWorldToPanTransformation",
"(",
")",
"{",
"if",
"(",
"viewState",
".",
"getScale",
"(",
")",
">",
"0",
")",
"{",
"double",
"dX",
"=",
"-",
"(",
"viewState",
".",
"getPanX",
"(",
")",
"*",
"viewState",
".",
"getScale",
"(",
")",
")",
";",
"double",
"dY",
"=",
"viewState",
".",
"getPanY",
"(",
")",
"*",
"viewState",
".",
"getScale",
"(",
")",
";",
"return",
"new",
"Matrix",
"(",
"viewState",
".",
"getScale",
"(",
")",
",",
"0",
",",
"0",
",",
"-",
"viewState",
".",
"getScale",
"(",
")",
",",
"dX",
",",
"dY",
")",
";",
"}",
"return",
"new",
"Matrix",
"(",
"1",
",",
"0",
",",
"0",
",",
"1",
",",
"0",
",",
"0",
")",
";",
"}"
] |
Return the world-to-pan space translation matrix.
@return transformation matrix
|
[
"Return",
"the",
"world",
"-",
"to",
"-",
"pan",
"space",
"translation",
"matrix",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L169-L176
|
147,251
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
|
MapView.getPanToViewTranslation
|
public Matrix getPanToViewTranslation() {
if (viewState.getScale() > 0) {
double dX = -((viewState.getX() - viewState.getPanX()) * viewState.getScale()) + width / 2;
double dY = (viewState.getY() - viewState.getPanY()) * viewState.getScale() + height / 2;
return new Matrix(1, 0, 0, 1, dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
}
|
java
|
public Matrix getPanToViewTranslation() {
if (viewState.getScale() > 0) {
double dX = -((viewState.getX() - viewState.getPanX()) * viewState.getScale()) + width / 2;
double dY = (viewState.getY() - viewState.getPanY()) * viewState.getScale() + height / 2;
return new Matrix(1, 0, 0, 1, dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
}
|
[
"public",
"Matrix",
"getPanToViewTranslation",
"(",
")",
"{",
"if",
"(",
"viewState",
".",
"getScale",
"(",
")",
">",
"0",
")",
"{",
"double",
"dX",
"=",
"-",
"(",
"(",
"viewState",
".",
"getX",
"(",
")",
"-",
"viewState",
".",
"getPanX",
"(",
")",
")",
"*",
"viewState",
".",
"getScale",
"(",
")",
")",
"+",
"width",
"/",
"2",
";",
"double",
"dY",
"=",
"(",
"viewState",
".",
"getY",
"(",
")",
"-",
"viewState",
".",
"getPanY",
"(",
")",
")",
"*",
"viewState",
".",
"getScale",
"(",
")",
"+",
"height",
"/",
"2",
";",
"return",
"new",
"Matrix",
"(",
"1",
",",
"0",
",",
"0",
",",
"1",
",",
"dX",
",",
"dY",
")",
";",
"}",
"return",
"new",
"Matrix",
"(",
"1",
",",
"0",
",",
"0",
",",
"1",
",",
"0",
",",
"0",
")",
";",
"}"
] |
Return the translation of coordinates relative to the pan origin to view coordinates.
@return transformation matrix
|
[
"Return",
"the",
"translation",
"of",
"coordinates",
"relative",
"to",
"the",
"pan",
"origin",
"to",
"view",
"coordinates",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L183-L190
|
147,252
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
|
MapView.getWorldToPanTranslation
|
public Matrix getWorldToPanTranslation() {
if (viewState.getScale() > 0) {
double dX = -(viewState.getPanX() * viewState.getScale());
double dY = viewState.getPanY() * viewState.getScale();
return new Matrix(1, 0, 0, 1, dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
}
|
java
|
public Matrix getWorldToPanTranslation() {
if (viewState.getScale() > 0) {
double dX = -(viewState.getPanX() * viewState.getScale());
double dY = viewState.getPanY() * viewState.getScale();
return new Matrix(1, 0, 0, 1, dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
}
|
[
"public",
"Matrix",
"getWorldToPanTranslation",
"(",
")",
"{",
"if",
"(",
"viewState",
".",
"getScale",
"(",
")",
">",
"0",
")",
"{",
"double",
"dX",
"=",
"-",
"(",
"viewState",
".",
"getPanX",
"(",
")",
"*",
"viewState",
".",
"getScale",
"(",
")",
")",
";",
"double",
"dY",
"=",
"viewState",
".",
"getPanY",
"(",
")",
"*",
"viewState",
".",
"getScale",
"(",
")",
";",
"return",
"new",
"Matrix",
"(",
"1",
",",
"0",
",",
"0",
",",
"1",
",",
"dX",
",",
"dY",
")",
";",
"}",
"return",
"new",
"Matrix",
"(",
"1",
",",
"0",
",",
"0",
",",
"1",
",",
"0",
",",
"0",
")",
";",
"}"
] |
Return the translation of scaled world coordinates to coordinates relative to the pan origin.
@return transformation matrix
|
[
"Return",
"the",
"translation",
"of",
"scaled",
"world",
"coordinates",
"to",
"coordinates",
"relative",
"to",
"the",
"pan",
"origin",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L197-L204
|
147,253
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
|
MapView.getWorldToViewScaling
|
public Matrix getWorldToViewScaling() {
if (viewState.getScale() > 0) {
return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), 0, 0);
}
return new Matrix(1, 0, 0, 1, 0, 0);
}
|
java
|
public Matrix getWorldToViewScaling() {
if (viewState.getScale() > 0) {
return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), 0, 0);
}
return new Matrix(1, 0, 0, 1, 0, 0);
}
|
[
"public",
"Matrix",
"getWorldToViewScaling",
"(",
")",
"{",
"if",
"(",
"viewState",
".",
"getScale",
"(",
")",
">",
"0",
")",
"{",
"return",
"new",
"Matrix",
"(",
"viewState",
".",
"getScale",
"(",
")",
",",
"0",
",",
"0",
",",
"-",
"viewState",
".",
"getScale",
"(",
")",
",",
"0",
",",
"0",
")",
";",
"}",
"return",
"new",
"Matrix",
"(",
"1",
",",
"0",
",",
"0",
",",
"1",
",",
"0",
",",
"0",
")",
";",
"}"
] |
Return the world-to-view space translation matrix.
@return transformation matrix
|
[
"Return",
"the",
"world",
"-",
"to",
"-",
"view",
"space",
"translation",
"matrix",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L211-L216
|
147,254
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
|
MapView.setSize
|
public void setSize(int newWidth, int newHeight) {
saveState();
Bbox bbox = getBounds();
if (width != newWidth || height != newHeight) {
this.width = newWidth;
this.height = newHeight;
if (viewState.getScale() < getMinimumScale()) {
// The new scale is too low, re-apply old values:
double scale = getBestScale(bbox);
doSetScale(snapToResolution(scale, ZoomOption.LEVEL_FIT));
}
// Use the same center point for the new bounds
doSetOrigin(bbox.getCenterPoint());
fireEvent(true, null);
}
}
|
java
|
public void setSize(int newWidth, int newHeight) {
saveState();
Bbox bbox = getBounds();
if (width != newWidth || height != newHeight) {
this.width = newWidth;
this.height = newHeight;
if (viewState.getScale() < getMinimumScale()) {
// The new scale is too low, re-apply old values:
double scale = getBestScale(bbox);
doSetScale(snapToResolution(scale, ZoomOption.LEVEL_FIT));
}
// Use the same center point for the new bounds
doSetOrigin(bbox.getCenterPoint());
fireEvent(true, null);
}
}
|
[
"public",
"void",
"setSize",
"(",
"int",
"newWidth",
",",
"int",
"newHeight",
")",
"{",
"saveState",
"(",
")",
";",
"Bbox",
"bbox",
"=",
"getBounds",
"(",
")",
";",
"if",
"(",
"width",
"!=",
"newWidth",
"||",
"height",
"!=",
"newHeight",
")",
"{",
"this",
".",
"width",
"=",
"newWidth",
";",
"this",
".",
"height",
"=",
"newHeight",
";",
"if",
"(",
"viewState",
".",
"getScale",
"(",
")",
"<",
"getMinimumScale",
"(",
")",
")",
"{",
"// The new scale is too low, re-apply old values:",
"double",
"scale",
"=",
"getBestScale",
"(",
"bbox",
")",
";",
"doSetScale",
"(",
"snapToResolution",
"(",
"scale",
",",
"ZoomOption",
".",
"LEVEL_FIT",
")",
")",
";",
"}",
"// Use the same center point for the new bounds",
"doSetOrigin",
"(",
"bbox",
".",
"getCenterPoint",
"(",
")",
")",
";",
"fireEvent",
"(",
"true",
",",
"null",
")",
";",
"}",
"}"
] |
Set the size of the map in pixels.
@param newWidth
The map's width.
@param newHeight
The map's height.
|
[
"Set",
"the",
"size",
"of",
"the",
"map",
"in",
"pixels",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L306-L321
|
147,255
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
|
MapView.translate
|
public void translate(double x, double y) {
saveState();
doSetOrigin(new Coordinate(viewState.getX() + x, viewState.getY() + y));
fireEvent(false, null);
}
|
java
|
public void translate(double x, double y) {
saveState();
doSetOrigin(new Coordinate(viewState.getX() + x, viewState.getY() + y));
fireEvent(false, null);
}
|
[
"public",
"void",
"translate",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"saveState",
"(",
")",
";",
"doSetOrigin",
"(",
"new",
"Coordinate",
"(",
"viewState",
".",
"getX",
"(",
")",
"+",
"x",
",",
"viewState",
".",
"getY",
"(",
")",
"+",
"y",
")",
")",
";",
"fireEvent",
"(",
"false",
",",
"null",
")",
";",
"}"
] |
Move the view on the map. This happens by translating the camera in turn.
@param x
Translation factor along the X-axis in world space.
@param y
Translation factor along the Y-axis in world space.
|
[
"Move",
"the",
"view",
"on",
"the",
"map",
".",
"This",
"happens",
"by",
"translating",
"the",
"camera",
"in",
"turn",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L331-L335
|
147,256
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
|
MapView.scale
|
public void scale(double delta, ZoomOption option, Coordinate center) {
setCurrentScale(viewState.getScale() * delta, option, center);
}
|
java
|
public void scale(double delta, ZoomOption option, Coordinate center) {
setCurrentScale(viewState.getScale() * delta, option, center);
}
|
[
"public",
"void",
"scale",
"(",
"double",
"delta",
",",
"ZoomOption",
"option",
",",
"Coordinate",
"center",
")",
"{",
"setCurrentScale",
"(",
"viewState",
".",
"getScale",
"(",
")",
"*",
"delta",
",",
"option",
",",
"center",
")",
";",
"}"
] |
Adjust the current scale on the map by a new factor, keeping a coordinate in place.
@param delta Adjust the scale by factor "delta".
@param option zoom option
@param center Keep this coordinate on the same position as before.
|
[
"Adjust",
"the",
"current",
"scale",
"on",
"the",
"map",
"by",
"a",
"new",
"factor",
"keeping",
"a",
"coordinate",
"in",
"place",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L354-L356
|
147,257
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
|
MapView.getBounds
|
public Bbox getBounds() {
double w = getViewSpaceWidth();
double h = getViewSpaceHeight();
double x = viewState.getX() - w / 2;
double y = viewState.getY() - h / 2;
return new Bbox(x, y, w, h);
}
|
java
|
public Bbox getBounds() {
double w = getViewSpaceWidth();
double h = getViewSpaceHeight();
double x = viewState.getX() - w / 2;
double y = viewState.getY() - h / 2;
return new Bbox(x, y, w, h);
}
|
[
"public",
"Bbox",
"getBounds",
"(",
")",
"{",
"double",
"w",
"=",
"getViewSpaceWidth",
"(",
")",
";",
"double",
"h",
"=",
"getViewSpaceHeight",
"(",
")",
";",
"double",
"x",
"=",
"viewState",
".",
"getX",
"(",
")",
"-",
"w",
"/",
"2",
";",
"double",
"y",
"=",
"viewState",
".",
"getY",
"(",
")",
"-",
"h",
"/",
"2",
";",
"return",
"new",
"Bbox",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
")",
";",
"}"
] |
Given the information in this MapView object, what is the currently visible area?
@return Notice that at this moment an Axis Aligned Bounding Box is returned! This means that rotating is not yet
possible.
|
[
"Given",
"the",
"information",
"in",
"this",
"MapView",
"object",
"what",
"is",
"the",
"currently",
"visible",
"area?"
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L377-L383
|
147,258
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
|
MapView.fireEvent
|
private void fireEvent(boolean resized, ZoomOption option) {
if (width > 0) {
// keep old semantics of sameScaleLevel for api compatibility !
boolean sameScale = lastViewState != null && viewState.isPannableFrom(lastViewState);
handlerManager.fireEvent(new MapViewChangedEvent(getBounds(), getCurrentScale(), sameScale, viewState
.isPanDragging(), resized, option));
}
}
|
java
|
private void fireEvent(boolean resized, ZoomOption option) {
if (width > 0) {
// keep old semantics of sameScaleLevel for api compatibility !
boolean sameScale = lastViewState != null && viewState.isPannableFrom(lastViewState);
handlerManager.fireEvent(new MapViewChangedEvent(getBounds(), getCurrentScale(), sameScale, viewState
.isPanDragging(), resized, option));
}
}
|
[
"private",
"void",
"fireEvent",
"(",
"boolean",
"resized",
",",
"ZoomOption",
"option",
")",
"{",
"if",
"(",
"width",
">",
"0",
")",
"{",
"// keep old semantics of sameScaleLevel for api compatibility !",
"boolean",
"sameScale",
"=",
"lastViewState",
"!=",
"null",
"&&",
"viewState",
".",
"isPannableFrom",
"(",
"lastViewState",
")",
";",
"handlerManager",
".",
"fireEvent",
"(",
"new",
"MapViewChangedEvent",
"(",
"getBounds",
"(",
")",
",",
"getCurrentScale",
"(",
")",
",",
"sameScale",
",",
"viewState",
".",
"isPanDragging",
"(",
")",
",",
"resized",
",",
"option",
")",
")",
";",
"}",
"}"
] |
Fire an event.
@param resized resized or not
@param option zoom option
|
[
"Fire",
"an",
"event",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L630-L637
|
147,259
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
|
MapView.snapToResolution
|
private double snapToResolution(double scale, ZoomOption option) {
// clip upper bounds
double allowedScale = limitScale(scale);
if (resolutions != null) {
IndexRange indices = getResolutionRange();
if (option == ZoomOption.EXACT || !indices.isValid()) {
// should not or cannot snap to resolutions
return allowedScale;
} else {
// find the new index
int newResolutionIndex = 0;
double screenResolution = 1.0 / allowedScale;
if (screenResolution >= resolutions.get(indices.getMin())) {
newResolutionIndex = indices.getMin();
} else if (screenResolution <= resolutions.get(indices.getMax())) {
newResolutionIndex = indices.getMax();
} else {
for (int i = indices.getMin(); i < indices.getMax(); i++) {
double upper = resolutions.get(i);
double lower = resolutions.get(i + 1);
if (screenResolution <= upper && screenResolution > lower) {
if (option == ZoomOption.LEVEL_FIT) {
newResolutionIndex = i;
break;
} else {
if ((upper / screenResolution) > (screenResolution / lower)) {
newResolutionIndex = i + 1;
break;
} else {
newResolutionIndex = i;
break;
}
}
}
}
}
// check if we need to change level
if (newResolutionIndex == resolutionIndex && option == ZoomOption.LEVEL_CHANGE) {
if (scale > viewState.getScale() && newResolutionIndex < indices.getMax()) {
newResolutionIndex++;
} else if (scale < viewState.getScale() && newResolutionIndex > indices.getMin()) {
newResolutionIndex--;
}
}
resolutionIndex = newResolutionIndex;
return 1.0 / resolutions.get(resolutionIndex);
}
} else {
return scale;
}
}
|
java
|
private double snapToResolution(double scale, ZoomOption option) {
// clip upper bounds
double allowedScale = limitScale(scale);
if (resolutions != null) {
IndexRange indices = getResolutionRange();
if (option == ZoomOption.EXACT || !indices.isValid()) {
// should not or cannot snap to resolutions
return allowedScale;
} else {
// find the new index
int newResolutionIndex = 0;
double screenResolution = 1.0 / allowedScale;
if (screenResolution >= resolutions.get(indices.getMin())) {
newResolutionIndex = indices.getMin();
} else if (screenResolution <= resolutions.get(indices.getMax())) {
newResolutionIndex = indices.getMax();
} else {
for (int i = indices.getMin(); i < indices.getMax(); i++) {
double upper = resolutions.get(i);
double lower = resolutions.get(i + 1);
if (screenResolution <= upper && screenResolution > lower) {
if (option == ZoomOption.LEVEL_FIT) {
newResolutionIndex = i;
break;
} else {
if ((upper / screenResolution) > (screenResolution / lower)) {
newResolutionIndex = i + 1;
break;
} else {
newResolutionIndex = i;
break;
}
}
}
}
}
// check if we need to change level
if (newResolutionIndex == resolutionIndex && option == ZoomOption.LEVEL_CHANGE) {
if (scale > viewState.getScale() && newResolutionIndex < indices.getMax()) {
newResolutionIndex++;
} else if (scale < viewState.getScale() && newResolutionIndex > indices.getMin()) {
newResolutionIndex--;
}
}
resolutionIndex = newResolutionIndex;
return 1.0 / resolutions.get(resolutionIndex);
}
} else {
return scale;
}
}
|
[
"private",
"double",
"snapToResolution",
"(",
"double",
"scale",
",",
"ZoomOption",
"option",
")",
"{",
"// clip upper bounds",
"double",
"allowedScale",
"=",
"limitScale",
"(",
"scale",
")",
";",
"if",
"(",
"resolutions",
"!=",
"null",
")",
"{",
"IndexRange",
"indices",
"=",
"getResolutionRange",
"(",
")",
";",
"if",
"(",
"option",
"==",
"ZoomOption",
".",
"EXACT",
"||",
"!",
"indices",
".",
"isValid",
"(",
")",
")",
"{",
"// should not or cannot snap to resolutions",
"return",
"allowedScale",
";",
"}",
"else",
"{",
"// find the new index",
"int",
"newResolutionIndex",
"=",
"0",
";",
"double",
"screenResolution",
"=",
"1.0",
"/",
"allowedScale",
";",
"if",
"(",
"screenResolution",
">=",
"resolutions",
".",
"get",
"(",
"indices",
".",
"getMin",
"(",
")",
")",
")",
"{",
"newResolutionIndex",
"=",
"indices",
".",
"getMin",
"(",
")",
";",
"}",
"else",
"if",
"(",
"screenResolution",
"<=",
"resolutions",
".",
"get",
"(",
"indices",
".",
"getMax",
"(",
")",
")",
")",
"{",
"newResolutionIndex",
"=",
"indices",
".",
"getMax",
"(",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"indices",
".",
"getMin",
"(",
")",
";",
"i",
"<",
"indices",
".",
"getMax",
"(",
")",
";",
"i",
"++",
")",
"{",
"double",
"upper",
"=",
"resolutions",
".",
"get",
"(",
"i",
")",
";",
"double",
"lower",
"=",
"resolutions",
".",
"get",
"(",
"i",
"+",
"1",
")",
";",
"if",
"(",
"screenResolution",
"<=",
"upper",
"&&",
"screenResolution",
">",
"lower",
")",
"{",
"if",
"(",
"option",
"==",
"ZoomOption",
".",
"LEVEL_FIT",
")",
"{",
"newResolutionIndex",
"=",
"i",
";",
"break",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"upper",
"/",
"screenResolution",
")",
">",
"(",
"screenResolution",
"/",
"lower",
")",
")",
"{",
"newResolutionIndex",
"=",
"i",
"+",
"1",
";",
"break",
";",
"}",
"else",
"{",
"newResolutionIndex",
"=",
"i",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}",
"// check if we need to change level",
"if",
"(",
"newResolutionIndex",
"==",
"resolutionIndex",
"&&",
"option",
"==",
"ZoomOption",
".",
"LEVEL_CHANGE",
")",
"{",
"if",
"(",
"scale",
">",
"viewState",
".",
"getScale",
"(",
")",
"&&",
"newResolutionIndex",
"<",
"indices",
".",
"getMax",
"(",
")",
")",
"{",
"newResolutionIndex",
"++",
";",
"}",
"else",
"if",
"(",
"scale",
"<",
"viewState",
".",
"getScale",
"(",
")",
"&&",
"newResolutionIndex",
">",
"indices",
".",
"getMin",
"(",
")",
")",
"{",
"newResolutionIndex",
"--",
";",
"}",
"}",
"resolutionIndex",
"=",
"newResolutionIndex",
";",
"return",
"1.0",
"/",
"resolutions",
".",
"get",
"(",
"resolutionIndex",
")",
";",
"}",
"}",
"else",
"{",
"return",
"scale",
";",
"}",
"}"
] |
Finds an optimal scale by snapping to resolutions.
@param scale
scale which needs to be snapped
@param option
snapping option
@return snapped scale
|
[
"Finds",
"an",
"optimal",
"scale",
"by",
"snapping",
"to",
"resolutions",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L648-L698
|
147,260
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
|
MapView.calcCenterFromPoint
|
private Coordinate calcCenterFromPoint(final Coordinate worldCenter) {
double xCenter = worldCenter.getX();
double yCenter = worldCenter.getY();
if (maxBounds != null) {
Coordinate minCoordinate = maxBounds.getOrigin();
Coordinate maxCoordinate = maxBounds.getEndPoint();
if (BoundsLimitOption.COMPLETELY_WITHIN_MAX_BOUNDS.equals(viewBoundsLimitOption)) {
/** View must lay completely within maxBounds. **/
double w = getViewSpaceWidth() / 2;
double h = getViewSpaceHeight() / 2;
if ((w * 2) > maxBounds.getWidth()) {
xCenter = maxBounds.getCenterPoint().getX();
} else {
if ((xCenter - w) < minCoordinate.getX()) {
xCenter = minCoordinate.getX() + w;
}
if ((xCenter + w) > maxCoordinate.getX()) {
xCenter = maxCoordinate.getX() - w;
}
}
if ((h * 2) > maxBounds.getHeight()) {
yCenter = maxBounds.getCenterPoint().getY();
} else {
if ((yCenter - h) < minCoordinate.getY()) {
yCenter = minCoordinate.getY() + h;
}
if ((yCenter + h) > maxCoordinate.getY()) {
yCenter = maxCoordinate.getY() - h;
}
}
} else if (BoundsLimitOption.CENTER_WITHIN_MAX_BOUNDS.equals(viewBoundsLimitOption)) {
/** Center of view must lay within maxBounds. **/
Coordinate center = new Coordinate(xCenter, yCenter);
if (!maxBounds.contains(center)) {
if (xCenter < minCoordinate.getX()) {
xCenter = minCoordinate.getX();
} else if (xCenter > maxCoordinate.getX()) {
xCenter = maxCoordinate.getX();
}
if (yCenter < minCoordinate.getY()) {
yCenter = minCoordinate.getY();
} else if (yCenter > maxCoordinate.getY()) {
yCenter = maxCoordinate.getY();
}
}
}
}
return new Coordinate(xCenter, yCenter);
}
|
java
|
private Coordinate calcCenterFromPoint(final Coordinate worldCenter) {
double xCenter = worldCenter.getX();
double yCenter = worldCenter.getY();
if (maxBounds != null) {
Coordinate minCoordinate = maxBounds.getOrigin();
Coordinate maxCoordinate = maxBounds.getEndPoint();
if (BoundsLimitOption.COMPLETELY_WITHIN_MAX_BOUNDS.equals(viewBoundsLimitOption)) {
/** View must lay completely within maxBounds. **/
double w = getViewSpaceWidth() / 2;
double h = getViewSpaceHeight() / 2;
if ((w * 2) > maxBounds.getWidth()) {
xCenter = maxBounds.getCenterPoint().getX();
} else {
if ((xCenter - w) < minCoordinate.getX()) {
xCenter = minCoordinate.getX() + w;
}
if ((xCenter + w) > maxCoordinate.getX()) {
xCenter = maxCoordinate.getX() - w;
}
}
if ((h * 2) > maxBounds.getHeight()) {
yCenter = maxBounds.getCenterPoint().getY();
} else {
if ((yCenter - h) < minCoordinate.getY()) {
yCenter = minCoordinate.getY() + h;
}
if ((yCenter + h) > maxCoordinate.getY()) {
yCenter = maxCoordinate.getY() - h;
}
}
} else if (BoundsLimitOption.CENTER_WITHIN_MAX_BOUNDS.equals(viewBoundsLimitOption)) {
/** Center of view must lay within maxBounds. **/
Coordinate center = new Coordinate(xCenter, yCenter);
if (!maxBounds.contains(center)) {
if (xCenter < minCoordinate.getX()) {
xCenter = minCoordinate.getX();
} else if (xCenter > maxCoordinate.getX()) {
xCenter = maxCoordinate.getX();
}
if (yCenter < minCoordinate.getY()) {
yCenter = minCoordinate.getY();
} else if (yCenter > maxCoordinate.getY()) {
yCenter = maxCoordinate.getY();
}
}
}
}
return new Coordinate(xCenter, yCenter);
}
|
[
"private",
"Coordinate",
"calcCenterFromPoint",
"(",
"final",
"Coordinate",
"worldCenter",
")",
"{",
"double",
"xCenter",
"=",
"worldCenter",
".",
"getX",
"(",
")",
";",
"double",
"yCenter",
"=",
"worldCenter",
".",
"getY",
"(",
")",
";",
"if",
"(",
"maxBounds",
"!=",
"null",
")",
"{",
"Coordinate",
"minCoordinate",
"=",
"maxBounds",
".",
"getOrigin",
"(",
")",
";",
"Coordinate",
"maxCoordinate",
"=",
"maxBounds",
".",
"getEndPoint",
"(",
")",
";",
"if",
"(",
"BoundsLimitOption",
".",
"COMPLETELY_WITHIN_MAX_BOUNDS",
".",
"equals",
"(",
"viewBoundsLimitOption",
")",
")",
"{",
"/** View must lay completely within maxBounds. **/",
"double",
"w",
"=",
"getViewSpaceWidth",
"(",
")",
"/",
"2",
";",
"double",
"h",
"=",
"getViewSpaceHeight",
"(",
")",
"/",
"2",
";",
"if",
"(",
"(",
"w",
"*",
"2",
")",
">",
"maxBounds",
".",
"getWidth",
"(",
")",
")",
"{",
"xCenter",
"=",
"maxBounds",
".",
"getCenterPoint",
"(",
")",
".",
"getX",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"xCenter",
"-",
"w",
")",
"<",
"minCoordinate",
".",
"getX",
"(",
")",
")",
"{",
"xCenter",
"=",
"minCoordinate",
".",
"getX",
"(",
")",
"+",
"w",
";",
"}",
"if",
"(",
"(",
"xCenter",
"+",
"w",
")",
">",
"maxCoordinate",
".",
"getX",
"(",
")",
")",
"{",
"xCenter",
"=",
"maxCoordinate",
".",
"getX",
"(",
")",
"-",
"w",
";",
"}",
"}",
"if",
"(",
"(",
"h",
"*",
"2",
")",
">",
"maxBounds",
".",
"getHeight",
"(",
")",
")",
"{",
"yCenter",
"=",
"maxBounds",
".",
"getCenterPoint",
"(",
")",
".",
"getY",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"yCenter",
"-",
"h",
")",
"<",
"minCoordinate",
".",
"getY",
"(",
")",
")",
"{",
"yCenter",
"=",
"minCoordinate",
".",
"getY",
"(",
")",
"+",
"h",
";",
"}",
"if",
"(",
"(",
"yCenter",
"+",
"h",
")",
">",
"maxCoordinate",
".",
"getY",
"(",
")",
")",
"{",
"yCenter",
"=",
"maxCoordinate",
".",
"getY",
"(",
")",
"-",
"h",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"BoundsLimitOption",
".",
"CENTER_WITHIN_MAX_BOUNDS",
".",
"equals",
"(",
"viewBoundsLimitOption",
")",
")",
"{",
"/** Center of view must lay within maxBounds. **/",
"Coordinate",
"center",
"=",
"new",
"Coordinate",
"(",
"xCenter",
",",
"yCenter",
")",
";",
"if",
"(",
"!",
"maxBounds",
".",
"contains",
"(",
"center",
")",
")",
"{",
"if",
"(",
"xCenter",
"<",
"minCoordinate",
".",
"getX",
"(",
")",
")",
"{",
"xCenter",
"=",
"minCoordinate",
".",
"getX",
"(",
")",
";",
"}",
"else",
"if",
"(",
"xCenter",
">",
"maxCoordinate",
".",
"getX",
"(",
")",
")",
"{",
"xCenter",
"=",
"maxCoordinate",
".",
"getX",
"(",
")",
";",
"}",
"if",
"(",
"yCenter",
"<",
"minCoordinate",
".",
"getY",
"(",
")",
")",
"{",
"yCenter",
"=",
"minCoordinate",
".",
"getY",
"(",
")",
";",
"}",
"else",
"if",
"(",
"yCenter",
">",
"maxCoordinate",
".",
"getY",
"(",
")",
")",
"{",
"yCenter",
"=",
"maxCoordinate",
".",
"getY",
"(",
")",
";",
"}",
"}",
"}",
"}",
"return",
"new",
"Coordinate",
"(",
"xCenter",
",",
"yCenter",
")",
";",
"}"
] |
Adjusts the center point of the map, to an allowed center point. This method tries to make sure the whole map
extent is inside the maximum allowed bounds.
@param worldCenter world center
@return new center
|
[
"Adjusts",
"the",
"center",
"point",
"of",
"the",
"map",
"to",
"an",
"allowed",
"center",
"point",
".",
"This",
"method",
"tries",
"to",
"make",
"sure",
"the",
"whole",
"map",
"extent",
"is",
"inside",
"the",
"maximum",
"allowed",
"bounds",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L707-L757
|
147,261
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/searchfavourites/SearchFavouritesListPanel.java
|
SearchFavouritesListPanel.initializeList
|
private void initializeList() {
FavouritesCommService.getSearchFavourites(new DataCallback<List<SearchFavourite>>() {
public void execute(List<SearchFavourite> result) {
favouriteItems.getDataAsRecordList().removeList(favouriteItems.getRecords());
for (SearchFavourite sf : result) {
favouriteItems.addData(new FavouriteListRecord(sf));
}
}
});
}
|
java
|
private void initializeList() {
FavouritesCommService.getSearchFavourites(new DataCallback<List<SearchFavourite>>() {
public void execute(List<SearchFavourite> result) {
favouriteItems.getDataAsRecordList().removeList(favouriteItems.getRecords());
for (SearchFavourite sf : result) {
favouriteItems.addData(new FavouriteListRecord(sf));
}
}
});
}
|
[
"private",
"void",
"initializeList",
"(",
")",
"{",
"FavouritesCommService",
".",
"getSearchFavourites",
"(",
"new",
"DataCallback",
"<",
"List",
"<",
"SearchFavourite",
">",
">",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
"List",
"<",
"SearchFavourite",
">",
"result",
")",
"{",
"favouriteItems",
".",
"getDataAsRecordList",
"(",
")",
".",
"removeList",
"(",
"favouriteItems",
".",
"getRecords",
"(",
")",
")",
";",
"for",
"(",
"SearchFavourite",
"sf",
":",
"result",
")",
"{",
"favouriteItems",
".",
"addData",
"(",
"new",
"FavouriteListRecord",
"(",
"sf",
")",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] |
get favourites from store
|
[
"get",
"favourites",
"from",
"store"
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/searchfavourites/SearchFavouritesListPanel.java#L180-L189
|
147,262
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/MultiPoint.java
|
MultiPoint.getGeometryN
|
public Geometry getGeometryN(int n) {
if (isEmpty()) {
return null;
}
if (n >= 0 && n < points.length) {
return points[n];
}
throw new ArrayIndexOutOfBoundsException(n);
// return this;
}
|
java
|
public Geometry getGeometryN(int n) {
if (isEmpty()) {
return null;
}
if (n >= 0 && n < points.length) {
return points[n];
}
throw new ArrayIndexOutOfBoundsException(n);
// return this;
}
|
[
"public",
"Geometry",
"getGeometryN",
"(",
"int",
"n",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"n",
">=",
"0",
"&&",
"n",
"<",
"points",
".",
"length",
")",
"{",
"return",
"points",
"[",
"n",
"]",
";",
"}",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"n",
")",
";",
"// return this;",
"}"
] |
Return null if the MultiPoint is empty, returns one of the points if the requested index exists, throws an
exception otherwise.
@param n
The index in the point array to retrieve. Better make sure it is a valid index. (0 < n < getNumPoints)
|
[
"Return",
"null",
"if",
"the",
"MultiPoint",
"is",
"empty",
"returns",
"one",
"of",
"the",
"points",
"if",
"the",
"requested",
"index",
"exists",
"throws",
"an",
"exception",
"otherwise",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/MultiPoint.java#L120-L129
|
147,263
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/MultiPoint.java
|
MultiPoint.getBounds
|
public Bbox getBounds() {
if (isEmpty()) {
return null;
}
double minX = Double.MAX_VALUE;
double minY = Double.MAX_VALUE;
double maxX = -Double.MAX_VALUE;
double maxY = -Double.MAX_VALUE;
for (Point point : points) {
if (point.getX() < minX) {
minX = point.getX();
}
if (point.getY() < minY) {
minY = point.getY();
}
if (point.getX() > maxX) {
maxX = point.getX();
}
if (point.getY() > maxY) {
maxY = point.getY();
}
}
return new Bbox(minX, minY, maxX - minX, maxY - minY);
}
|
java
|
public Bbox getBounds() {
if (isEmpty()) {
return null;
}
double minX = Double.MAX_VALUE;
double minY = Double.MAX_VALUE;
double maxX = -Double.MAX_VALUE;
double maxY = -Double.MAX_VALUE;
for (Point point : points) {
if (point.getX() < minX) {
minX = point.getX();
}
if (point.getY() < minY) {
minY = point.getY();
}
if (point.getX() > maxX) {
maxX = point.getX();
}
if (point.getY() > maxY) {
maxY = point.getY();
}
}
return new Bbox(minX, minY, maxX - minX, maxY - minY);
}
|
[
"public",
"Bbox",
"getBounds",
"(",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"double",
"minX",
"=",
"Double",
".",
"MAX_VALUE",
";",
"double",
"minY",
"=",
"Double",
".",
"MAX_VALUE",
";",
"double",
"maxX",
"=",
"-",
"Double",
".",
"MAX_VALUE",
";",
"double",
"maxY",
"=",
"-",
"Double",
".",
"MAX_VALUE",
";",
"for",
"(",
"Point",
"point",
":",
"points",
")",
"{",
"if",
"(",
"point",
".",
"getX",
"(",
")",
"<",
"minX",
")",
"{",
"minX",
"=",
"point",
".",
"getX",
"(",
")",
";",
"}",
"if",
"(",
"point",
".",
"getY",
"(",
")",
"<",
"minY",
")",
"{",
"minY",
"=",
"point",
".",
"getY",
"(",
")",
";",
"}",
"if",
"(",
"point",
".",
"getX",
"(",
")",
">",
"maxX",
")",
"{",
"maxX",
"=",
"point",
".",
"getX",
"(",
")",
";",
"}",
"if",
"(",
"point",
".",
"getY",
"(",
")",
">",
"maxY",
")",
"{",
"maxY",
"=",
"point",
".",
"getY",
"(",
")",
";",
"}",
"}",
"return",
"new",
"Bbox",
"(",
"minX",
",",
"minY",
",",
"maxX",
"-",
"minX",
",",
"maxY",
"-",
"minY",
")",
";",
"}"
] |
Return the bounding box spanning the full list of points.
|
[
"Return",
"the",
"bounding",
"box",
"spanning",
"the",
"full",
"list",
"of",
"points",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/MultiPoint.java#L147-L172
|
147,264
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/MultiPoint.java
|
MultiPoint.getCoordinates
|
public Coordinate[] getCoordinates() {
if (isEmpty()) {
return null;
}
Coordinate[] coordinates = new Coordinate[points.length];
for (int i = 0; i < points.length; i++) {
coordinates[i] = points[i].getCoordinate();
}
return coordinates;
}
|
java
|
public Coordinate[] getCoordinates() {
if (isEmpty()) {
return null;
}
Coordinate[] coordinates = new Coordinate[points.length];
for (int i = 0; i < points.length; i++) {
coordinates[i] = points[i].getCoordinate();
}
return coordinates;
}
|
[
"public",
"Coordinate",
"[",
"]",
"getCoordinates",
"(",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"Coordinate",
"[",
"]",
"coordinates",
"=",
"new",
"Coordinate",
"[",
"points",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"points",
".",
"length",
";",
"i",
"++",
")",
"{",
"coordinates",
"[",
"i",
"]",
"=",
"points",
"[",
"i",
"]",
".",
"getCoordinate",
"(",
")",
";",
"}",
"return",
"coordinates",
";",
"}"
] |
Get the full list of coordinates from all the points in this MultiPoint geometry. If this geometry is empty, null
will be returned.
|
[
"Get",
"the",
"full",
"list",
"of",
"coordinates",
"from",
"all",
"the",
"points",
"in",
"this",
"MultiPoint",
"geometry",
".",
"If",
"this",
"geometry",
"is",
"empty",
"null",
"will",
"be",
"returned",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/MultiPoint.java#L188-L197
|
147,265
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/MultiPoint.java
|
MultiPoint.intersects
|
public boolean intersects(Geometry geometry) {
if (isEmpty()) {
return false;
}
for (Point point : points) {
if (point.intersects(geometry)) {
return true;
}
}
return false;
}
|
java
|
public boolean intersects(Geometry geometry) {
if (isEmpty()) {
return false;
}
for (Point point : points) {
if (point.intersects(geometry)) {
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"intersects",
"(",
"Geometry",
"geometry",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"Point",
"point",
":",
"points",
")",
"{",
"if",
"(",
"point",
".",
"intersects",
"(",
"geometry",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Return true if any of the points intersect the given geometry.
|
[
"Return",
"true",
"if",
"any",
"of",
"the",
"points",
"intersect",
"the",
"given",
"geometry",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/MultiPoint.java#L206-L216
|
147,266
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/MultiFeatureListGrid.java
|
MultiFeatureListGrid.addFeatures
|
public void addFeatures(Map<VectorLayer, List<Feature>> featureMap, Criterion criterion) {
if (showDetailsOnSingleResult && featureMap.size() == 1) {
// sorting is never needed if only 1 entry
List<Feature> features = featureMap.values().iterator().next();
if (features.size() == 1) {
showFeatureDetailWindow(map, features.get(0));
}
}
//Add feature tabs in map order
for (VectorLayer layer : map.getMapModel().getVectorLayers()) {
if (featureMap.containsKey(layer)) {
addFeatures(layer, featureMap.get(layer), criterion);
}
}
tabset.selectTab(0);
}
|
java
|
public void addFeatures(Map<VectorLayer, List<Feature>> featureMap, Criterion criterion) {
if (showDetailsOnSingleResult && featureMap.size() == 1) {
// sorting is never needed if only 1 entry
List<Feature> features = featureMap.values().iterator().next();
if (features.size() == 1) {
showFeatureDetailWindow(map, features.get(0));
}
}
//Add feature tabs in map order
for (VectorLayer layer : map.getMapModel().getVectorLayers()) {
if (featureMap.containsKey(layer)) {
addFeatures(layer, featureMap.get(layer), criterion);
}
}
tabset.selectTab(0);
}
|
[
"public",
"void",
"addFeatures",
"(",
"Map",
"<",
"VectorLayer",
",",
"List",
"<",
"Feature",
">",
">",
"featureMap",
",",
"Criterion",
"criterion",
")",
"{",
"if",
"(",
"showDetailsOnSingleResult",
"&&",
"featureMap",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"// sorting is never needed if only 1 entry",
"List",
"<",
"Feature",
">",
"features",
"=",
"featureMap",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"if",
"(",
"features",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"showFeatureDetailWindow",
"(",
"map",
",",
"features",
".",
"get",
"(",
"0",
")",
")",
";",
"}",
"}",
"//Add feature tabs in map order",
"for",
"(",
"VectorLayer",
"layer",
":",
"map",
".",
"getMapModel",
"(",
")",
".",
"getVectorLayers",
"(",
")",
")",
"{",
"if",
"(",
"featureMap",
".",
"containsKey",
"(",
"layer",
")",
")",
"{",
"addFeatures",
"(",
"layer",
",",
"featureMap",
".",
"get",
"(",
"layer",
")",
",",
"criterion",
")",
";",
"}",
"}",
"tabset",
".",
"selectTab",
"(",
"0",
")",
";",
"}"
] |
Add features in the widget for several layers.
@param featureMap map of features per layer
@param criterion the original request for this search
|
[
"Add",
"features",
"in",
"the",
"widget",
"for",
"several",
"layers",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/MultiFeatureListGrid.java#L168-L184
|
147,267
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/MultiFeatureListGrid.java
|
MultiFeatureListGrid.getSelection
|
@Api
public ListGridRecord[] getSelection(String layerId) {
String id = tabset.getID() + "_" + constructIdSaveLayerId(layerId);
FeatureListGridTab tab = (FeatureListGridTab) tabset.getTab(id);
if (tab != null) {
return tab.getSelection();
}
return null;
}
|
java
|
@Api
public ListGridRecord[] getSelection(String layerId) {
String id = tabset.getID() + "_" + constructIdSaveLayerId(layerId);
FeatureListGridTab tab = (FeatureListGridTab) tabset.getTab(id);
if (tab != null) {
return tab.getSelection();
}
return null;
}
|
[
"@",
"Api",
"public",
"ListGridRecord",
"[",
"]",
"getSelection",
"(",
"String",
"layerId",
")",
"{",
"String",
"id",
"=",
"tabset",
".",
"getID",
"(",
")",
"+",
"\"_\"",
"+",
"constructIdSaveLayerId",
"(",
"layerId",
")",
";",
"FeatureListGridTab",
"tab",
"=",
"(",
"FeatureListGridTab",
")",
"tabset",
".",
"getTab",
"(",
"id",
")",
";",
"if",
"(",
"tab",
"!=",
"null",
")",
"{",
"return",
"tab",
".",
"getSelection",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Get the selected records for the tab.
@param layerId layer to get selected items for
@return selected records
|
[
"Get",
"the",
"selected",
"records",
"for",
"the",
"tab",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/MultiFeatureListGrid.java#L272-L280
|
147,268
|
wnameless/rubycollect4j
|
src/main/java/net/sf/rubycollect4j/RubyObject.java
|
RubyObject.isBlank
|
public static boolean isBlank(Object o) {
if (o instanceof CharSequence) {
CharSequence cs = (CharSequence) o;
return cs == null || new StringBuilder(cs.length()).append(cs).toString()
.trim().isEmpty();
}
if (o instanceof Iterable) {
Iterable<?> iter = (Iterable<?>) o;
return iter == null || !iter.iterator().hasNext();
}
if (o instanceof Iterator) {
Iterator<?> iter = (Iterator<?>) o;
return iter == null || !iter.hasNext();
}
if (o instanceof Map) {
Map<?, ?> map = (Map<?, ?>) o;
return map == null || map.isEmpty();
}
if (o instanceof Boolean) {
Boolean bool = (Boolean) o;
return bool == null || bool.equals(Boolean.FALSE);
}
return o == null;
}
|
java
|
public static boolean isBlank(Object o) {
if (o instanceof CharSequence) {
CharSequence cs = (CharSequence) o;
return cs == null || new StringBuilder(cs.length()).append(cs).toString()
.trim().isEmpty();
}
if (o instanceof Iterable) {
Iterable<?> iter = (Iterable<?>) o;
return iter == null || !iter.iterator().hasNext();
}
if (o instanceof Iterator) {
Iterator<?> iter = (Iterator<?>) o;
return iter == null || !iter.hasNext();
}
if (o instanceof Map) {
Map<?, ?> map = (Map<?, ?>) o;
return map == null || map.isEmpty();
}
if (o instanceof Boolean) {
Boolean bool = (Boolean) o;
return bool == null || bool.equals(Boolean.FALSE);
}
return o == null;
}
|
[
"public",
"static",
"boolean",
"isBlank",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"o",
"instanceof",
"CharSequence",
")",
"{",
"CharSequence",
"cs",
"=",
"(",
"CharSequence",
")",
"o",
";",
"return",
"cs",
"==",
"null",
"||",
"new",
"StringBuilder",
"(",
"cs",
".",
"length",
"(",
")",
")",
".",
"append",
"(",
"cs",
")",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
";",
"}",
"if",
"(",
"o",
"instanceof",
"Iterable",
")",
"{",
"Iterable",
"<",
"?",
">",
"iter",
"=",
"(",
"Iterable",
"<",
"?",
">",
")",
"o",
";",
"return",
"iter",
"==",
"null",
"||",
"!",
"iter",
".",
"iterator",
"(",
")",
".",
"hasNext",
"(",
")",
";",
"}",
"if",
"(",
"o",
"instanceof",
"Iterator",
")",
"{",
"Iterator",
"<",
"?",
">",
"iter",
"=",
"(",
"Iterator",
"<",
"?",
">",
")",
"o",
";",
"return",
"iter",
"==",
"null",
"||",
"!",
"iter",
".",
"hasNext",
"(",
")",
";",
"}",
"if",
"(",
"o",
"instanceof",
"Map",
")",
"{",
"Map",
"<",
"?",
",",
"?",
">",
"map",
"=",
"(",
"Map",
"<",
"?",
",",
"?",
">",
")",
"o",
";",
"return",
"map",
"==",
"null",
"||",
"map",
".",
"isEmpty",
"(",
")",
";",
"}",
"if",
"(",
"o",
"instanceof",
"Boolean",
")",
"{",
"Boolean",
"bool",
"=",
"(",
"Boolean",
")",
"o",
";",
"return",
"bool",
"==",
"null",
"||",
"bool",
".",
"equals",
"(",
"Boolean",
".",
"FALSE",
")",
";",
"}",
"return",
"o",
"==",
"null",
";",
"}"
] |
Checks if an Object is null, blank Iterable, blank Iterator, blank Map,
blank CharSequence or Boolean.FALSE.
@param o
any Object
@return true if given Object is blank, false otherwise
|
[
"Checks",
"if",
"an",
"Object",
"is",
"null",
"blank",
"Iterable",
"blank",
"Iterator",
"blank",
"Map",
"blank",
"CharSequence",
"or",
"Boolean",
".",
"FALSE",
"."
] |
b8b8d8eccaca2254a3d09b91745882fb7a0d5add
|
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyObject.java#L396-L420
|
147,269
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/FeatureAttributeEditor.java
|
FeatureAttributeEditor.setFeature
|
public void setFeature(Feature feature) {
if (feature != null) {
this.feature = feature;
copyToForm(this.feature);
} else {
this.feature = null;
featureForm.clear();
}
}
|
java
|
public void setFeature(Feature feature) {
if (feature != null) {
this.feature = feature;
copyToForm(this.feature);
} else {
this.feature = null;
featureForm.clear();
}
}
|
[
"public",
"void",
"setFeature",
"(",
"Feature",
"feature",
")",
"{",
"if",
"(",
"feature",
"!=",
"null",
")",
"{",
"this",
".",
"feature",
"=",
"feature",
";",
"copyToForm",
"(",
"this",
".",
"feature",
")",
";",
"}",
"else",
"{",
"this",
".",
"feature",
"=",
"null",
";",
"featureForm",
".",
"clear",
"(",
")",
";",
"}",
"}"
] |
Apply a new feature onto this widget. The feature will be immediately shown on the attribute form.
@param feature
feature
|
[
"Apply",
"a",
"new",
"feature",
"onto",
"this",
"widget",
".",
"The",
"feature",
"will",
"be",
"immediately",
"shown",
"on",
"the",
"attribute",
"form",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/FeatureAttributeEditor.java#L158-L166
|
147,270
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/action/menu/RemovePointAction.java
|
RemovePointAction.onClick
|
public void onClick(MenuItemClickEvent event) {
FeatureTransaction ft = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction();
if (ft != null && index != null) {
mapWidget.render(ft, RenderGroup.VECTOR, RenderStatus.DELETE);
RemoveCoordinateOp op = new RemoveCoordinateOp(index);
ft.execute(op);
mapWidget.render(ft, RenderGroup.VECTOR, RenderStatus.ALL);
}
}
|
java
|
public void onClick(MenuItemClickEvent event) {
FeatureTransaction ft = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction();
if (ft != null && index != null) {
mapWidget.render(ft, RenderGroup.VECTOR, RenderStatus.DELETE);
RemoveCoordinateOp op = new RemoveCoordinateOp(index);
ft.execute(op);
mapWidget.render(ft, RenderGroup.VECTOR, RenderStatus.ALL);
}
}
|
[
"public",
"void",
"onClick",
"(",
"MenuItemClickEvent",
"event",
")",
"{",
"FeatureTransaction",
"ft",
"=",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getFeatureEditor",
"(",
")",
".",
"getFeatureTransaction",
"(",
")",
";",
"if",
"(",
"ft",
"!=",
"null",
"&&",
"index",
"!=",
"null",
")",
"{",
"mapWidget",
".",
"render",
"(",
"ft",
",",
"RenderGroup",
".",
"VECTOR",
",",
"RenderStatus",
".",
"DELETE",
")",
";",
"RemoveCoordinateOp",
"op",
"=",
"new",
"RemoveCoordinateOp",
"(",
"index",
")",
";",
"ft",
".",
"execute",
"(",
"op",
")",
";",
"mapWidget",
".",
"render",
"(",
"ft",
",",
"RenderGroup",
".",
"VECTOR",
",",
"RenderStatus",
".",
"ALL",
")",
";",
"}",
"}"
] |
Remove an existing point from the geometry at a given index.
@param event
The {@link MenuItemClickEvent} from clicking the action.
|
[
"Remove",
"an",
"existing",
"point",
"from",
"the",
"geometry",
"at",
"a",
"given",
"index",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/menu/RemovePointAction.java#L59-L67
|
147,271
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/controller/PanController.java
|
PanController.onDoubleClick
|
public void onDoubleClick(DoubleClickEvent event) {
//Check if there was a last click that was handled in this class.
if (null != lastClickPosition) {
// Zoom in on the event location.
Bbox bounds = mapWidget.getMapModel().getMapView().getBounds();
double x = lastClickPosition.getX() - (bounds.getWidth() / 4);
double y = lastClickPosition.getY() - (bounds.getHeight() / 4);
Bbox newBounds = new Bbox(x, y, bounds.getWidth() / 2, bounds.getHeight() / 2);
mapWidget.getMapModel().getMapView().applyBounds(newBounds, ZoomOption.LEVEL_CHANGE);
}
}
|
java
|
public void onDoubleClick(DoubleClickEvent event) {
//Check if there was a last click that was handled in this class.
if (null != lastClickPosition) {
// Zoom in on the event location.
Bbox bounds = mapWidget.getMapModel().getMapView().getBounds();
double x = lastClickPosition.getX() - (bounds.getWidth() / 4);
double y = lastClickPosition.getY() - (bounds.getHeight() / 4);
Bbox newBounds = new Bbox(x, y, bounds.getWidth() / 2, bounds.getHeight() / 2);
mapWidget.getMapModel().getMapView().applyBounds(newBounds, ZoomOption.LEVEL_CHANGE);
}
}
|
[
"public",
"void",
"onDoubleClick",
"(",
"DoubleClickEvent",
"event",
")",
"{",
"//Check if there was a last click that was handled in this class.",
"if",
"(",
"null",
"!=",
"lastClickPosition",
")",
"{",
"// Zoom in on the event location.",
"Bbox",
"bounds",
"=",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getMapView",
"(",
")",
".",
"getBounds",
"(",
")",
";",
"double",
"x",
"=",
"lastClickPosition",
".",
"getX",
"(",
")",
"-",
"(",
"bounds",
".",
"getWidth",
"(",
")",
"/",
"4",
")",
";",
"double",
"y",
"=",
"lastClickPosition",
".",
"getY",
"(",
")",
"-",
"(",
"bounds",
".",
"getHeight",
"(",
")",
"/",
"4",
")",
";",
"Bbox",
"newBounds",
"=",
"new",
"Bbox",
"(",
"x",
",",
"y",
",",
"bounds",
".",
"getWidth",
"(",
")",
"/",
"2",
",",
"bounds",
".",
"getHeight",
"(",
")",
"/",
"2",
")",
";",
"mapWidget",
".",
"getMapModel",
"(",
")",
".",
"getMapView",
"(",
")",
".",
"applyBounds",
"(",
"newBounds",
",",
"ZoomOption",
".",
"LEVEL_CHANGE",
")",
";",
"}",
"}"
] |
Zoom in to the double-clicked position.
|
[
"Zoom",
"in",
"to",
"the",
"double",
"-",
"clicked",
"position",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/controller/PanController.java#L124-L134
|
147,272
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/GwtCommandCallback.java
|
GwtCommandCallback.onCommunicationException
|
public void onCommunicationException(Throwable error) {
String msg = I18nProvider.getGlobal().commandCommunicationError() + ":\n" + error.getMessage();
Log.logWarn(msg, error);
SC.warn(msg);
}
|
java
|
public void onCommunicationException(Throwable error) {
String msg = I18nProvider.getGlobal().commandCommunicationError() + ":\n" + error.getMessage();
Log.logWarn(msg, error);
SC.warn(msg);
}
|
[
"public",
"void",
"onCommunicationException",
"(",
"Throwable",
"error",
")",
"{",
"String",
"msg",
"=",
"I18nProvider",
".",
"getGlobal",
"(",
")",
".",
"commandCommunicationError",
"(",
")",
"+",
"\":\\n\"",
"+",
"error",
".",
"getMessage",
"(",
")",
";",
"Log",
".",
"logWarn",
"(",
"msg",
",",
"error",
")",
";",
"SC",
".",
"warn",
"(",
"msg",
")",
";",
"}"
] |
Default behaviour for handling a communication exception. Shows a warning window to the user.
@param error error to report
|
[
"Default",
"behaviour",
"for",
"handling",
"a",
"communication",
"exception",
".",
"Shows",
"a",
"warning",
"window",
"to",
"the",
"user",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/GwtCommandCallback.java#L34-L38
|
147,273
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/GwtCommandCallback.java
|
GwtCommandCallback.onCommandException
|
public void onCommandException(CommandResponse response) {
String message = I18nProvider.getGlobal().commandError() + ":";
for (String error : response.getErrorMessages()) {
message += "\n" + error;
}
Log.logWarn(message);
if (response.getExceptions() == null || response.getExceptions().size() == 0) {
SC.warn(message);
} else {
// The error messaging window only supports 1 exception to display:
ExceptionWindow window = new ExceptionWindow(response.getExceptions().get(0));
window.show();
}
}
|
java
|
public void onCommandException(CommandResponse response) {
String message = I18nProvider.getGlobal().commandError() + ":";
for (String error : response.getErrorMessages()) {
message += "\n" + error;
}
Log.logWarn(message);
if (response.getExceptions() == null || response.getExceptions().size() == 0) {
SC.warn(message);
} else {
// The error messaging window only supports 1 exception to display:
ExceptionWindow window = new ExceptionWindow(response.getExceptions().get(0));
window.show();
}
}
|
[
"public",
"void",
"onCommandException",
"(",
"CommandResponse",
"response",
")",
"{",
"String",
"message",
"=",
"I18nProvider",
".",
"getGlobal",
"(",
")",
".",
"commandError",
"(",
")",
"+",
"\":\"",
";",
"for",
"(",
"String",
"error",
":",
"response",
".",
"getErrorMessages",
"(",
")",
")",
"{",
"message",
"+=",
"\"\\n\"",
"+",
"error",
";",
"}",
"Log",
".",
"logWarn",
"(",
"message",
")",
";",
"if",
"(",
"response",
".",
"getExceptions",
"(",
")",
"==",
"null",
"||",
"response",
".",
"getExceptions",
"(",
")",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"SC",
".",
"warn",
"(",
"message",
")",
";",
"}",
"else",
"{",
"// The error messaging window only supports 1 exception to display:",
"ExceptionWindow",
"window",
"=",
"new",
"ExceptionWindow",
"(",
"response",
".",
"getExceptions",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
";",
"window",
".",
"show",
"(",
")",
";",
"}",
"}"
] |
Default behaviour for handling a command execution exception. Shows an exception report to the user.
@param response command response with error
|
[
"Default",
"behaviour",
"for",
"handling",
"a",
"command",
"execution",
"exception",
".",
"Shows",
"an",
"exception",
"report",
"to",
"the",
"user",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/GwtCommandCallback.java#L45-L58
|
147,274
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/FeatureAttributeWindow.java
|
FeatureAttributeWindow.setFeature
|
public void setFeature(Feature feature) {
List<Feature> features = new ArrayList<Feature>();
features.add(feature);
LazyLoader.lazyLoad(features, GeomajasConstant.FEATURE_INCLUDE_ATTRIBUTES, new LazyLoadCallback() {
public void execute(List<Feature> response) {
Feature feature = response.get(0);
if (attributeTable == null) {
buildWidget(feature.getLayer());
}
if (feature != null) {
setTitle(I18nProvider.getAttribute().getAttributeWindowTitle(feature.getLabel()));
} else {
setTitle(I18nProvider.getAttribute().getAttributeWindowTitle(""));
}
attributeTable.setFeature(feature);
}
});
}
|
java
|
public void setFeature(Feature feature) {
List<Feature> features = new ArrayList<Feature>();
features.add(feature);
LazyLoader.lazyLoad(features, GeomajasConstant.FEATURE_INCLUDE_ATTRIBUTES, new LazyLoadCallback() {
public void execute(List<Feature> response) {
Feature feature = response.get(0);
if (attributeTable == null) {
buildWidget(feature.getLayer());
}
if (feature != null) {
setTitle(I18nProvider.getAttribute().getAttributeWindowTitle(feature.getLabel()));
} else {
setTitle(I18nProvider.getAttribute().getAttributeWindowTitle(""));
}
attributeTable.setFeature(feature);
}
});
}
|
[
"public",
"void",
"setFeature",
"(",
"Feature",
"feature",
")",
"{",
"List",
"<",
"Feature",
">",
"features",
"=",
"new",
"ArrayList",
"<",
"Feature",
">",
"(",
")",
";",
"features",
".",
"add",
"(",
"feature",
")",
";",
"LazyLoader",
".",
"lazyLoad",
"(",
"features",
",",
"GeomajasConstant",
".",
"FEATURE_INCLUDE_ATTRIBUTES",
",",
"new",
"LazyLoadCallback",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
"List",
"<",
"Feature",
">",
"response",
")",
"{",
"Feature",
"feature",
"=",
"response",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"attributeTable",
"==",
"null",
")",
"{",
"buildWidget",
"(",
"feature",
".",
"getLayer",
"(",
")",
")",
";",
"}",
"if",
"(",
"feature",
"!=",
"null",
")",
"{",
"setTitle",
"(",
"I18nProvider",
".",
"getAttribute",
"(",
")",
".",
"getAttributeWindowTitle",
"(",
"feature",
".",
"getLabel",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"setTitle",
"(",
"I18nProvider",
".",
"getAttribute",
"(",
")",
".",
"getAttributeWindowTitle",
"(",
"\"\"",
")",
")",
";",
"}",
"attributeTable",
".",
"setFeature",
"(",
"feature",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Apply a new feature onto this widget, assuring the attributes are loaded.
@param feature feature
|
[
"Apply",
"a",
"new",
"feature",
"onto",
"this",
"widget",
"assuring",
"the",
"attributes",
"are",
"loaded",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/FeatureAttributeWindow.java#L196-L214
|
147,275
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/FeatureAttributeWindow.java
|
FeatureAttributeWindow.setEditingEnabled
|
public void setEditingEnabled(boolean editingEnabled) {
if (isEditingAllowed()) {
this.editingEnabled = editingEnabled;
if (editingEnabled) {
savePanel.setVisible(true);
if (attributeTable != null && attributeTable.isDisabled()) {
attributeTable.setDisabled(false);
}
} else {
savePanel.setVisible(false);
if (attributeTable != null && !attributeTable.isDisabled()) {
attributeTable.setDisabled(true);
}
}
}
}
|
java
|
public void setEditingEnabled(boolean editingEnabled) {
if (isEditingAllowed()) {
this.editingEnabled = editingEnabled;
if (editingEnabled) {
savePanel.setVisible(true);
if (attributeTable != null && attributeTable.isDisabled()) {
attributeTable.setDisabled(false);
}
} else {
savePanel.setVisible(false);
if (attributeTable != null && !attributeTable.isDisabled()) {
attributeTable.setDisabled(true);
}
}
}
}
|
[
"public",
"void",
"setEditingEnabled",
"(",
"boolean",
"editingEnabled",
")",
"{",
"if",
"(",
"isEditingAllowed",
"(",
")",
")",
"{",
"this",
".",
"editingEnabled",
"=",
"editingEnabled",
";",
"if",
"(",
"editingEnabled",
")",
"{",
"savePanel",
".",
"setVisible",
"(",
"true",
")",
";",
"if",
"(",
"attributeTable",
"!=",
"null",
"&&",
"attributeTable",
".",
"isDisabled",
"(",
")",
")",
"{",
"attributeTable",
".",
"setDisabled",
"(",
"false",
")",
";",
"}",
"}",
"else",
"{",
"savePanel",
".",
"setVisible",
"(",
"false",
")",
";",
"if",
"(",
"attributeTable",
"!=",
"null",
"&&",
"!",
"attributeTable",
".",
"isDisabled",
"(",
")",
")",
"{",
"attributeTable",
".",
"setDisabled",
"(",
"true",
")",
";",
"}",
"}",
"}",
"}"
] |
Is editing currently enabled or not? This widget can toggle this value on the fly. When editing is enabled, it
will display an editable attribute form with save, cancel and reset buttons. When editing is not enabled, these
buttons will disappear, and a simple attribute form is shown that displays the attribute values, but does not
allow for editing.
@param editingEnabled editing enabled status
|
[
"Is",
"editing",
"currently",
"enabled",
"or",
"not?",
"This",
"widget",
"can",
"toggle",
"this",
"value",
"on",
"the",
"fly",
".",
"When",
"editing",
"is",
"enabled",
"it",
"will",
"display",
"an",
"editable",
"attribute",
"form",
"with",
"save",
"cancel",
"and",
"reset",
"buttons",
".",
"When",
"editing",
"is",
"not",
"enabled",
"these",
"buttons",
"will",
"disappear",
"and",
"a",
"simple",
"attribute",
"form",
"is",
"shown",
"that",
"displays",
"the",
"attribute",
"values",
"but",
"does",
"not",
"allow",
"for",
"editing",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/FeatureAttributeWindow.java#L256-L271
|
147,276
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/util/GeometryConverter.java
|
GeometryConverter.toDto
|
public static Geometry toDto(org.geomajas.gwt.client.spatial.geometry.Geometry geometry) {
if (geometry == null) {
return null;
}
int srid = geometry.getSrid();
int precision = geometry.getPrecision();
Geometry dto;
if (geometry instanceof Point) {
dto = new Geometry(Geometry.POINT, srid, precision);
dto.setCoordinates(geometry.getCoordinates());
} else if (geometry instanceof LinearRing) {
dto = new Geometry(Geometry.LINEAR_RING, srid, precision);
dto.setCoordinates(geometry.getCoordinates());
} else if (geometry instanceof LineString) {
dto = new Geometry(Geometry.LINE_STRING, srid, precision);
dto.setCoordinates(geometry.getCoordinates());
} else if (geometry instanceof Polygon) {
dto = new Geometry(Geometry.POLYGON, srid, precision);
Polygon polygon = (Polygon) geometry;
if (!polygon.isEmpty()) {
Geometry[] geometries = new Geometry[polygon.getNumInteriorRing() + 1];
for (int i = 0; i < geometries.length; i++) {
if (i == 0) {
geometries[i] = toDto(polygon.getExteriorRing());
} else {
geometries[i] = toDto(polygon.getInteriorRingN(i - 1));
}
}
dto.setGeometries(geometries);
}
} else if (geometry instanceof MultiPoint) {
dto = new Geometry(Geometry.MULTI_POINT, srid, precision);
dto.setGeometries(convertGeometries(geometry));
} else if (geometry instanceof MultiLineString) {
dto = new Geometry(Geometry.MULTI_LINE_STRING, srid, precision);
dto.setGeometries(convertGeometries(geometry));
} else if (geometry instanceof MultiPolygon) {
dto = new Geometry(Geometry.MULTI_POLYGON, srid, precision);
dto.setGeometries(convertGeometries(geometry));
} else {
String msg = "GeometryConverter.toDto() unrecognized geometry type";
Log.logServer(Log.LEVEL_ERROR, msg);
throw new IllegalStateException(msg);
}
return dto;
}
|
java
|
public static Geometry toDto(org.geomajas.gwt.client.spatial.geometry.Geometry geometry) {
if (geometry == null) {
return null;
}
int srid = geometry.getSrid();
int precision = geometry.getPrecision();
Geometry dto;
if (geometry instanceof Point) {
dto = new Geometry(Geometry.POINT, srid, precision);
dto.setCoordinates(geometry.getCoordinates());
} else if (geometry instanceof LinearRing) {
dto = new Geometry(Geometry.LINEAR_RING, srid, precision);
dto.setCoordinates(geometry.getCoordinates());
} else if (geometry instanceof LineString) {
dto = new Geometry(Geometry.LINE_STRING, srid, precision);
dto.setCoordinates(geometry.getCoordinates());
} else if (geometry instanceof Polygon) {
dto = new Geometry(Geometry.POLYGON, srid, precision);
Polygon polygon = (Polygon) geometry;
if (!polygon.isEmpty()) {
Geometry[] geometries = new Geometry[polygon.getNumInteriorRing() + 1];
for (int i = 0; i < geometries.length; i++) {
if (i == 0) {
geometries[i] = toDto(polygon.getExteriorRing());
} else {
geometries[i] = toDto(polygon.getInteriorRingN(i - 1));
}
}
dto.setGeometries(geometries);
}
} else if (geometry instanceof MultiPoint) {
dto = new Geometry(Geometry.MULTI_POINT, srid, precision);
dto.setGeometries(convertGeometries(geometry));
} else if (geometry instanceof MultiLineString) {
dto = new Geometry(Geometry.MULTI_LINE_STRING, srid, precision);
dto.setGeometries(convertGeometries(geometry));
} else if (geometry instanceof MultiPolygon) {
dto = new Geometry(Geometry.MULTI_POLYGON, srid, precision);
dto.setGeometries(convertGeometries(geometry));
} else {
String msg = "GeometryConverter.toDto() unrecognized geometry type";
Log.logServer(Log.LEVEL_ERROR, msg);
throw new IllegalStateException(msg);
}
return dto;
}
|
[
"public",
"static",
"Geometry",
"toDto",
"(",
"org",
".",
"geomajas",
".",
"gwt",
".",
"client",
".",
"spatial",
".",
"geometry",
".",
"Geometry",
"geometry",
")",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"srid",
"=",
"geometry",
".",
"getSrid",
"(",
")",
";",
"int",
"precision",
"=",
"geometry",
".",
"getPrecision",
"(",
")",
";",
"Geometry",
"dto",
";",
"if",
"(",
"geometry",
"instanceof",
"Point",
")",
"{",
"dto",
"=",
"new",
"Geometry",
"(",
"Geometry",
".",
"POINT",
",",
"srid",
",",
"precision",
")",
";",
"dto",
".",
"setCoordinates",
"(",
"geometry",
".",
"getCoordinates",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"LinearRing",
")",
"{",
"dto",
"=",
"new",
"Geometry",
"(",
"Geometry",
".",
"LINEAR_RING",
",",
"srid",
",",
"precision",
")",
";",
"dto",
".",
"setCoordinates",
"(",
"geometry",
".",
"getCoordinates",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"LineString",
")",
"{",
"dto",
"=",
"new",
"Geometry",
"(",
"Geometry",
".",
"LINE_STRING",
",",
"srid",
",",
"precision",
")",
";",
"dto",
".",
"setCoordinates",
"(",
"geometry",
".",
"getCoordinates",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"Polygon",
")",
"{",
"dto",
"=",
"new",
"Geometry",
"(",
"Geometry",
".",
"POLYGON",
",",
"srid",
",",
"precision",
")",
";",
"Polygon",
"polygon",
"=",
"(",
"Polygon",
")",
"geometry",
";",
"if",
"(",
"!",
"polygon",
".",
"isEmpty",
"(",
")",
")",
"{",
"Geometry",
"[",
"]",
"geometries",
"=",
"new",
"Geometry",
"[",
"polygon",
".",
"getNumInteriorRing",
"(",
")",
"+",
"1",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"geometries",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"==",
"0",
")",
"{",
"geometries",
"[",
"i",
"]",
"=",
"toDto",
"(",
"polygon",
".",
"getExteriorRing",
"(",
")",
")",
";",
"}",
"else",
"{",
"geometries",
"[",
"i",
"]",
"=",
"toDto",
"(",
"polygon",
".",
"getInteriorRingN",
"(",
"i",
"-",
"1",
")",
")",
";",
"}",
"}",
"dto",
".",
"setGeometries",
"(",
"geometries",
")",
";",
"}",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"MultiPoint",
")",
"{",
"dto",
"=",
"new",
"Geometry",
"(",
"Geometry",
".",
"MULTI_POINT",
",",
"srid",
",",
"precision",
")",
";",
"dto",
".",
"setGeometries",
"(",
"convertGeometries",
"(",
"geometry",
")",
")",
";",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"MultiLineString",
")",
"{",
"dto",
"=",
"new",
"Geometry",
"(",
"Geometry",
".",
"MULTI_LINE_STRING",
",",
"srid",
",",
"precision",
")",
";",
"dto",
".",
"setGeometries",
"(",
"convertGeometries",
"(",
"geometry",
")",
")",
";",
"}",
"else",
"if",
"(",
"geometry",
"instanceof",
"MultiPolygon",
")",
"{",
"dto",
"=",
"new",
"Geometry",
"(",
"Geometry",
".",
"MULTI_POLYGON",
",",
"srid",
",",
"precision",
")",
";",
"dto",
".",
"setGeometries",
"(",
"convertGeometries",
"(",
"geometry",
")",
")",
";",
"}",
"else",
"{",
"String",
"msg",
"=",
"\"GeometryConverter.toDto() unrecognized geometry type\"",
";",
"Log",
".",
"logServer",
"(",
"Log",
".",
"LEVEL_ERROR",
",",
"msg",
")",
";",
"throw",
"new",
"IllegalStateException",
"(",
"msg",
")",
";",
"}",
"return",
"dto",
";",
"}"
] |
Takes in a GWT geometry, and creates a new DTO geometry from it.
@param geometry
The geometry to convert into a DTO geometry.
@return Returns a DTO type geometry, that is serializable.
|
[
"Takes",
"in",
"a",
"GWT",
"geometry",
"and",
"creates",
"a",
"new",
"DTO",
"geometry",
"from",
"it",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/util/GeometryConverter.java#L47-L94
|
147,277
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/util/GeometryConverter.java
|
GeometryConverter.toDto
|
public static Bbox toDto(org.geomajas.gwt.client.spatial.Bbox bbox) {
return new Bbox(bbox.getX(), bbox.getY(), bbox.getWidth(), bbox.getHeight());
}
|
java
|
public static Bbox toDto(org.geomajas.gwt.client.spatial.Bbox bbox) {
return new Bbox(bbox.getX(), bbox.getY(), bbox.getWidth(), bbox.getHeight());
}
|
[
"public",
"static",
"Bbox",
"toDto",
"(",
"org",
".",
"geomajas",
".",
"gwt",
".",
"client",
".",
"spatial",
".",
"Bbox",
"bbox",
")",
"{",
"return",
"new",
"Bbox",
"(",
"bbox",
".",
"getX",
"(",
")",
",",
"bbox",
".",
"getY",
"(",
")",
",",
"bbox",
".",
"getWidth",
"(",
")",
",",
"bbox",
".",
"getHeight",
"(",
")",
")",
";",
"}"
] |
Takes in a GWT bbox, and creates a new DTO bbox from it.
@param bbox
The bbox to convert into a DTO bbox.
@return Returns a DTO type bbox, that is serializable.
|
[
"Takes",
"in",
"a",
"GWT",
"bbox",
"and",
"creates",
"a",
"new",
"DTO",
"bbox",
"from",
"it",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/util/GeometryConverter.java#L169-L171
|
147,278
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/util/GeometryConverter.java
|
GeometryConverter.toGwt
|
public static org.geomajas.gwt.client.spatial.Bbox toGwt(Bbox bbox) {
return new org.geomajas.gwt.client.spatial.Bbox(bbox);
}
|
java
|
public static org.geomajas.gwt.client.spatial.Bbox toGwt(Bbox bbox) {
return new org.geomajas.gwt.client.spatial.Bbox(bbox);
}
|
[
"public",
"static",
"org",
".",
"geomajas",
".",
"gwt",
".",
"client",
".",
"spatial",
".",
"Bbox",
"toGwt",
"(",
"Bbox",
"bbox",
")",
"{",
"return",
"new",
"org",
".",
"geomajas",
".",
"gwt",
".",
"client",
".",
"spatial",
".",
"Bbox",
"(",
"bbox",
")",
";",
"}"
] |
Takes in a DTO bbox, and creates a new GWT bbox from it.
@param bbox
The bbox to convert into a GWT bbox.
@return Returns a GWT type bbox, that has functionality.
|
[
"Takes",
"in",
"a",
"DTO",
"bbox",
"and",
"creates",
"a",
"new",
"GWT",
"bbox",
"from",
"it",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/util/GeometryConverter.java#L180-L182
|
147,279
|
telegram-s/telegram-mt
|
src/main/java/org/telegram/mtproto/MTProto.java
|
MTProto.sendRpcMessage
|
public int sendRpcMessage(TLMethod request, long timeout, boolean highPriority) {
int id = scheduller.postMessage(request, true, timeout, highPriority);
Logger.d(TAG, "sendMessage #" + id + " " + request.toString() + " with timeout " + timeout + " ms");
return id;
}
|
java
|
public int sendRpcMessage(TLMethod request, long timeout, boolean highPriority) {
int id = scheduller.postMessage(request, true, timeout, highPriority);
Logger.d(TAG, "sendMessage #" + id + " " + request.toString() + " with timeout " + timeout + " ms");
return id;
}
|
[
"public",
"int",
"sendRpcMessage",
"(",
"TLMethod",
"request",
",",
"long",
"timeout",
",",
"boolean",
"highPriority",
")",
"{",
"int",
"id",
"=",
"scheduller",
".",
"postMessage",
"(",
"request",
",",
"true",
",",
"timeout",
",",
"highPriority",
")",
";",
"Logger",
".",
"d",
"(",
"TAG",
",",
"\"sendMessage #\"",
"+",
"id",
"+",
"\" \"",
"+",
"request",
".",
"toString",
"(",
")",
"+",
"\" with timeout \"",
"+",
"timeout",
"+",
"\" ms\"",
")",
";",
"return",
"id",
";",
"}"
] |
Sending rpc request
@param request request
@param timeout timeout of request
@param highPriority is hight priority request
@return request id
|
[
"Sending",
"rpc",
"request"
] |
57e3f635a6508705081eba9396ae24db050bc943
|
https://github.com/telegram-s/telegram-mt/blob/57e3f635a6508705081eba9396ae24db050bc943/src/main/java/org/telegram/mtproto/MTProto.java#L264-L268
|
147,280
|
telegram-s/telegram-mt
|
src/main/java/org/telegram/mtproto/MTProto.java
|
MTProto.switchMode
|
public void switchMode(int mode) {
if (this.mode != mode) {
this.mode = mode;
switch (mode) {
case MODE_GENERAL:
case MODE_PUSH:
transportPool.switchMode(TransportPool.MODE_DEFAULT);
break;
case MODE_GENERAL_LOW_MODE:
case MODE_FILE:
transportPool.switchMode(TransportPool.MODE_LOWMODE);
break;
}
this.actionsActor.sendOnce(new RequestPingDelay());
}
}
|
java
|
public void switchMode(int mode) {
if (this.mode != mode) {
this.mode = mode;
switch (mode) {
case MODE_GENERAL:
case MODE_PUSH:
transportPool.switchMode(TransportPool.MODE_DEFAULT);
break;
case MODE_GENERAL_LOW_MODE:
case MODE_FILE:
transportPool.switchMode(TransportPool.MODE_LOWMODE);
break;
}
this.actionsActor.sendOnce(new RequestPingDelay());
}
}
|
[
"public",
"void",
"switchMode",
"(",
"int",
"mode",
")",
"{",
"if",
"(",
"this",
".",
"mode",
"!=",
"mode",
")",
"{",
"this",
".",
"mode",
"=",
"mode",
";",
"switch",
"(",
"mode",
")",
"{",
"case",
"MODE_GENERAL",
":",
"case",
"MODE_PUSH",
":",
"transportPool",
".",
"switchMode",
"(",
"TransportPool",
".",
"MODE_DEFAULT",
")",
";",
"break",
";",
"case",
"MODE_GENERAL_LOW_MODE",
":",
"case",
"MODE_FILE",
":",
"transportPool",
".",
"switchMode",
"(",
"TransportPool",
".",
"MODE_LOWMODE",
")",
";",
"break",
";",
"}",
"this",
".",
"actionsActor",
".",
"sendOnce",
"(",
"new",
"RequestPingDelay",
"(",
")",
")",
";",
"}",
"}"
] |
Switch mode of mtproto
@param mode new mode
|
[
"Switch",
"mode",
"of",
"mtproto"
] |
57e3f635a6508705081eba9396ae24db050bc943
|
https://github.com/telegram-s/telegram-mt/blob/57e3f635a6508705081eba9396ae24db050bc943/src/main/java/org/telegram/mtproto/MTProto.java#L284-L302
|
147,281
|
telegram-s/telegram-mt
|
src/main/java/org/telegram/mtproto/MTProto.java
|
MTProto.onMTMessage
|
private void onMTMessage(MTMessage mtMessage) {
if (mtMessage.getSeqNo() % 2 == 1) {
scheduller.confirmMessage(mtMessage.getMessageId());
}
if (!needProcessing(mtMessage.getMessageId())) {
if (Logger.LOG_IGNORED) {
Logger.d(TAG, "Ignoring messages #" + mtMessage.getMessageId());
}
return;
}
try {
TLObject intMessage = protoContext.deserializeMessage(new ByteArrayInputStream(mtMessage.getContent()));
onMTProtoMessage(mtMessage.getMessageId(), intMessage);
} catch (DeserializeException e) {
callback.onApiMessage(mtMessage.getContent(), this);
} catch (IOException e) {
Logger.e(TAG, e);
// ???
}
}
|
java
|
private void onMTMessage(MTMessage mtMessage) {
if (mtMessage.getSeqNo() % 2 == 1) {
scheduller.confirmMessage(mtMessage.getMessageId());
}
if (!needProcessing(mtMessage.getMessageId())) {
if (Logger.LOG_IGNORED) {
Logger.d(TAG, "Ignoring messages #" + mtMessage.getMessageId());
}
return;
}
try {
TLObject intMessage = protoContext.deserializeMessage(new ByteArrayInputStream(mtMessage.getContent()));
onMTProtoMessage(mtMessage.getMessageId(), intMessage);
} catch (DeserializeException e) {
callback.onApiMessage(mtMessage.getContent(), this);
} catch (IOException e) {
Logger.e(TAG, e);
// ???
}
}
|
[
"private",
"void",
"onMTMessage",
"(",
"MTMessage",
"mtMessage",
")",
"{",
"if",
"(",
"mtMessage",
".",
"getSeqNo",
"(",
")",
"%",
"2",
"==",
"1",
")",
"{",
"scheduller",
".",
"confirmMessage",
"(",
"mtMessage",
".",
"getMessageId",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"needProcessing",
"(",
"mtMessage",
".",
"getMessageId",
"(",
")",
")",
")",
"{",
"if",
"(",
"Logger",
".",
"LOG_IGNORED",
")",
"{",
"Logger",
".",
"d",
"(",
"TAG",
",",
"\"Ignoring messages #\"",
"+",
"mtMessage",
".",
"getMessageId",
"(",
")",
")",
";",
"}",
"return",
";",
"}",
"try",
"{",
"TLObject",
"intMessage",
"=",
"protoContext",
".",
"deserializeMessage",
"(",
"new",
"ByteArrayInputStream",
"(",
"mtMessage",
".",
"getContent",
"(",
")",
")",
")",
";",
"onMTProtoMessage",
"(",
"mtMessage",
".",
"getMessageId",
"(",
")",
",",
"intMessage",
")",
";",
"}",
"catch",
"(",
"DeserializeException",
"e",
")",
"{",
"callback",
".",
"onApiMessage",
"(",
"mtMessage",
".",
"getContent",
"(",
")",
",",
"this",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Logger",
".",
"e",
"(",
"TAG",
",",
"e",
")",
";",
"// ???",
"}",
"}"
] |
Finding message type
|
[
"Finding",
"message",
"type"
] |
57e3f635a6508705081eba9396ae24db050bc943
|
https://github.com/telegram-s/telegram-mt/blob/57e3f635a6508705081eba9396ae24db050bc943/src/main/java/org/telegram/mtproto/MTProto.java#L330-L349
|
147,282
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/map/store/ClientWmsRasterLayerStore.java
|
ClientWmsRasterLayerStore.calculateTilesForBounds
|
private List<org.geomajas.layer.tile.RasterTile> calculateTilesForBounds(Bbox bounds) {
List<org.geomajas.layer.tile.RasterTile> tiles = new ArrayList<org.geomajas.layer.tile.RasterTile>();
if (bounds.getHeight() == 0 || bounds.getWidth() == 0) {
return tiles;
}
return tiles;
}
|
java
|
private List<org.geomajas.layer.tile.RasterTile> calculateTilesForBounds(Bbox bounds) {
List<org.geomajas.layer.tile.RasterTile> tiles = new ArrayList<org.geomajas.layer.tile.RasterTile>();
if (bounds.getHeight() == 0 || bounds.getWidth() == 0) {
return tiles;
}
return tiles;
}
|
[
"private",
"List",
"<",
"org",
".",
"geomajas",
".",
"layer",
".",
"tile",
".",
"RasterTile",
">",
"calculateTilesForBounds",
"(",
"Bbox",
"bounds",
")",
"{",
"List",
"<",
"org",
".",
"geomajas",
".",
"layer",
".",
"tile",
".",
"RasterTile",
">",
"tiles",
"=",
"new",
"ArrayList",
"<",
"org",
".",
"geomajas",
".",
"layer",
".",
"tile",
".",
"RasterTile",
">",
"(",
")",
";",
"if",
"(",
"bounds",
".",
"getHeight",
"(",
")",
"==",
"0",
"||",
"bounds",
".",
"getWidth",
"(",
")",
"==",
"0",
")",
"{",
"return",
"tiles",
";",
"}",
"return",
"tiles",
";",
"}"
] |
Method based on WmsTileServiceImpl in GWT2 client.
|
[
"Method",
"based",
"on",
"WmsTileServiceImpl",
"in",
"GWT2",
"client",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/store/ClientWmsRasterLayerStore.java#L109-L118
|
147,283
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/Toolbar.java
|
Toolbar.initialize
|
public void initialize(ClientMapInfo mapInfo) {
// remove previous members
super.removeMembers(getMembers());
// add new members
ClientToolbarInfo toolbarInfo = mapInfo.getToolbar();
if (toolbarInfo != null) {
for (ClientToolInfo tool : toolbarInfo.getTools()) {
String id = tool.getToolId();
if (ToolId.TOOL_SEPARATOR.equals(id)) {
addToolbarSeparator();
} else {
ToolbarBaseAction action = ToolbarRegistry.getToolbarAction(id, mapWidget);
if (action instanceof ConfigurableAction) {
for (Parameter parameter : tool.getParameters()) {
((ConfigurableAction) action).configure(parameter.getName(), parameter.getValue());
}
}
String description = tool.getDescription();
// Overrides tooltip parameter if description is set in ClientToolInfo.
if (null != description && !"".equals(description)) {
action.setTooltip(description);
}
if (action instanceof ToolbarWidget) {
super.addMember(((ToolbarWidget) action).getWidget());
} else if (action instanceof ToolbarCanvas) {
super.addMember(((ToolbarCanvas) action).getCanvas());
} else if (action instanceof ToolbarModalAction) {
addModalButton((ToolbarModalAction) action);
} else if (action instanceof ToolbarAction) {
addActionButton((ToolbarAction) action);
} else {
String msg = "Tool with id " + id + " unknown.";
Log.logError(msg); // console log
SC.warn(msg); // in your face
}
}
}
}
// add extra members
for (Canvas extra : extraCanvasMembers) {
super.addMember(extra);
}
}
|
java
|
public void initialize(ClientMapInfo mapInfo) {
// remove previous members
super.removeMembers(getMembers());
// add new members
ClientToolbarInfo toolbarInfo = mapInfo.getToolbar();
if (toolbarInfo != null) {
for (ClientToolInfo tool : toolbarInfo.getTools()) {
String id = tool.getToolId();
if (ToolId.TOOL_SEPARATOR.equals(id)) {
addToolbarSeparator();
} else {
ToolbarBaseAction action = ToolbarRegistry.getToolbarAction(id, mapWidget);
if (action instanceof ConfigurableAction) {
for (Parameter parameter : tool.getParameters()) {
((ConfigurableAction) action).configure(parameter.getName(), parameter.getValue());
}
}
String description = tool.getDescription();
// Overrides tooltip parameter if description is set in ClientToolInfo.
if (null != description && !"".equals(description)) {
action.setTooltip(description);
}
if (action instanceof ToolbarWidget) {
super.addMember(((ToolbarWidget) action).getWidget());
} else if (action instanceof ToolbarCanvas) {
super.addMember(((ToolbarCanvas) action).getCanvas());
} else if (action instanceof ToolbarModalAction) {
addModalButton((ToolbarModalAction) action);
} else if (action instanceof ToolbarAction) {
addActionButton((ToolbarAction) action);
} else {
String msg = "Tool with id " + id + " unknown.";
Log.logError(msg); // console log
SC.warn(msg); // in your face
}
}
}
}
// add extra members
for (Canvas extra : extraCanvasMembers) {
super.addMember(extra);
}
}
|
[
"public",
"void",
"initialize",
"(",
"ClientMapInfo",
"mapInfo",
")",
"{",
"// remove previous members",
"super",
".",
"removeMembers",
"(",
"getMembers",
"(",
")",
")",
";",
"// add new members",
"ClientToolbarInfo",
"toolbarInfo",
"=",
"mapInfo",
".",
"getToolbar",
"(",
")",
";",
"if",
"(",
"toolbarInfo",
"!=",
"null",
")",
"{",
"for",
"(",
"ClientToolInfo",
"tool",
":",
"toolbarInfo",
".",
"getTools",
"(",
")",
")",
"{",
"String",
"id",
"=",
"tool",
".",
"getToolId",
"(",
")",
";",
"if",
"(",
"ToolId",
".",
"TOOL_SEPARATOR",
".",
"equals",
"(",
"id",
")",
")",
"{",
"addToolbarSeparator",
"(",
")",
";",
"}",
"else",
"{",
"ToolbarBaseAction",
"action",
"=",
"ToolbarRegistry",
".",
"getToolbarAction",
"(",
"id",
",",
"mapWidget",
")",
";",
"if",
"(",
"action",
"instanceof",
"ConfigurableAction",
")",
"{",
"for",
"(",
"Parameter",
"parameter",
":",
"tool",
".",
"getParameters",
"(",
")",
")",
"{",
"(",
"(",
"ConfigurableAction",
")",
"action",
")",
".",
"configure",
"(",
"parameter",
".",
"getName",
"(",
")",
",",
"parameter",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"String",
"description",
"=",
"tool",
".",
"getDescription",
"(",
")",
";",
"// Overrides tooltip parameter if description is set in ClientToolInfo.",
"if",
"(",
"null",
"!=",
"description",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"description",
")",
")",
"{",
"action",
".",
"setTooltip",
"(",
"description",
")",
";",
"}",
"if",
"(",
"action",
"instanceof",
"ToolbarWidget",
")",
"{",
"super",
".",
"addMember",
"(",
"(",
"(",
"ToolbarWidget",
")",
"action",
")",
".",
"getWidget",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"action",
"instanceof",
"ToolbarCanvas",
")",
"{",
"super",
".",
"addMember",
"(",
"(",
"(",
"ToolbarCanvas",
")",
"action",
")",
".",
"getCanvas",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"action",
"instanceof",
"ToolbarModalAction",
")",
"{",
"addModalButton",
"(",
"(",
"ToolbarModalAction",
")",
"action",
")",
";",
"}",
"else",
"if",
"(",
"action",
"instanceof",
"ToolbarAction",
")",
"{",
"addActionButton",
"(",
"(",
"ToolbarAction",
")",
"action",
")",
";",
"}",
"else",
"{",
"String",
"msg",
"=",
"\"Tool with id \"",
"+",
"id",
"+",
"\" unknown.\"",
";",
"Log",
".",
"logError",
"(",
"msg",
")",
";",
"// console log",
"SC",
".",
"warn",
"(",
"msg",
")",
";",
"// in your face",
"}",
"}",
"}",
"}",
"// add extra members",
"for",
"(",
"Canvas",
"extra",
":",
"extraCanvasMembers",
")",
"{",
"super",
".",
"addMember",
"(",
"extra",
")",
";",
"}",
"}"
] |
Initialize this widget.
@param mapInfo map info
|
[
"Initialize",
"this",
"widget",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/Toolbar.java#L143-L187
|
147,284
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/Toolbar.java
|
Toolbar.addActionButton
|
public void addActionButton(final ToolbarAction action) {
final IButton button = new IButton();
button.setWidth(buttonSize);
button.setHeight(buttonSize);
button.setIconSize(buttonSize - WidgetLayout.toolbarStripHeight);
button.setIcon(action.getIcon());
button.setActionType(SelectionType.BUTTON);
button.addClickHandler(action);
button.setShowRollOver(false);
button.setShowFocused(false);
button.setTooltip(action.getTooltip());
button.setDisabled(action.isDisabled());
if (getMembers() != null && getMembers().length > 0) {
LayoutSpacer spacer = new LayoutSpacer();
spacer.setWidth(2);
super.addMember(spacer);
}
action.addToolbarActionHandler(new ToolbarActionHandler() {
public void onToolbarActionDisabled(ToolbarActionDisabledEvent event) {
button.setDisabled(true);
}
public void onToolbarActionEnabled(ToolbarActionEnabledEvent event) {
button.setDisabled(false);
}
});
super.addMember(button);
}
|
java
|
public void addActionButton(final ToolbarAction action) {
final IButton button = new IButton();
button.setWidth(buttonSize);
button.setHeight(buttonSize);
button.setIconSize(buttonSize - WidgetLayout.toolbarStripHeight);
button.setIcon(action.getIcon());
button.setActionType(SelectionType.BUTTON);
button.addClickHandler(action);
button.setShowRollOver(false);
button.setShowFocused(false);
button.setTooltip(action.getTooltip());
button.setDisabled(action.isDisabled());
if (getMembers() != null && getMembers().length > 0) {
LayoutSpacer spacer = new LayoutSpacer();
spacer.setWidth(2);
super.addMember(spacer);
}
action.addToolbarActionHandler(new ToolbarActionHandler() {
public void onToolbarActionDisabled(ToolbarActionDisabledEvent event) {
button.setDisabled(true);
}
public void onToolbarActionEnabled(ToolbarActionEnabledEvent event) {
button.setDisabled(false);
}
});
super.addMember(button);
}
|
[
"public",
"void",
"addActionButton",
"(",
"final",
"ToolbarAction",
"action",
")",
"{",
"final",
"IButton",
"button",
"=",
"new",
"IButton",
"(",
")",
";",
"button",
".",
"setWidth",
"(",
"buttonSize",
")",
";",
"button",
".",
"setHeight",
"(",
"buttonSize",
")",
";",
"button",
".",
"setIconSize",
"(",
"buttonSize",
"-",
"WidgetLayout",
".",
"toolbarStripHeight",
")",
";",
"button",
".",
"setIcon",
"(",
"action",
".",
"getIcon",
"(",
")",
")",
";",
"button",
".",
"setActionType",
"(",
"SelectionType",
".",
"BUTTON",
")",
";",
"button",
".",
"addClickHandler",
"(",
"action",
")",
";",
"button",
".",
"setShowRollOver",
"(",
"false",
")",
";",
"button",
".",
"setShowFocused",
"(",
"false",
")",
";",
"button",
".",
"setTooltip",
"(",
"action",
".",
"getTooltip",
"(",
")",
")",
";",
"button",
".",
"setDisabled",
"(",
"action",
".",
"isDisabled",
"(",
")",
")",
";",
"if",
"(",
"getMembers",
"(",
")",
"!=",
"null",
"&&",
"getMembers",
"(",
")",
".",
"length",
">",
"0",
")",
"{",
"LayoutSpacer",
"spacer",
"=",
"new",
"LayoutSpacer",
"(",
")",
";",
"spacer",
".",
"setWidth",
"(",
"2",
")",
";",
"super",
".",
"addMember",
"(",
"spacer",
")",
";",
"}",
"action",
".",
"addToolbarActionHandler",
"(",
"new",
"ToolbarActionHandler",
"(",
")",
"{",
"public",
"void",
"onToolbarActionDisabled",
"(",
"ToolbarActionDisabledEvent",
"event",
")",
"{",
"button",
".",
"setDisabled",
"(",
"true",
")",
";",
"}",
"public",
"void",
"onToolbarActionEnabled",
"(",
"ToolbarActionEnabledEvent",
"event",
")",
"{",
"button",
".",
"setDisabled",
"(",
"false",
")",
";",
"}",
"}",
")",
";",
"super",
".",
"addMember",
"(",
"button",
")",
";",
"}"
] |
Add a new action button to the toolbar. An action button is the kind of button that executes immediately when
clicked upon. It can not be selected or deselected, it just executes every click.
@param action
The actual action to execute on click.
|
[
"Add",
"a",
"new",
"action",
"button",
"to",
"the",
"toolbar",
".",
"An",
"action",
"button",
"is",
"the",
"kind",
"of",
"button",
"that",
"executes",
"immediately",
"when",
"clicked",
"upon",
".",
"It",
"can",
"not",
"be",
"selected",
"or",
"deselected",
"it",
"just",
"executes",
"every",
"click",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/Toolbar.java#L196-L225
|
147,285
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/widget/Toolbar.java
|
Toolbar.addToolbarSeparator
|
public void addToolbarSeparator() {
ToolStripSeparator stripSeparator = new ToolStripSeparator();
stripSeparator.setHeight(WidgetLayout.toolbarStripHeight);
super.addMember(stripSeparator);
}
|
java
|
public void addToolbarSeparator() {
ToolStripSeparator stripSeparator = new ToolStripSeparator();
stripSeparator.setHeight(WidgetLayout.toolbarStripHeight);
super.addMember(stripSeparator);
}
|
[
"public",
"void",
"addToolbarSeparator",
"(",
")",
"{",
"ToolStripSeparator",
"stripSeparator",
"=",
"new",
"ToolStripSeparator",
"(",
")",
";",
"stripSeparator",
".",
"setHeight",
"(",
"WidgetLayout",
".",
"toolbarStripHeight",
")",
";",
"super",
".",
"addMember",
"(",
"stripSeparator",
")",
";",
"}"
] |
Add a vertical line to the toolbar.
|
[
"Add",
"a",
"vertical",
"line",
"to",
"the",
"toolbar",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/Toolbar.java#L282-L286
|
147,286
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/spatial/snapping/SnappingMode.java
|
SnappingMode.setCoordinate
|
public void setCoordinate(Coordinate coordinate) {
if (coordinate == null) {
throw new IllegalArgumentException("Can't snap to a null coordinate.");
}
this.coordinate = coordinate;
bounds = new Bbox(coordinate.getX() - rule.getDistance(), coordinate.getY() - rule.getDistance(), rule
.getDistance() * 2, rule.getDistance() * 2);
distance = Double.MAX_VALUE;
snappedCoordinate = coordinate;
}
|
java
|
public void setCoordinate(Coordinate coordinate) {
if (coordinate == null) {
throw new IllegalArgumentException("Can't snap to a null coordinate.");
}
this.coordinate = coordinate;
bounds = new Bbox(coordinate.getX() - rule.getDistance(), coordinate.getY() - rule.getDistance(), rule
.getDistance() * 2, rule.getDistance() * 2);
distance = Double.MAX_VALUE;
snappedCoordinate = coordinate;
}
|
[
"public",
"void",
"setCoordinate",
"(",
"Coordinate",
"coordinate",
")",
"{",
"if",
"(",
"coordinate",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Can't snap to a null coordinate.\"",
")",
";",
"}",
"this",
".",
"coordinate",
"=",
"coordinate",
";",
"bounds",
"=",
"new",
"Bbox",
"(",
"coordinate",
".",
"getX",
"(",
")",
"-",
"rule",
".",
"getDistance",
"(",
")",
",",
"coordinate",
".",
"getY",
"(",
")",
"-",
"rule",
".",
"getDistance",
"(",
")",
",",
"rule",
".",
"getDistance",
"(",
")",
"*",
"2",
",",
"rule",
".",
"getDistance",
"(",
")",
"*",
"2",
")",
";",
"distance",
"=",
"Double",
".",
"MAX_VALUE",
";",
"snappedCoordinate",
"=",
"coordinate",
";",
"}"
] |
Set a new coordinate ready to be snapped.
|
[
"Set",
"a",
"new",
"coordinate",
"ready",
"to",
"be",
"snapped",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/snapping/SnappingMode.java#L79-L88
|
147,287
|
wnameless/rubycollect4j
|
src/main/java/net/sf/rubycollect4j/util/RegexUtils.java
|
RegexUtils.convertGlobToRegex
|
public static String convertGlobToRegex(String pattern) {
pattern = pattern.replaceAll("[\\\\\\.\\(\\)\\+\\|\\^\\$]", "\\\\$0");
pattern = pattern.replaceAll("\\[\\\\\\^", "[^");
pattern = Ruby.String.of(pattern).gsub("\\{[^\\}]+\\}", m -> {
m = m.replaceAll(",", "|");
m = "(" + m.substring(1, m.lastIndexOf('}')) + ")";
return m;
}).toS();
pattern = pattern.replaceAll("\\?", ".{1}");
pattern = pattern.replaceAll("\\*\\*/", "(.+/)?");
pattern = pattern.replaceAll("\\*", "[^/]*");
return pattern;
}
|
java
|
public static String convertGlobToRegex(String pattern) {
pattern = pattern.replaceAll("[\\\\\\.\\(\\)\\+\\|\\^\\$]", "\\\\$0");
pattern = pattern.replaceAll("\\[\\\\\\^", "[^");
pattern = Ruby.String.of(pattern).gsub("\\{[^\\}]+\\}", m -> {
m = m.replaceAll(",", "|");
m = "(" + m.substring(1, m.lastIndexOf('}')) + ")";
return m;
}).toS();
pattern = pattern.replaceAll("\\?", ".{1}");
pattern = pattern.replaceAll("\\*\\*/", "(.+/)?");
pattern = pattern.replaceAll("\\*", "[^/]*");
return pattern;
}
|
[
"public",
"static",
"String",
"convertGlobToRegex",
"(",
"String",
"pattern",
")",
"{",
"pattern",
"=",
"pattern",
".",
"replaceAll",
"(",
"\"[\\\\\\\\\\\\.\\\\(\\\\)\\\\+\\\\|\\\\^\\\\$]\"",
",",
"\"\\\\\\\\$0\"",
")",
";",
"pattern",
"=",
"pattern",
".",
"replaceAll",
"(",
"\"\\\\[\\\\\\\\\\\\^\"",
",",
"\"[^\"",
")",
";",
"pattern",
"=",
"Ruby",
".",
"String",
".",
"of",
"(",
"pattern",
")",
".",
"gsub",
"(",
"\"\\\\{[^\\\\}]+\\\\}\"",
",",
"m",
"->",
"{",
"m",
"=",
"m",
".",
"replaceAll",
"(",
"\",\"",
",",
"\"|\"",
")",
";",
"m",
"=",
"\"(\"",
"+",
"m",
".",
"substring",
"(",
"1",
",",
"m",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
")",
"+",
"\")\"",
";",
"return",
"m",
";",
"}",
")",
".",
"toS",
"(",
")",
";",
"pattern",
"=",
"pattern",
".",
"replaceAll",
"(",
"\"\\\\?\"",
",",
"\".{1}\"",
")",
";",
"pattern",
"=",
"pattern",
".",
"replaceAll",
"(",
"\"\\\\*\\\\*/\"",
",",
"\"(.+/)?\"",
")",
";",
"pattern",
"=",
"pattern",
".",
"replaceAll",
"(",
"\"\\\\*\"",
",",
"\"[^/]*\"",
")",
";",
"return",
"pattern",
";",
"}"
] |
Converts a glob pattern to Regex string.
@param pattern
a glob pattern
@return a Regex string
|
[
"Converts",
"a",
"glob",
"pattern",
"to",
"Regex",
"string",
"."
] |
b8b8d8eccaca2254a3d09b91745882fb7a0d5add
|
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/util/RegexUtils.java#L40-L53
|
147,288
|
lukin0110/poeditor-java
|
src/main/java/be/lukin/poeditor/POEditorClient.java
|
POEditorClient.addAdministrator
|
public boolean addAdministrator(String projectId, String name, String email){
ResponseWrapper wrapper = service.addProjectMember(Action.ADD_CONTRIBUTOR, apiKey, projectId, name, email, null, 1);
return "200".equals(wrapper.response.code);
}
|
java
|
public boolean addAdministrator(String projectId, String name, String email){
ResponseWrapper wrapper = service.addProjectMember(Action.ADD_CONTRIBUTOR, apiKey, projectId, name, email, null, 1);
return "200".equals(wrapper.response.code);
}
|
[
"public",
"boolean",
"addAdministrator",
"(",
"String",
"projectId",
",",
"String",
"name",
",",
"String",
"email",
")",
"{",
"ResponseWrapper",
"wrapper",
"=",
"service",
".",
"addProjectMember",
"(",
"Action",
".",
"ADD_CONTRIBUTOR",
",",
"apiKey",
",",
"projectId",
",",
"name",
",",
"email",
",",
"null",
",",
"1",
")",
";",
"return",
"\"200\"",
".",
"equals",
"(",
"wrapper",
".",
"response",
".",
"code",
")",
";",
"}"
] |
Create a new admin for a project
@param projectId id of the project
@param name name of the admin
@param email email of the admin
@return boolean if the administrator has been created
|
[
"Create",
"a",
"new",
"admin",
"for",
"a",
"project"
] |
42a2cd3136da1276b29a57a483c94050cc7d1d01
|
https://github.com/lukin0110/poeditor-java/blob/42a2cd3136da1276b29a57a483c94050cc7d1d01/src/main/java/be/lukin/poeditor/POEditorClient.java#L183-L186
|
147,289
|
lukin0110/poeditor-java
|
src/main/java/be/lukin/poeditor/POEditorClient.java
|
POEditorClient.addTerms
|
public TermsDetails addTerms(String projectId, List<Term> terms){
String jsonTerms = new Gson().toJson(terms);
EditTermsResponse atr = service.editTerms(Action.ADD_TERMS, apiKey, projectId, jsonTerms);
ApiUtils.checkResponse(atr.response);
return atr.details;
}
|
java
|
public TermsDetails addTerms(String projectId, List<Term> terms){
String jsonTerms = new Gson().toJson(terms);
EditTermsResponse atr = service.editTerms(Action.ADD_TERMS, apiKey, projectId, jsonTerms);
ApiUtils.checkResponse(atr.response);
return atr.details;
}
|
[
"public",
"TermsDetails",
"addTerms",
"(",
"String",
"projectId",
",",
"List",
"<",
"Term",
">",
"terms",
")",
"{",
"String",
"jsonTerms",
"=",
"new",
"Gson",
"(",
")",
".",
"toJson",
"(",
"terms",
")",
";",
"EditTermsResponse",
"atr",
"=",
"service",
".",
"editTerms",
"(",
"Action",
".",
"ADD_TERMS",
",",
"apiKey",
",",
"projectId",
",",
"jsonTerms",
")",
";",
"ApiUtils",
".",
"checkResponse",
"(",
"atr",
".",
"response",
")",
";",
"return",
"atr",
".",
"details",
";",
"}"
] |
Add new terms to a project
@param projectId id of the project
@param terms list of terms
@return details about the operation
|
[
"Add",
"new",
"terms",
"to",
"a",
"project"
] |
42a2cd3136da1276b29a57a483c94050cc7d1d01
|
https://github.com/lukin0110/poeditor-java/blob/42a2cd3136da1276b29a57a483c94050cc7d1d01/src/main/java/be/lukin/poeditor/POEditorClient.java#L210-L215
|
147,290
|
lukin0110/poeditor-java
|
src/main/java/be/lukin/poeditor/POEditorClient.java
|
POEditorClient.export
|
public File export(String projectId, String language, FileTypeEnum fte, FilterByEnum[] filters){
return export(projectId, language, fte, filters, null, null);
}
|
java
|
public File export(String projectId, String language, FileTypeEnum fte, FilterByEnum[] filters){
return export(projectId, language, fte, filters, null, null);
}
|
[
"public",
"File",
"export",
"(",
"String",
"projectId",
",",
"String",
"language",
",",
"FileTypeEnum",
"fte",
",",
"FilterByEnum",
"[",
"]",
"filters",
")",
"{",
"return",
"export",
"(",
"projectId",
",",
"language",
",",
"fte",
",",
"filters",
",",
"null",
",",
"null",
")",
";",
"}"
] |
Export a translation for a language of a project.
@param projectId id of the project
@param language language code
@param fte which type to export
@param filters which filter to apply
@return file object of the exported file
|
[
"Export",
"a",
"translation",
"for",
"a",
"language",
"of",
"a",
"project",
"."
] |
42a2cd3136da1276b29a57a483c94050cc7d1d01
|
https://github.com/lukin0110/poeditor-java/blob/42a2cd3136da1276b29a57a483c94050cc7d1d01/src/main/java/be/lukin/poeditor/POEditorClient.java#L233-L235
|
147,291
|
lukin0110/poeditor-java
|
src/main/java/be/lukin/poeditor/POEditorClient.java
|
POEditorClient.uploadTerms
|
public UploadDetails uploadTerms(String projectId, File translationFile, String[] allTags, String[] newTags, String[] obsoleteTags){
Map<String, String[]> tags = new HashMap<String, String[]>();
if(allTags != null) {
tags.put("all", allTags);
}
if(newTags != null) {
tags.put("new", newTags);
}
if(obsoleteTags != null) {
tags.put("obsolete", obsoleteTags);
}
String tagsStr = new Gson().toJson(tags);
TypedFile typedFile = new TypedFile("application/xml", translationFile);
UploadResponse ur = service.upload("upload", apiKey, projectId, "terms", typedFile, null, "0", tagsStr);
ApiUtils.checkResponse(ur.response);
return ur.details;
}
|
java
|
public UploadDetails uploadTerms(String projectId, File translationFile, String[] allTags, String[] newTags, String[] obsoleteTags){
Map<String, String[]> tags = new HashMap<String, String[]>();
if(allTags != null) {
tags.put("all", allTags);
}
if(newTags != null) {
tags.put("new", newTags);
}
if(obsoleteTags != null) {
tags.put("obsolete", obsoleteTags);
}
String tagsStr = new Gson().toJson(tags);
TypedFile typedFile = new TypedFile("application/xml", translationFile);
UploadResponse ur = service.upload("upload", apiKey, projectId, "terms", typedFile, null, "0", tagsStr);
ApiUtils.checkResponse(ur.response);
return ur.details;
}
|
[
"public",
"UploadDetails",
"uploadTerms",
"(",
"String",
"projectId",
",",
"File",
"translationFile",
",",
"String",
"[",
"]",
"allTags",
",",
"String",
"[",
"]",
"newTags",
",",
"String",
"[",
"]",
"obsoleteTags",
")",
"{",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"tags",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
"[",
"]",
">",
"(",
")",
";",
"if",
"(",
"allTags",
"!=",
"null",
")",
"{",
"tags",
".",
"put",
"(",
"\"all\"",
",",
"allTags",
")",
";",
"}",
"if",
"(",
"newTags",
"!=",
"null",
")",
"{",
"tags",
".",
"put",
"(",
"\"new\"",
",",
"newTags",
")",
";",
"}",
"if",
"(",
"obsoleteTags",
"!=",
"null",
")",
"{",
"tags",
".",
"put",
"(",
"\"obsolete\"",
",",
"obsoleteTags",
")",
";",
"}",
"String",
"tagsStr",
"=",
"new",
"Gson",
"(",
")",
".",
"toJson",
"(",
"tags",
")",
";",
"TypedFile",
"typedFile",
"=",
"new",
"TypedFile",
"(",
"\"application/xml\"",
",",
"translationFile",
")",
";",
"UploadResponse",
"ur",
"=",
"service",
".",
"upload",
"(",
"\"upload\"",
",",
"apiKey",
",",
"projectId",
",",
"\"terms\"",
",",
"typedFile",
",",
"null",
",",
"\"0\"",
",",
"tagsStr",
")",
";",
"ApiUtils",
".",
"checkResponse",
"(",
"ur",
".",
"response",
")",
";",
"return",
"ur",
".",
"details",
";",
"}"
] |
Uploads a translation file. For the moment it only takes terms into account.
@param projectId id of the project
@param translationFile terms file to upload
@param allTags - for the all the imported terms
@param newTags - for the terms which aren't already in the project
@param obsoleteTags - for the terms which are in the project but not in the imported file and "overwritten_translations"
@return UploadDetails
|
[
"Uploads",
"a",
"translation",
"file",
".",
"For",
"the",
"moment",
"it",
"only",
"takes",
"terms",
"into",
"account",
"."
] |
42a2cd3136da1276b29a57a483c94050cc7d1d01
|
https://github.com/lukin0110/poeditor-java/blob/42a2cd3136da1276b29a57a483c94050cc7d1d01/src/main/java/be/lukin/poeditor/POEditorClient.java#L287-L307
|
147,292
|
geomajas/geomajas-project-client-gwt
|
client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgPathDecoder.java
|
SvgPathDecoder.decodeLineString
|
private static String decodeLineString(LineString lineString) {
if (lineString == null || lineString.isEmpty()) {
return "";
}
StringBuilder buffer = new StringBuilder();
Coordinate[] coordinates = lineString.getCoordinates();
for (int i = 0; i < coordinates.length; i++) {
buffer.append(getX(coordinates[i]));
buffer.append(" ");
buffer.append(getY(coordinates[i]));
if (i < (coordinates.length - 1)) {
buffer.append(", ");
}
}
return "M" + buffer.toString();
}
|
java
|
private static String decodeLineString(LineString lineString) {
if (lineString == null || lineString.isEmpty()) {
return "";
}
StringBuilder buffer = new StringBuilder();
Coordinate[] coordinates = lineString.getCoordinates();
for (int i = 0; i < coordinates.length; i++) {
buffer.append(getX(coordinates[i]));
buffer.append(" ");
buffer.append(getY(coordinates[i]));
if (i < (coordinates.length - 1)) {
buffer.append(", ");
}
}
return "M" + buffer.toString();
}
|
[
"private",
"static",
"String",
"decodeLineString",
"(",
"LineString",
"lineString",
")",
"{",
"if",
"(",
"lineString",
"==",
"null",
"||",
"lineString",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Coordinate",
"[",
"]",
"coordinates",
"=",
"lineString",
".",
"getCoordinates",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"coordinates",
".",
"length",
";",
"i",
"++",
")",
"{",
"buffer",
".",
"append",
"(",
"getX",
"(",
"coordinates",
"[",
"i",
"]",
")",
")",
";",
"buffer",
".",
"append",
"(",
"\" \"",
")",
";",
"buffer",
".",
"append",
"(",
"getY",
"(",
"coordinates",
"[",
"i",
"]",
")",
")",
";",
"if",
"(",
"i",
"<",
"(",
"coordinates",
".",
"length",
"-",
"1",
")",
")",
"{",
"buffer",
".",
"append",
"(",
"\", \"",
")",
";",
"}",
"}",
"return",
"\"M\"",
"+",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
] |
Decode LineString.
@param lineString
@return
|
[
"Decode",
"LineString",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgPathDecoder.java#L83-L98
|
147,293
|
geomajas/geomajas-project-client-gwt
|
plugin/editing/editing-javascript-api/src/main/java/org/geomajas/plugin/editing/jsapi/client/service/JsGeometryIndexStateService.java
|
JsGeometryIndexStateService.getSelection
|
GeometryIndex[] getSelection() {
List<GeometryIndex> indices = delegate.getSelection();
return indices.toArray(new GeometryIndex[indices.size()]);
}
|
java
|
GeometryIndex[] getSelection() {
List<GeometryIndex> indices = delegate.getSelection();
return indices.toArray(new GeometryIndex[indices.size()]);
}
|
[
"GeometryIndex",
"[",
"]",
"getSelection",
"(",
")",
"{",
"List",
"<",
"GeometryIndex",
">",
"indices",
"=",
"delegate",
".",
"getSelection",
"(",
")",
";",
"return",
"indices",
".",
"toArray",
"(",
"new",
"GeometryIndex",
"[",
"indices",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] |
Get the current selection. Do not make changes on this list!
@return The current selection (vertices/edges/sub-geometries).
|
[
"Get",
"the",
"current",
"selection",
".",
"Do",
"not",
"make",
"changes",
"on",
"this",
"list!"
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/editing/editing-javascript-api/src/main/java/org/geomajas/plugin/editing/jsapi/client/service/JsGeometryIndexStateService.java#L177-L180
|
147,294
|
seedstack/i18n-addon
|
rest/src/main/java/org/seedstack/i18n/rest/internal/shared/BooleanUtils.java
|
BooleanUtils.falseToNull
|
@SuppressFBWarnings(value = "NP_BOOLEAN_RETURN_NULL", justification = "That's the point (but dubious)")
public static Boolean falseToNull(Boolean bool) {
if (bool != null && bool) {
return true;
}
return null;
}
|
java
|
@SuppressFBWarnings(value = "NP_BOOLEAN_RETURN_NULL", justification = "That's the point (but dubious)")
public static Boolean falseToNull(Boolean bool) {
if (bool != null && bool) {
return true;
}
return null;
}
|
[
"@",
"SuppressFBWarnings",
"(",
"value",
"=",
"\"NP_BOOLEAN_RETURN_NULL\"",
",",
"justification",
"=",
"\"That's the point (but dubious)\"",
")",
"public",
"static",
"Boolean",
"falseToNull",
"(",
"Boolean",
"bool",
")",
"{",
"if",
"(",
"bool",
"!=",
"null",
"&&",
"bool",
")",
"{",
"return",
"true",
";",
"}",
"return",
"null",
";",
"}"
] |
If bool is false change it to null, otherwise do nothing.
@param bool boolean
@return true if bool is true, null otherwise
|
[
"If",
"bool",
"is",
"false",
"change",
"it",
"to",
"null",
"otherwise",
"do",
"nothing",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/shared/BooleanUtils.java#L30-L36
|
147,295
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/widget/DockableWindow.java
|
DockableWindow.mixin
|
public static void mixin(Window window) {
final Docker docker = new Docker(window);
window.addMinimizeClickHandler(docker);
window.addRestoreClickHandler(docker);
}
|
java
|
public static void mixin(Window window) {
final Docker docker = new Docker(window);
window.addMinimizeClickHandler(docker);
window.addRestoreClickHandler(docker);
}
|
[
"public",
"static",
"void",
"mixin",
"(",
"Window",
"window",
")",
"{",
"final",
"Docker",
"docker",
"=",
"new",
"Docker",
"(",
"window",
")",
";",
"window",
".",
"addMinimizeClickHandler",
"(",
"docker",
")",
";",
"window",
".",
"addRestoreClickHandler",
"(",
"docker",
")",
";",
"}"
] |
Add the functionality to an existing window.
@param window
the window to which you want to add docking functionality.
|
[
"Add",
"the",
"functionality",
"to",
"an",
"existing",
"window",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/widget/DockableWindow.java#L79-L83
|
147,296
|
geomajas/geomajas-project-client-gwt
|
plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/widget/DockableWindow.java
|
DockableWindow.createDefaultDock
|
public static HLayout createDefaultDock() {
HLayout windowDock = new HLayout(5);
windowDock.setHeight(22);
windowDock.setAutoWidth();
windowDock.setSnapTo("BL");
windowDock.setSnapOffsetTop(-0);
windowDock.setSnapOffsetLeft(0);
windowDock.setBorder("thin dashed red");
return windowDock;
}
|
java
|
public static HLayout createDefaultDock() {
HLayout windowDock = new HLayout(5);
windowDock.setHeight(22);
windowDock.setAutoWidth();
windowDock.setSnapTo("BL");
windowDock.setSnapOffsetTop(-0);
windowDock.setSnapOffsetLeft(0);
windowDock.setBorder("thin dashed red");
return windowDock;
}
|
[
"public",
"static",
"HLayout",
"createDefaultDock",
"(",
")",
"{",
"HLayout",
"windowDock",
"=",
"new",
"HLayout",
"(",
"5",
")",
";",
"windowDock",
".",
"setHeight",
"(",
"22",
")",
";",
"windowDock",
".",
"setAutoWidth",
"(",
")",
";",
"windowDock",
".",
"setSnapTo",
"(",
"\"BL\"",
")",
";",
"windowDock",
".",
"setSnapOffsetTop",
"(",
"-",
"0",
")",
";",
"windowDock",
".",
"setSnapOffsetLeft",
"(",
"0",
")",
";",
"windowDock",
".",
"setBorder",
"(",
"\"thin dashed red\"",
")",
";",
"return",
"windowDock",
";",
"}"
] |
This will create a windowDock based on a HLayout and placed in the
dockParent if provided.
@return a WindowDock
|
[
"This",
"will",
"create",
"a",
"windowDock",
"based",
"on",
"a",
"HLayout",
"and",
"placed",
"in",
"the",
"dockParent",
"if",
"provided",
"."
] |
1c1adc48deb192ed825265eebcc74d70bbf45670
|
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/widget/DockableWindow.java#L91-L100
|
147,297
|
seedstack/i18n-addon
|
rest/src/main/java/org/seedstack/i18n/rest/internal/io/IOResource.java
|
IOResource.importTranslations
|
@POST
@Consumes("multipart/form-data")
@RequiresPermissions(I18nPermissions.KEY_WRITE)
public Response importTranslations(FormDataMultiPart multiPart) {
WebAssertions.assertNotNull(multiPart, "Missing input file");
int importedKeys = 0;
for (BodyPart bodyPart : multiPart.getBodyParts()) {
importedKeys += importFile(bodyPart);
}
String importedKeysMessage = String.format(LOADED_KEYS_MESSAGE, importedKeys);
LOGGER.debug(importedKeysMessage);
return Response.ok(importedKeysMessage, MediaType.TEXT_PLAIN_TYPE).build();
}
|
java
|
@POST
@Consumes("multipart/form-data")
@RequiresPermissions(I18nPermissions.KEY_WRITE)
public Response importTranslations(FormDataMultiPart multiPart) {
WebAssertions.assertNotNull(multiPart, "Missing input file");
int importedKeys = 0;
for (BodyPart bodyPart : multiPart.getBodyParts()) {
importedKeys += importFile(bodyPart);
}
String importedKeysMessage = String.format(LOADED_KEYS_MESSAGE, importedKeys);
LOGGER.debug(importedKeysMessage);
return Response.ok(importedKeysMessage, MediaType.TEXT_PLAIN_TYPE).build();
}
|
[
"@",
"POST",
"@",
"Consumes",
"(",
"\"multipart/form-data\"",
")",
"@",
"RequiresPermissions",
"(",
"I18nPermissions",
".",
"KEY_WRITE",
")",
"public",
"Response",
"importTranslations",
"(",
"FormDataMultiPart",
"multiPart",
")",
"{",
"WebAssertions",
".",
"assertNotNull",
"(",
"multiPart",
",",
"\"Missing input file\"",
")",
";",
"int",
"importedKeys",
"=",
"0",
";",
"for",
"(",
"BodyPart",
"bodyPart",
":",
"multiPart",
".",
"getBodyParts",
"(",
")",
")",
"{",
"importedKeys",
"+=",
"importFile",
"(",
"bodyPart",
")",
";",
"}",
"String",
"importedKeysMessage",
"=",
"String",
".",
"format",
"(",
"LOADED_KEYS_MESSAGE",
",",
"importedKeys",
")",
";",
"LOGGER",
".",
"debug",
"(",
"importedKeysMessage",
")",
";",
"return",
"Response",
".",
"ok",
"(",
"importedKeysMessage",
",",
"MediaType",
".",
"TEXT_PLAIN_TYPE",
")",
".",
"build",
"(",
")",
";",
"}"
] |
Imports one or more CSV files containing i18n keys with their translations.
@param multiPart multipart data
@return status code 200, or 400 if the multipart is null
|
[
"Imports",
"one",
"or",
"more",
"CSV",
"files",
"containing",
"i18n",
"keys",
"with",
"their",
"translations",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/io/IOResource.java#L76-L90
|
147,298
|
seedstack/i18n-addon
|
rest/src/main/java/org/seedstack/i18n/rest/internal/io/IOResource.java
|
IOResource.exportTranslations
|
@GET
@Produces(MediaType.TEXT_PLAIN)
@RequiresPermissions(I18nPermissions.KEY_READ)
public Response exportTranslations() {
final List<Key> keys = keyRepository.loadAll();
return Response.ok(new StreamingOutput() {
private boolean isFirstLine = true;
@Override
public void write(OutputStream os) throws IOException {
Writer writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
for (Key key : keys) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
renderer.render(byteArrayOutputStream, key, APPLICATION_CSV, printHeader(isFirstLine));
writer.write(byteArrayOutputStream.toString("UTF-8"));
isFirstLine = false;
}
writer.flush();
}
}).header(CONTENT_DISPOSITION, ATTACHMENT_FILENAME_I18N_CSV).build();
}
|
java
|
@GET
@Produces(MediaType.TEXT_PLAIN)
@RequiresPermissions(I18nPermissions.KEY_READ)
public Response exportTranslations() {
final List<Key> keys = keyRepository.loadAll();
return Response.ok(new StreamingOutput() {
private boolean isFirstLine = true;
@Override
public void write(OutputStream os) throws IOException {
Writer writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
for (Key key : keys) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
renderer.render(byteArrayOutputStream, key, APPLICATION_CSV, printHeader(isFirstLine));
writer.write(byteArrayOutputStream.toString("UTF-8"));
isFirstLine = false;
}
writer.flush();
}
}).header(CONTENT_DISPOSITION, ATTACHMENT_FILENAME_I18N_CSV).build();
}
|
[
"@",
"GET",
"@",
"Produces",
"(",
"MediaType",
".",
"TEXT_PLAIN",
")",
"@",
"RequiresPermissions",
"(",
"I18nPermissions",
".",
"KEY_READ",
")",
"public",
"Response",
"exportTranslations",
"(",
")",
"{",
"final",
"List",
"<",
"Key",
">",
"keys",
"=",
"keyRepository",
".",
"loadAll",
"(",
")",
";",
"return",
"Response",
".",
"ok",
"(",
"new",
"StreamingOutput",
"(",
")",
"{",
"private",
"boolean",
"isFirstLine",
"=",
"true",
";",
"@",
"Override",
"public",
"void",
"write",
"(",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"Writer",
"writer",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"os",
",",
"\"UTF-8\"",
")",
")",
";",
"for",
"(",
"Key",
"key",
":",
"keys",
")",
"{",
"ByteArrayOutputStream",
"byteArrayOutputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"renderer",
".",
"render",
"(",
"byteArrayOutputStream",
",",
"key",
",",
"APPLICATION_CSV",
",",
"printHeader",
"(",
"isFirstLine",
")",
")",
";",
"writer",
".",
"write",
"(",
"byteArrayOutputStream",
".",
"toString",
"(",
"\"UTF-8\"",
")",
")",
";",
"isFirstLine",
"=",
"false",
";",
"}",
"writer",
".",
"flush",
"(",
")",
";",
"}",
"}",
")",
".",
"header",
"(",
"CONTENT_DISPOSITION",
",",
"ATTACHMENT_FILENAME_I18N_CSV",
")",
".",
"build",
"(",
")",
";",
"}"
] |
Streams a CSV file with all keys with their translations.
@return an i18n.csv file
|
[
"Streams",
"a",
"CSV",
"file",
"with",
"all",
"keys",
"with",
"their",
"translations",
"."
] |
1e65101d8554623f09bda2497b0151fd10a16615
|
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/main/java/org/seedstack/i18n/rest/internal/io/IOResource.java#L111-L133
|
147,299
|
lukin0110/poeditor-java
|
src/main/java/be/lukin/poeditor/JarMain.java
|
JarMain.main
|
public static void main(String[] args) throws IOException {
if(args.length == 0){
System.out.println("No command given, choose: \n\tinit\n\tpull\n\tpush\n\tpushTerms");
return;
}
Map<String, String> parameters = new HashMap<String, String>();
if(args.length > 1){
for(String s : args){
String[] splitted = s.split("=");
if(splitted.length==2){
parameters.put(splitted[0], splitted[1]);
}
}
}
// Read config
Path current = Paths.get("");
File configFile = new File(current.toAbsolutePath().toString(), "poeditor.properties");
Config config = Config.load(configFile);
BaseTask task = null;
if("init".equals(args[0])){
System.out.println("Initialize project");
task = new InitTask();
} else if("pull".equals(args[0])) {
System.out.println("Pull languages");
task = new PullTask();
} else if("push".equals(args[0])){
System.out.println("Push languages");
task = new PushTask();
} else if("pushTerms".equals(args[0])){
System.out.println("Push terms");
task = new PushTermsTask();
} else if("generate".equals(args[0])){
System.out.println("Generate config");
task = new GenerateTask();
} else if("status".equals(args[0])){
System.out.println("Status");
task = new StatusTask();
}
if(task != null) {
task.configure(config, parameters);
task.handle();
}
}
|
java
|
public static void main(String[] args) throws IOException {
if(args.length == 0){
System.out.println("No command given, choose: \n\tinit\n\tpull\n\tpush\n\tpushTerms");
return;
}
Map<String, String> parameters = new HashMap<String, String>();
if(args.length > 1){
for(String s : args){
String[] splitted = s.split("=");
if(splitted.length==2){
parameters.put(splitted[0], splitted[1]);
}
}
}
// Read config
Path current = Paths.get("");
File configFile = new File(current.toAbsolutePath().toString(), "poeditor.properties");
Config config = Config.load(configFile);
BaseTask task = null;
if("init".equals(args[0])){
System.out.println("Initialize project");
task = new InitTask();
} else if("pull".equals(args[0])) {
System.out.println("Pull languages");
task = new PullTask();
} else if("push".equals(args[0])){
System.out.println("Push languages");
task = new PushTask();
} else if("pushTerms".equals(args[0])){
System.out.println("Push terms");
task = new PushTermsTask();
} else if("generate".equals(args[0])){
System.out.println("Generate config");
task = new GenerateTask();
} else if("status".equals(args[0])){
System.out.println("Status");
task = new StatusTask();
}
if(task != null) {
task.configure(config, parameters);
task.handle();
}
}
|
[
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"if",
"(",
"args",
".",
"length",
"==",
"0",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"No command given, choose: \\n\\tinit\\n\\tpull\\n\\tpush\\n\\tpushTerms\"",
")",
";",
"return",
";",
"}",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"if",
"(",
"args",
".",
"length",
">",
"1",
")",
"{",
"for",
"(",
"String",
"s",
":",
"args",
")",
"{",
"String",
"[",
"]",
"splitted",
"=",
"s",
".",
"split",
"(",
"\"=\"",
")",
";",
"if",
"(",
"splitted",
".",
"length",
"==",
"2",
")",
"{",
"parameters",
".",
"put",
"(",
"splitted",
"[",
"0",
"]",
",",
"splitted",
"[",
"1",
"]",
")",
";",
"}",
"}",
"}",
"// Read config",
"Path",
"current",
"=",
"Paths",
".",
"get",
"(",
"\"\"",
")",
";",
"File",
"configFile",
"=",
"new",
"File",
"(",
"current",
".",
"toAbsolutePath",
"(",
")",
".",
"toString",
"(",
")",
",",
"\"poeditor.properties\"",
")",
";",
"Config",
"config",
"=",
"Config",
".",
"load",
"(",
"configFile",
")",
";",
"BaseTask",
"task",
"=",
"null",
";",
"if",
"(",
"\"init\"",
".",
"equals",
"(",
"args",
"[",
"0",
"]",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Initialize project\"",
")",
";",
"task",
"=",
"new",
"InitTask",
"(",
")",
";",
"}",
"else",
"if",
"(",
"\"pull\"",
".",
"equals",
"(",
"args",
"[",
"0",
"]",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Pull languages\"",
")",
";",
"task",
"=",
"new",
"PullTask",
"(",
")",
";",
"}",
"else",
"if",
"(",
"\"push\"",
".",
"equals",
"(",
"args",
"[",
"0",
"]",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Push languages\"",
")",
";",
"task",
"=",
"new",
"PushTask",
"(",
")",
";",
"}",
"else",
"if",
"(",
"\"pushTerms\"",
".",
"equals",
"(",
"args",
"[",
"0",
"]",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Push terms\"",
")",
";",
"task",
"=",
"new",
"PushTermsTask",
"(",
")",
";",
"}",
"else",
"if",
"(",
"\"generate\"",
".",
"equals",
"(",
"args",
"[",
"0",
"]",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Generate config\"",
")",
";",
"task",
"=",
"new",
"GenerateTask",
"(",
")",
";",
"}",
"else",
"if",
"(",
"\"status\"",
".",
"equals",
"(",
"args",
"[",
"0",
"]",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Status\"",
")",
";",
"task",
"=",
"new",
"StatusTask",
"(",
")",
";",
"}",
"if",
"(",
"task",
"!=",
"null",
")",
"{",
"task",
".",
"configure",
"(",
"config",
",",
"parameters",
")",
";",
"task",
".",
"handle",
"(",
")",
";",
"}",
"}"
] |
By default read config from current dir
@param args cmd
@throws java.io.IOException when the configuration file can't be found
|
[
"By",
"default",
"read",
"config",
"from",
"current",
"dir"
] |
42a2cd3136da1276b29a57a483c94050cc7d1d01
|
https://github.com/lukin0110/poeditor-java/blob/42a2cd3136da1276b29a57a483c94050cc7d1d01/src/main/java/be/lukin/poeditor/JarMain.java#L20-L71
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.