Add a JavaScript function to obtain the vertices of a Polygon.
This commit is contained in:
parent
e2f0f34394
commit
bb1c2813be
2 changed files with 59 additions and 16 deletions
|
@ -92,21 +92,27 @@ public class AreaObject extends ConstructionObject implements InsideObject,
|
|||
return "Polygon";
|
||||
}
|
||||
|
||||
public String getVertexString(String sep) {
|
||||
String ret = "";
|
||||
boolean first = true;
|
||||
final Enumeration en = V.elements();
|
||||
while (en.hasMoreElements()) {
|
||||
final PointObject p = (PointObject) en.nextElement();
|
||||
if (!first) {
|
||||
ret = ret + sep;
|
||||
} else {
|
||||
first = false;
|
||||
}
|
||||
ret = ret + p.getName();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateText() {
|
||||
String Text=Global.name("text.area");
|
||||
final Enumeration en=V.elements();
|
||||
boolean first=true;
|
||||
while (en.hasMoreElements()) {
|
||||
final PointObject p=(PointObject) en.nextElement();
|
||||
if (!first) {
|
||||
Text=Text+", ";
|
||||
} else {
|
||||
Text=Text+" ";
|
||||
}
|
||||
first=false;
|
||||
Text=Text+p.getName();
|
||||
}
|
||||
Text = Text + " ";
|
||||
Text = Text + getVertexString(", ");
|
||||
setText(Text);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue