Topic: CalcAreaExample.cs
Hi,
How to refresh all drawn polygons in CalcAreaExample.cs? I have tried to removeAllItems, it worked but, I cannot draw new ones in the same session at runtime. Could you please help me?
You are not logged in. Please login or register.
Infinity Code Forum → Online Maps Help → CalcAreaExample.cs
Hi,
How to refresh all drawn polygons in CalcAreaExample.cs? I have tried to removeAllItems, it worked but, I cannot draw new ones in the same session at runtime. Could you please help me?
Hello.
You also need to reset the polygon field reference.
polygon = null;
Hi,
RemoveAllItems just hides the polygon, when you try to create a new polygon, the ex one starts to be visible and the new lines connect to it. I just created a numerator to see if there is a need for a time span between removing items and setting polygon null, but not worked.
IEnumerator WaitForClear()
{
OnlineMapsDrawingElementManager.RemoveAllItems();
yield return new WaitForSeconds(0.2f);
polygon = null;
}
public void Clear()
{
StartCoroutine(WaitForClear());
}
public void Clear()
{
if (polygon != null)
{
OnlineMapsDrawingElementManager.RemoveItem(polygon);
polygon = null;
}
foreach (OnlineMapsMarker marker in markers) OnlineMapsMarkerManager.RemoveItem(marker);
markers.Clear();
markerPositions.Clear();
changed = true;
}
it worked, thank you!
Infinity Code Forum → Online Maps Help → CalcAreaExample.cs
Powered by PunBB, supported by Informer Technologies, Inc.