コード例 #1
0
 private async void StartStudy()
 {
     if (PointView.MoveCurrentToFirst())
     {
         await LoadCurrentDocument();
     }
     else
     {
         IsOver = true;
     }
     IsEnabled = true;
 }
コード例 #2
0
        public ActionResult Index(int id = 0)
        {
            PointView         view   = new PointView();
            List <PointModel> points = MgtPoint.GetInstance().GetAllWithCourseAndTypePointByCourse(id).ToModels();
            RaceModel         race   = MgtRace.GetInstance().GetRace(id).ToModel();

            view.points        = points.OrderBy(x => x.Ordre).ToList();
            view.idCourse      = id;
            view.libelleCourse = race.Title;

            return(View(view));
        }
コード例 #3
0
    void Start( )
    {
        var pointAsset = Resources.Load("Prefabs/Point Entity") as GameObject;

        pointPrefab = pointAsset.GetComponent <PointView> ( );
        pointPrefab.CreatePool( );

        var lineAsset = Resources.Load("Prefabs/Line Entity") as GameObject;

        linePrefab = lineAsset.GetComponent <LineView> ( );
        linePrefab.CreatePool( );

        init( );
    }
コード例 #4
0
ファイル: AbstractTsf.cs プロジェクト: jorgejgnz/HPTK
        public void ApplyToPoint(PointView point, string reprKey, bool applyPos)
        {
            if (!point)
            {
                return;
            }

            if (point.reprs.ContainsKey(reprKey) && point.reprs[reprKey].transformRef)
            {
                if (point.bone.part.body.replicatedTsf)
                {
                    ApplyToTransformRelativeToOther(point.reprs[reprKey].transformRef, point.bone.part.body.replicatedTsf, applyPos);
                }
                else
                {
                    ApplyToTransform(point.reprs[reprKey].transformRef, applyPos);
                }
            }
        }
コード例 #5
0
ファイル: RasterLayer.cs プロジェクト: ViRGIS-Team/ViRGiS_v2
        protected async Task Load(RecordSet layer)
        {
            (long, Pipeline)result = await LoadAsync(layer);

            Pipeline          pipeline = result.Item2;
            PointViewIterator views    = pipeline.Views;

            if (views != null)
            {
                PointView view = views != null ? views.Next : null;
                if (view != null)
                {
                    features = BakedPointCloud.Initialize(view.GetBpcData());
                    view.Dispose();
                }
                views.Dispose();
            }
            pipeline.Dispose();
        }
コード例 #6
0
    public override void RefreshView()
    {
        //Debug.Log("view2D RefreshView");
        RefreshGameObjs();
        base.RefreshView();

        #region room
        for (int i = 0; i < data.roomList.Count; i++)
        {
            GameObject obj  = floors[i];
            RoomView   view = obj.GetComponent <RoomView>();
            RoomData   room = data.roomList[i];
            view.SetData(room);
            List <Vector2> v2s = roomfunc.SetMesh(obj, room);
            Vector2        v2  = v2s[0];
            obj.transform.localPosition = new Vector3(v2.x, v2.y, obj.transform.localPosition.z);
            for (int k = 0; k < v2s.Count; k++)
            {
                v2s[k] = v2s[k] - v2;
            }
            MaterialData           floor = room.floor;
            List <List <Vector2> > list  = linefunc.SetMesh(v2s, obj, floor.offsetX, floor.offsetY, floor.rotation, floor.tileSize_x, floor.tileSize_y, true);
            if (list != null)
            {
                roomfunc.SetArea(areas[i], list, v2);
            }
            if (selectObjData == room)
            {
                if (selectRoom == null)
                {
                    selectRoom = prefabs.GetNewInstance_selectRoom().gameObject;
                }
                selectRoom.transform.localPosition = obj.transform.localPosition - Vector3.forward;
                linefunc.SetMesh(v2s, selectRoom, floor.offsetX, floor.offsetY, floor.rotation, floor.tileSize_x, floor.tileSize_y, true);
                selectRoom.SetActive(true);
            }
            Transform tran     = areas[i].transform.FindChild("name");
            TextMesh  textmesh = tran.GetComponent <TextMesh>();
            textmesh.text = room.type;
        }

        if ((selectObjData == null || selectObjData is RoomData == false) && selectRoom != null)
        {
            selectRoom.SetActive(false);
        }
        #endregion

        #region wall
        for (int i = 0; i < data.wallList.Count; i++)
        {
            WallData walldata = data.wallList[i];

            GameObject wallline     = wallLines[i];
            GameObject wallLeft     = wallsideLines[2 * i];
            GameObject wallRight    = wallsideLines[2 * i + 1];
            GameObject wallLeftEnd  = wallEndLines[2 * i];
            GameObject wallRightEnd = wallEndLines[2 * i + 1];
            if (walldata.hide == true)
            {
                wallline.SetActive(false);
                wallLeft.SetActive(false);
                wallRight.SetActive(false);
                wallLeftEnd.SetActive(false);
                wallRightEnd.SetActive(false);

                showLenLines[2 * i + 1].SetActive(false);
                showLenPoints[4 * i + 2].SetActive(false);
                showLenPoints[4 * i + 3].SetActive(false);
                showWords[2 * i + 1].SetActive(false);

                showLenLines[2 * i].SetActive(false);
                showLenPoints[4 * i].SetActive(false);
                showLenPoints[4 * i + 1].SetActive(false);
                showWords[2 * i].SetActive(false);
                continue;
            }
            else
            {
                wallline.SetActive(true);
                wallLeft.SetActive(true);
                wallRight.SetActive(true);
                //wallLeftEnd.SetActive(true);
                //wallRightEnd.SetActive(true);

                //showLenLines[2 * i + 1].SetActive(true);
                //showLenPoints[4 * i + 2].SetActive(true);
                //showLenPoints[4 * i + 3].SetActive(true);
                //showWords[2 * i + 1].SetActive(true);

                //showLenLines[2 * i].SetActive(true);
                //showLenPoints[4 * i].SetActive(true);
                //showLenPoints[4 * i + 1].SetActive(true);
                //showWords[2 * i].SetActive(true);
            }
            List <Vector2> tempList;
            SetObjWithData(walldata, wallline, wallLeft, wallRight, wallLeftEnd, wallRightEnd, out tempList);

            RoomData side1OnRoom = data.WallSideOnRoom(walldata.point1To2Data);
            RoomData side2OnRoom = data.WallSideOnRoom(walldata.point2To1Data);
            if (side2OnRoom != null)
            {
                ///左侧显示
                GameObject showline  = showLenLines[2 * i + 1];
                GameObject showLeft  = showLenPoints[4 * i + 2];
                GameObject showRight = showLenPoints[4 * i + 3];
                GameObject showWord  = showWords[2 * i + 1];
                SetShowObjWithData(walldata, showline, showLeft, showRight, showWord, tempList[4], tempList[5], walldata.c4);
            }
            if (side1OnRoom != null || side2OnRoom == null)
            {
                ///右侧显示
                GameObject showline  = showLenLines[2 * i];
                GameObject showLeft  = showLenPoints[4 * i];
                GameObject showRight = showLenPoints[4 * i + 1];
                GameObject showWord  = showWords[2 * i];
                SetShowObjWithData(walldata, showline, showLeft, showRight, showWord, tempList[1], tempList[2], walldata.c3);
            }
        }

        if ((selectObjData == null || selectObjData is WallData == false) && selectWall != null)
        {
            selectWall.SetActive(false);
        }
        if ((selectObjData is ProductData == false || selectGoodsdisedWalldata == null) && selectDisedwall != null)
        {
            selectDisedwall.SetActive(false);
        }
        #endregion

        #region point
        for (int i = 0; i < data.pointList.Count; i++)
        {
            Point   p   = data.pointList[i];
            Vector2 pos = p.pos;
            //Debug.LogWarning("show "+ pos);
            wallPoints[i].transform.localPosition = new Vector3(pos.x, pos.y, wallPoints[i].transform.localPosition.z);
            wallPoints[i].name = "Point " + p.guid;
            PointView view = wallPoints[i].GetComponent <PointView>();
            if (view == null)
            {
                Debug.LogWarning("wallPoints[i].GetComponent<PointView>() == null"); continue;
            }
            view.SetData(p);
            if (selectObjData == p)
            {
                if (selectPoint == null)
                {
                    selectPoint = prefabs.GetNewInstance_selectPoint().gameObject;
                }
                selectPoint.transform.localPosition = wallPoints[i].transform.localPosition - Vector3.forward;
                selectPoint.SetActive(true);
            }
        }
        if ((selectObjData == null || selectObjData is Point == false) && selectPoint != null)
        {
            selectPoint.SetActive(false);
        }
        #endregion

        #region setWallLength
        for (int i = 0; i < inputWallLengths.Count; i++)
        {
            inputWallLengths[i].SetActive(false);
        }
        if (selectObjData is WallData)
        {
            WallData wall        = selectObjData as WallData;
            int      wallIndex   = data.wallList.IndexOf(wall);
            RoomData side1OnRoom = data.WallSideOnRoom(wall.point1To2Data);
            RoomData side2OnRoom = data.WallSideOnRoom(wall.point2To1Data);
            if (side1OnRoom != null)
            {
                tempSideList = new List <Point>();

                GameObject          goF     = inputWallLengths[3];
                SetLengthHandleView viewF   = goF.GetComponent <SetLengthHandleView>();
                WallSideData        indexF1 = roomfunc.GetNearCrossSide(side1OnRoom, wall.point1To2Data, true, tempSideList);
                viewF.SetData(indexF1);
                goF.SetActive(true);

                GameObject          goT     = inputWallLengths[4];
                SetLengthHandleView viewT   = goT.GetComponent <SetLengthHandleView>();
                WallSideData        indexT1 = roomfunc.GetNearCrossSide(side1OnRoom, wall.point1To2Data, false, tempSideList);
                viewT.SetData(indexT1);
                goT.SetActive(true);

                viewF.otherdata           = indexT1;
                viewT.otherdata           = indexF1;
                viewF.ForT                = true;
                viewT.ForT                = false;
                viewF.isParallelPointList = tempSideList;
                viewT.isParallelPointList = tempSideList;
            }
            if (side2OnRoom != null)
            {
                tempSideList = new List <Point>();

                GameObject          goF     = inputWallLengths[1];
                SetLengthHandleView viewF   = goF.GetComponent <SetLengthHandleView>();
                WallSideData        indexF2 = roomfunc.GetNearCrossSide(side2OnRoom, wall.point2To1Data, true, tempSideList);
                viewF.SetData(indexF2);
                goF.SetActive(true);

                GameObject          goT     = inputWallLengths[2];
                SetLengthHandleView viewT   = goT.GetComponent <SetLengthHandleView>();
                WallSideData        indexT2 = roomfunc.GetNearCrossSide(side2OnRoom, wall.point2To1Data, false, tempSideList);
                viewT.SetData(indexT2);
                goT.SetActive(true);

                viewF.otherdata           = indexT2;
                viewT.otherdata           = indexF2;
                viewF.ForT                = true;
                viewT.ForT                = false;
                viewF.isParallelPointList = tempSideList;
                viewT.isParallelPointList = tempSideList;
            }

            GameObject go = inputWallLengths[0];
            if (side1OnRoom == null && side2OnRoom == null)
            {
                WallSideData        side = wall.point1To2Data;
                SetLengthHandleView view = go.GetComponent <SetLengthHandleView>();
                view.SetData(side);
                view.otherdata = null;
                go.SetActive(true);
            }
            else
            {
                go.SetActive(false);
            }
        }
        #endregion
    }
コード例 #7
0
        protected Task <int> Load()
        {
            TaskCompletionSource <int> tcs1 = new TaskCompletionSource <int>();
            Task <int> t1 = tcs1.Task;

            t1.ConfigureAwait(false);

            // Start a background task that will complete tcs1.Task
            Task.Factory.StartNew(() => {
                RecordSet layer      = _layer as RecordSet;
                string ex            = Path.GetExtension(layer.Source).ToLower();
                string sourcetype    = null;
                Datasource ds        = null;
                string proj          = null;
                double scalingFactor = 0;
                string headerString;
                features = new List <DMesh3>();

                // Determine the DAL to be used to load the data.
                // GDAL data is loaded throu PDAL to get a mesh - but the pipeline is radically different
                //
                if (".2dm .nc .dat .adf .out .grb .hdf .slf .sww .xdmf .xmdf .tin".Contains(ex))
                {
                    sourcetype = "mdal";
                }
                else if (".bpf .json .e57 .mat .txt .las .nitf .npy .csd .pcd .ply .pts .qi .rxp .rdbx .sbet .slpk .bin .xyz ".Contains(ex) || new Regex(@"\.m\d\d").IsMatch(ex))
                {
                    sourcetype = "pdal";
                }
                else
                {
                    sourcetype = "gdal";
                }

                //Loading through PDAL
                if (sourcetype != "mdal")
                {
                    List <object> pipe = new List <object>();

                    // Set up the pipline for GDAL data
                    // Get the metadata thjrough GDAL first
                    if (sourcetype == "gdal")
                    {
                        Dataset raster = Gdal.Open(layer.Source, Access.GA_ReadOnly);
                        int numBands   = raster.RasterCount;
                        if (numBands <= 0)
                        {
                            throw new NotSupportedException($" No Data in file {layer.Source}");
                        }
                        proj = raster.GetProjection();

                        //Make the header string from the number of bands - assume band-1 is elevation
                        headerString = "Z";
                        for (int i = 1; i < numBands; i++)
                        {
                            headerString += $",M{i}";
                        }

                        pipe.Add(new {
                            type     = "readers.gdal",
                            filename = layer.Source,
                            header   = headerString
                        });

                        //get the null value and filter out null data
                        Band band1 = raster.GetRasterBand(1);
                        double noDataValue;
                        int hasval;
                        band1.GetNoDataValue(out noDataValue, out hasval);
                        if (hasval == 1)
                        {
                            if (noDataValue < 0)
                            {
                                pipe.Add(new {
                                    type   = "filters.range",
                                    limits = $"Z[{noDataValue + 1}:]"
                                });
                            }
                            else
                            {
                                pipe.Add(new {
                                    type   = "filters.range",
                                    limits = $"Z[:{noDataValue - 1}]"
                                });
                            }
                        }

                        // Get the size and pixel size of the raster
                        // if the raster has more than 40,000 data points, using poisson sampling to down size
                        long datapoints = raster.RasterXSize * raster.RasterYSize;
                        if (datapoints > 40000)
                        {
                            try {
                                double[] geoTransform = new double[6];
                                raster.GetGeoTransform(geoTransform);
                                if (geoTransform == null && geoTransform[1] == 0)
                                {
                                    throw new Exception();
                                }
                                scalingFactor = Math.Sqrt(datapoints / 40000d * geoTransform[1]);
                            } catch {
                                scalingFactor = Math.Sqrt(datapoints / 40000d);
                            };

                            pipe.Add(new {
                                type   = "filters.sample",
                                radius = scalingFactor
                            });
                        }
                        band1.FlushCache();
                        band1.Dispose();
                        raster.FlushCache();
                        raster.Dispose();
                        // special treatment for .xyz files that are not handled well by the defaults
                    }
                    else if (ex == ".xyz")
                    {
                        pipe.Add(new {
                            type     = "readers.text",
                            filename = layer.Source,
                        });
                    }

                    // for PDAL data - use the default reader
                    else
                    {
                        pipe.Add(layer.Source);
                    }

                    // if there is a filter definituion in the RecordSet, add that
                    if (layer.Properties.Filter != null)
                    {
                        foreach (Dictionary <string, object> item in layer.Properties.Filter)
                        {
                            pipe.Add(item);
                        }
                    }

                    // if there is a Color Interpolation definition in the RecordSet, add that
                    if (layer.Properties.ColorInterp != null)
                    {
                        Dictionary <string, object> ci = new Dictionary <string, object>(layer.Properties.ColorInterp);
                        ci.Add("type", "filters.colorinterp");
                        ci["dimension"] = "Z";
                        pipe.Add(ci);
                    }

                    // create a Mesh using Delaunay traingulation
                    pipe.Add(new {
                        type = "filters.delaunay"
                    });

                    // serialize the pipeline to json
                    string json = JsonConvert.SerializeObject(new {
                        pipeline = pipe.ToArray()
                    });

                    Debug.Log(json);

                    // create and run the piplene
                    Pipeline pipeline = new Pipeline(json);
                    long pointCount   = pipeline.Execute();
                    using (PointViewIterator views = pipeline.Views) {
                        views.Reset();
                        while (views.HasNext())
                        {
                            PointView view = views.Next;
                            if (view != null)
                            {
                                DMesh3 mesh = view.getMesh();
                                mesh.RemoveMetadata("properties");
                                // set the CRS based on what is known
                                if (proj != null)
                                {
                                    mesh.RemoveMetadata("CRS");
                                    mesh.AttachMetadata("CRS", proj);
                                }
                                if (layer.ContainsKey("Crs") && layer.Crs != null)
                                {
                                    mesh.RemoveMetadata("CRS");
                                    mesh.AttachMetadata("CRS", layer.Crs);
                                }
                                ;
                                features.Add(mesh);
                            }
                        }
                    }
                    pipeline.Dispose();
                }
                else
                {
                    // for MDAL files - load the mesh directly
                    ds = Datasource.Load(layer.Source);

                    for (int i = 0; i < ds.meshes.Length; i++)
                    {
                        DMesh3 mesh = ds.GetMesh(i);
                        mesh.RemoveMetadata("properties");
                        mesh.AttachMetadata("properties", new Dictionary <string, object> {
                            { "Name", ds.meshes[i] }
                        });
                        // set the CRS based on what is known
                        if (proj != null)
                        {
                            mesh.RemoveMetadata("CRS");
                            mesh.AttachMetadata("CRS", proj);
                        }
                        if (layer.ContainsKey("Crs") && layer.Crs != null)
                        {
                            mesh.RemoveMetadata("CRS");
                            mesh.AttachMetadata("CRS", layer.Crs);
                        }
                        ;
                        features.Add(mesh);
                    }
                }
                tcs1.SetResult(1);
            });
            return(t1);
        }
