We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ti.Map Release 4.4.0
index.xml
<Alloy> <Window class="container"> <View id="mapview" module="ti.map"/> </Window> </Alloy>
index.js
var Map = require('ti.map'); $.mapview.mapType = Map.NORMAL_TYPE; var samplePolygons = []; samplePolygons.push(Map.createPolygon({ points: [{"longitude":-115.57617187499999,"latitude":36.527294814546245},{"longitude":-111.884765625,"latitude":31.42866311735861},{"longitude":-102.216796875,"latitude":32.175612478499325},{"longitude":-92.8125,"latitude":33.65120829920497},{"longitude":-100.283203125,"latitude":39.36827914916014},{"longitude":-108.45703125,"latitude":42.293564192170095},{"longitude":-115.57617187499999,"latitude":36.527294814546245}], strokeColor: '#FCC248', strokeWidth: 4, zIndex: 2, bubbleParent: false, fillColor: "#FEE8BC" })); samplePolygons.push(Map.createPolygon({ points: [{"longitude":-83.583984375,"latitude":42.22851735620852},{"longitude":-71.54296874999999,"latitude":42.4234565179383},{"longitude":-62.84179687499999,"latitude":48.40003249610685},{"longitude":-72.0703125,"latitude":52.908902047770255},{"longitude":-88.857421875,"latitude":47.81315451752768},{"longitude":-83.583984375,"latitude":42.22851735620852}], strokeColor: '#878D99', strokeWidth: 4, zIndex: 2, bubbleParent: false, fillColor: "#C9CBCF" })); // $.mapview.addPolygons(samplePolygons); // Error on Android: $.mapview.addPolygons is not a function for (var i = 0; i < samplePolygons.length; i++) { $.mapview.addPolygon(samplePolygons[i]); // .addPolygon works, but addPolygons is throws error } $.index.open();
Uncomment $.mapview.addPolygons(samplePolygons); and you get an Error that the Function addPolygons dosen't exist.
$.mapview.addPolygons(samplePolygons);
The odd thing is, I can see the method mapped in the Android Module: https://github.com/appcelerator-modules/ti.map/blob/3359e673bfb99f1973887e611b546479b47809e2/android/src/ti/map/TiUIMapView.java#L783
The text was updated successfully, but these errors were encountered:
Fixed it by adding in ViewProxy.java
ViewProxy.java
Line 60: private static final int MSG_ADD_POLYGONS = MSG_FIRST_ID + 904; Line 228:
private static final int MSG_ADD_POLYGONS = MSG_FIRST_ID + 904;
case MSG_ADD_POLYGONS: { result = (AsyncResult) msg.obj; handleAddPolygons((Object[]) result.getArg()); result.setResult(null); return true; }
Line 791:
@Kroll.method public void addPolygons(Object polygonsObject) { if (!(polygonsObject instanceof Object[])) { Log.e(TAG, "Invalid argument to addpolygons", Log.DEBUG_MODE); return; } Object[] gons = (Object[]) polygonsObject; //Update the JS object Object polygons = getProperty(MapModule.PROPERTY_POLYGONS); if (polygons instanceof Object[]) { ArrayList<Object> polygonsList = new ArrayList<Object>(Arrays.asList((Object[]) polygons)); for (int i = 0; i < gons.length; i++) { Object polygonObject = gons[i]; if (polygonObject instanceof AnnotationProxy) { polygonsList.add(polygonObject); } } setProperty(MapModule.PROPERTY_POLYGONS, polygonsList.toArray()); } else { setProperty(MapModule.PROPERTY_POLYGONS, gons); } TiUIView view = peekView(); if (view instanceof TiUIMapView) { if (TiApplication.isUIThread()) { handleAddPolygons(gons); } else { TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_ADD_POLYGONS), gons); } } } private void handleAddPolygons(Object[] polygons) { for (int i = 0; i < polygons.length; i++) { Object polygon = polygons[i]; if (polygon instanceof PolygonProxy) { handleAddPolygon((PolygonProxy) polygon); } } }
Sorry, something went wrong.
No branches or pull requests
Ti.Map Release 4.4.0
index.xml
index.js
Uncomment
$.mapview.addPolygons(samplePolygons);
and you get an Error that the Function addPolygons dosen't exist.The odd thing is, I can see the method mapped in the Android Module: https://github.com/appcelerator-modules/ti.map/blob/3359e673bfb99f1973887e611b546479b47809e2/android/src/ti/map/TiUIMapView.java#L783
The text was updated successfully, but these errors were encountered: