コード例 #1
0
    private static void GeneratePointShape(ExtractedOpenDataEntry entry)
    {
        List <Vector3> coordinates = entry.openDataObject.Shape.ReturnRealCoordsAsUnityCoords();

        for (int i = 0; i < coordinates.Count; i++)
        {
            GameObject obj = GameObject.Instantiate(entry.relatedPrefab, coordinates[i], entry.relatedPrefab.transform.rotation) as GameObject;
            obj.transform.parent = FindParentInHierarchy(entry).transform;
        }
    }
コード例 #2
0
    private static void GenerateMultipolygonShape(ExtractedOpenDataEntry entry, Color lineColor, Material lineMaterial, float lineWidth)
    {
        MultipolygonShape   multipolgyonShape = (MultipolygonShape)entry.openDataObject.Shape;
        List <PolygonShape> polygons          = multipolgyonShape.polygonShapes;

        foreach (PolygonShape polygon in polygons)
        {
            ExtractedOpenDataEntry tempEntry = new ExtractedOpenDataEntry(entry.relatedPrefab, new OpenDataObject(polygon), entry.name);
            GeneratePolygonShape(tempEntry, lineColor, lineMaterial, lineWidth);
        }
    }
コード例 #3
0
 private static GameObject FindParentInHierarchy(ExtractedOpenDataEntry entry)
 {
     if (GameObject.Find(entry.name) == null)
     {
         return(new GameObject(entry.name));
     }
     else if (GameObject.Find(entry.name) != null)
     {
         return(GameObject.Find(entry.name));
     }
     else
     {
         return(new GameObject("undefind"));
     }
 }
コード例 #4
0
    private static void GenerateLinestringShape(ExtractedOpenDataEntry entry, Color lineColor, Material lineMaterial, float lineWidth)
    {
        List <Vector3> coordinates = entry.openDataObject.Shape.ReturnRealCoordsAsUnityCoords();

        for (int i = 0; i < coordinates.Count; i++)
        {
            Vector3 firstVertex  = coordinates[i];
            Vector3 secondVertex = ((i + 1) == coordinates.Count) ? coordinates[i] : coordinates[i + 1];

            GameObject obj = GameObject.Instantiate(entry.relatedPrefab, coordinates[i], entry.relatedPrefab.transform.rotation) as GameObject;

            if (firstVertex != secondVertex)
            {
                obj = AddLineFromTo(firstVertex, secondVertex, obj, lineColor, lineMaterial, lineWidth);
            }
            obj.transform.parent = FindParentInHierarchy(entry).transform;
        }
    }
コード例 #5
0
 private static void SaveInDestinationObject(ExtractedOpenDataMap mapInstance, ExtractedOpenDataEntry entry)
 {
     mapInstance.extractedOpenDataEntries.Add(entry);
 }