Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
5c4c9573
Commit
5c4c9573
authored
Apr 10, 2019
by
Evan W. Patton
Committed by
Jeffrey Schiller
Apr 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issues with HolePointsFromString in Polygon (#1654)
Change-Id: I9b23ee39bb46e63d56e4bd7b6cc24b8d32cdade3
parent
6d606ea1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockPolygon.java
...inventor/client/editor/simple/components/MockPolygon.java
+2
-2
appinventor/components/src/com/google/appinventor/components/runtime/Polygon.java
...rc/com/google/appinventor/components/runtime/Polygon.java
+24
-7
No files found.
appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockPolygon.java
View file @
5c4c9573
...
@@ -256,8 +256,8 @@ public class MockPolygon extends MockPolygonBase {
...
@@ -256,8 +256,8 @@ public class MockPolygon extends MockPolygonBase {
}
}
for (var i = 1; i < latlngs.length; i++) {
for (var i = 1; i < latlngs.length; i++) {
var hole = [];
var hole = [];
for (var j = 0; j < latlngs[i].length;
i
++) {
for (var j = 0; j < latlngs[i].length;
j
++) {
hole
sJson
.push([latlngs[i][j].lat, latlngs[i][j].lng]);
hole.push([latlngs[i][j].lat, latlngs[i][j].lng]);
}
}
holesJson.push(hole);
holesJson.push(hole);
}
}
...
...
appinventor/components/src/com/google/appinventor/components/runtime/Polygon.java
View file @
5c4c9573
...
@@ -46,6 +46,7 @@ public class Polygon extends PolygonBase implements MapPolygon {
...
@@ -46,6 +46,7 @@ public class Polygon extends PolygonBase implements MapPolygon {
private
List
<
List
<
GeoPoint
>>
points
=
new
ArrayList
<
List
<
GeoPoint
>>();
private
List
<
List
<
GeoPoint
>>
points
=
new
ArrayList
<
List
<
GeoPoint
>>();
private
List
<
List
<
List
<
GeoPoint
>>>
holePoints
=
new
ArrayList
<
List
<
List
<
GeoPoint
>>>();
private
List
<
List
<
List
<
GeoPoint
>>>
holePoints
=
new
ArrayList
<
List
<
List
<
GeoPoint
>>>();
private
boolean
multipolygon
=
false
;
private
boolean
multipolygon
=
false
;
private
boolean
initialized
=
false
;
private
static
final
MapFeatureVisitor
<
Double
>
distanceComputation
=
new
MapFeatureVisitor
<
Double
>()
{
private
static
final
MapFeatureVisitor
<
Double
>
distanceComputation
=
new
MapFeatureVisitor
<
Double
>()
{
@Override
@Override
...
@@ -99,6 +100,13 @@ public class Polygon extends PolygonBase implements MapPolygon {
...
@@ -99,6 +100,13 @@ public class Polygon extends PolygonBase implements MapPolygon {
container
.
addFeature
(
this
);
container
.
addFeature
(
this
);
}
}
public
void
Initialize
()
{
initialized
=
true
;
clearGeometry
();
map
.
getController
().
updateFeaturePosition
(
this
);
map
.
getController
().
updateFeatureHoles
(
this
);
}
@Override
@Override
@SimpleProperty
(
category
=
PropertyCategory
.
BEHAVIOR
,
@SimpleProperty
(
category
=
PropertyCategory
.
BEHAVIOR
,
description
=
"The type of the feature. For polygons, this returns the text \"Polygon\"."
)
description
=
"The type of the feature. For polygons, this returns the text \"Polygon\"."
)
...
@@ -140,8 +148,10 @@ public class Polygon extends PolygonBase implements MapPolygon {
...
@@ -140,8 +148,10 @@ public class Polygon extends PolygonBase implements MapPolygon {
throw
new
DispatchableError
(
ErrorMessages
.
ERROR_POLYGON_PARSE_ERROR
,
throw
new
DispatchableError
(
ErrorMessages
.
ERROR_POLYGON_PARSE_ERROR
,
"Unable to determine the structure of the points argument."
);
"Unable to determine the structure of the points argument."
);
}
}
clearGeometry
();
if
(
initialized
)
{
map
.
getController
().
updateFeaturePosition
(
this
);
clearGeometry
();
map
.
getController
().
updateFeaturePosition
(
this
);
}
}
catch
(
DispatchableError
e
)
{
}
catch
(
DispatchableError
e
)
{
container
.
$form
().
dispatchErrorOccurredEvent
(
this
,
"Points"
,
e
.
getErrorCode
(),
e
.
getArguments
());
container
.
$form
().
dispatchErrorOccurredEvent
(
this
,
"Points"
,
e
.
getErrorCode
(),
e
.
getArguments
());
}
}
...
@@ -166,8 +176,10 @@ public class Polygon extends PolygonBase implements MapPolygon {
...
@@ -166,8 +176,10 @@ public class Polygon extends PolygonBase implements MapPolygon {
}
}
points
=
GeometryUtil
.
multiPolygonToList
(
content
);
points
=
GeometryUtil
.
multiPolygonToList
(
content
);
multipolygon
=
points
.
size
()
>
1
;
multipolygon
=
points
.
size
()
>
1
;
clearGeometry
();
if
(
initialized
)
{
map
.
getController
().
updateFeaturePosition
(
this
);
clearGeometry
();
map
.
getController
().
updateFeaturePosition
(
this
);
}
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
container
.
$form
().
dispatchErrorOccurredEvent
(
this
,
"PointsFromString"
,
container
.
$form
().
dispatchErrorOccurredEvent
(
this
,
"PointsFromString"
,
ErrorMessages
.
ERROR_POLYGON_PARSE_ERROR
,
e
.
getMessage
());
ErrorMessages
.
ERROR_POLYGON_PARSE_ERROR
,
e
.
getMessage
());
...
@@ -209,8 +221,10 @@ public class Polygon extends PolygonBase implements MapPolygon {
...
@@ -209,8 +221,10 @@ public class Polygon extends PolygonBase implements MapPolygon {
throw
new
DispatchableError
(
ErrorMessages
.
ERROR_POLYGON_PARSE_ERROR
,
throw
new
DispatchableError
(
ErrorMessages
.
ERROR_POLYGON_PARSE_ERROR
,
"Unable to determine the structure of the points argument."
);
"Unable to determine the structure of the points argument."
);
}
}
clearGeometry
();
if
(
initialized
)
{
map
.
getController
().
updateFeatureHoles
(
this
);
clearGeometry
();
map
.
getController
().
updateFeatureHoles
(
this
);
}
}
catch
(
DispatchableError
e
)
{
}
catch
(
DispatchableError
e
)
{
container
.
$form
().
dispatchErrorOccurredEvent
(
this
,
"HolePoints"
,
container
.
$form
().
dispatchErrorOccurredEvent
(
this
,
"HolePoints"
,
e
.
getErrorCode
(),
e
.
getArguments
());
e
.
getErrorCode
(),
e
.
getArguments
());
...
@@ -234,7 +248,10 @@ public class Polygon extends PolygonBase implements MapPolygon {
...
@@ -234,7 +248,10 @@ public class Polygon extends PolygonBase implements MapPolygon {
return
;
return
;
}
}
holePoints
=
GeometryUtil
.
multiPolygonHolesToList
(
content
);
holePoints
=
GeometryUtil
.
multiPolygonHolesToList
(
content
);
map
.
getController
().
updateFeatureHoles
(
this
);
if
(
initialized
)
{
clearGeometry
();
map
.
getController
().
updateFeatureHoles
(
this
);
}
Log
.
d
(
TAG
,
"Points: "
+
points
);
Log
.
d
(
TAG
,
"Points: "
+
points
);
}
catch
(
JSONException
e
)
{
}
catch
(
JSONException
e
)
{
Log
.
e
(
TAG
,
"Unable to parse point string"
,
e
);
Log
.
e
(
TAG
,
"Unable to parse point string"
,
e
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment