コード例 #1
0
        protected override async Task _init(GeographyCollection layer)
        {
            geoJsonReader = new GeoJsonReader();
            await geoJsonReader.Load(layer.Source);

            features     = geoJsonReader.getFeatureCollection();
            symbology    = layer.Properties.Units;
            displacement = 1.0f;
            if (symbology.ContainsKey("point") && symbology["point"].ContainsKey("Shape"))
            {
                Shapes shape = symbology["point"].Shape;
                switch (shape)
                {
                case Shapes.Spheroid:
                    PointPrefab = SpherePrefab;
                    break;

                case Shapes.Cuboid:
                    PointPrefab = CubePrefab;
                    break;

                case Shapes.Cylinder:
                    PointPrefab  = CylinderPrefab;
                    displacement = 1.5f;
                    break;

                default:
                    PointPrefab = SpherePrefab;
                    break;
                }
            }
            else
            {
                PointPrefab = SpherePrefab;
            }

            Color col = symbology.ContainsKey("point") ? (Color)symbology["point"].Color : Color.white;
            Color sel = symbology.ContainsKey("point") ? new Color(1 - col.r, 1 - col.g, 1 - col.b, col.a) : Color.red;

            mainMat = Instantiate(BaseMaterial);
            mainMat.SetColor("_BaseColor", col);
            selectedMat = Instantiate(BaseMaterial);
            selectedMat.SetColor("_BaseColor", sel);
        }
コード例 #2
0
        protected override async Task _init(GeographyCollection layer)
        {
            geoJsonReader = new GeoJsonReader();
            await geoJsonReader.Load(layer.Source);

            features  = geoJsonReader.getFeatureCollection();
            symbology = layer.Properties.Units;

            if (symbology.ContainsKey("point") && symbology["point"].ContainsKey("Shape"))
            {
                Shapes shape = symbology["point"].Shape;
                switch (shape)
                {
                case Shapes.Spheroid:
                    HandlePrefab = SpherePrefab;
                    break;

                case Shapes.Cuboid:
                    HandlePrefab = CubePrefab;
                    break;

                case Shapes.Cylinder:
                    HandlePrefab = CylinderPrefab;
                    break;

                default:
                    HandlePrefab = SpherePrefab;
                    break;
                }
            }
            else
            {
                HandlePrefab = SpherePrefab;
            }

            if (symbology.ContainsKey("line") && symbology["line"].ContainsKey("Shape"))
            {
                Shapes shape = symbology["line"].Shape;
                switch (shape)
                {
                case Shapes.Cuboid:
                    LinePrefab = CuboidLinePrefab;
                    break;

                case Shapes.Cylinder:
                    LinePrefab = CylinderLinePrefab;
                    break;

                default:
                    LinePrefab = CylinderLinePrefab;
                    break;
                }
            }
            else
            {
                LinePrefab = CylinderLinePrefab;
            }

            Color col     = symbology.ContainsKey("point") ? (Color)symbology["point"].Color : Color.white;
            Color sel     = symbology.ContainsKey("point") ? new Color(1 - col.r, 1 - col.g, 1 - col.b, col.a) : Color.red;
            Color line    = symbology.ContainsKey("line") ? (Color)symbology["line"].Color : Color.white;
            Color lineSel = symbology.ContainsKey("line") ? new Color(1 - line.r, 1 - line.g, 1 - line.b, line.a) : Color.red;
            Color body    = symbology.ContainsKey("body") ? (Color)symbology["body"].Color : Color.white;
            Color bodySel = symbology.ContainsKey("body") ? new Color(1 - body.r, 1 - body.g, 1 - body.b, body.a) : Color.red;

            mainMat = Instantiate(PointBaseMaterial);
            mainMat.SetColor("_BaseColor", col);
            selectedMat = Instantiate(PointBaseMaterial);
            selectedMat.SetColor("_BaseColor", sel);
            lineMain = Instantiate(LineBaseMaterial);
            lineMain.SetColor("_BaseColor", line);
            lineSelected = Instantiate(LineBaseMaterial);
            lineSelected.SetColor("_BaseColor", lineSel);
            bodyMain = Instantiate(BodyBaseMaterial);
            bodyMain.SetColor("_BaseColor", body);
        }