コード例 #8
0
 /// <summary>
 /// 饼状Series设置成百分比显示
 /// </summary>
 /// <param name="series">SeriesBase</param>
 /// <param name="valueLegendType">Series对应Lengend显示类型</param>
 /// <param name="lengendPointView">Series对应Lengend PointView类型</param>
 public static void SetPiePercentage(this SeriesBase series, NumericFormat valueLegendType, PointView lengendPointView)
 {
     if (series.View is PieSeriesView || series.View is Pie3DSeriesView)
     {
         PiePointOptions _piePointOptions = (PiePointOptions)series.Label.PointOptions;
         if (_piePointOptions != null)
         {
             _piePointOptions.PercentOptions.ValueAsPercent       = true;
             _piePointOptions.ValueNumericOptions.Format          = NumericFormat.Percent;
             _piePointOptions.ValueNumericOptions.Precision       = 0;
             series.LegendPointOptions.ValueNumericOptions.Format = valueLegendType;
             series.LegendPointOptions.PointView = lengendPointView;
         }
     }
 }
コード例 #9
0
ファイル: UnitTest1.cs プロジェクト: megadrow/Study
 public void GetDistanceTest()
 {
     var st1 = new PointView(0, 0);
     var st2 = new PointView(3, 4);
     Assert.AreEqual(5, st1.GetDistanse(st2), 0.001);
 }
コード例 #10
0
        private void AddObjectToGrid(double left, double top, string text = null, bool ellipse = true)
        {
            CommonObject circle;
            if (ellipse)
            {
                circle = new PointView(left, top);
            }
            else
            {
                circle = new StationView(left, top);
            }

            circle.Number = Convert.ToInt32(text);
            var context = new ContextMenu();
            var mi = new MenuItem {Header = "Закрепить"};
            mi.Click += mi_Click;
            context.Items.Add(mi);

            mi = new MenuItem {Header = "Свойства"};
            //if (circle.GetType() == typeof(StationEll))
            //{
                mi.Click += PointProp_Click;
            //}

            context.Items.Add(mi);

            circle.ContextMenu = context;

            grd.Children.Add(circle);
        }
コード例 #11
0
        protected Task <int> Load(RecordSet layer)
        {
            Task <int> t1 = new Task <int>(() => {
                List <object> pipe = new List <object>();

                string ex = Path.GetExtension(layer.Source).ToLower();
                if (ex == ".xyz")
                {
                    pipe.Add(new {
                        type     = "readers.text",
                        filename = layer.Source,
                    });
                }
                else
                {
                    pipe.Add(layer.Source);
                }

                if (layer.Properties.Filter != null)
                {
                    foreach (Dictionary <string, object> item in layer.Properties.Filter)
                    {
                        pipe.Add(item);
                    }
                }

                if (layer.ContainsKey("Crs") && layer.Crs != null && layer.Crs != "")
                {
                    string crs;
                    AppState.instance.mapProj.ExportToProj4(out crs);
                    pipe.Add(new {
                        type    = "filters.reprojection",
                        in_srs  = layer.Crs,
                        out_srs = crs
                    });
                }

                if (layer.Properties.ColorInterp != null)
                {
                    Dictionary <string, object> ci = new Dictionary <string, object>(layer.Properties.ColorInterp);
                    ci.Add("type", "filters.colorinterp");
                    pipe.Add(ci);
                }

                pipe.Add(new {
                    type     = "filters.projpipeline",
                    coord_op = "+proj=axisswap +order=1,3,2"
                });

                string json = JsonConvert.SerializeObject(new {
                    pipeline = pipe.ToArray()
                });

                Pipeline pipeline = new Pipeline(json);
                if (pipeline.Valid == false)
                {
                    throw new System.NotSupportedException("Layer : " + layer.Id + "  - PDAL Pipeline is not valid - check Layer configuration");
                }
                long pointCount         = pipeline.Execute();
                PointViewIterator views = pipeline.Views;
                if (views != null)
                {
                    PointView view = views != null ? views.Next : null;
                    if (view != null)
                    {
                        features = BakedPointCloud.Initialize(view.GetBpcData());
                        view.Dispose();
                    }
                    views.Dispose();
                }
                pipeline.Dispose();
                return(1);
            });

            t1.Start(TaskScheduler.FromCurrentSynchronizationContext());
            return(t1);
        }