当前位置: 首页>>代码示例>>C#>>正文


C# DbGeometry类代码示例

本文整理汇总了C#中DbGeometry的典型用法代码示例。如果您正苦于以下问题:C# DbGeometry类的具体用法?C# DbGeometry怎么用?C# DbGeometry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DbGeometry类属于命名空间,在下文中一共展示了DbGeometry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AsBinary

        public override byte[] AsBinary(DbGeometry geometryValue)
        {
            if (geometryValue == null)
            throw new ArgumentNullException("geometryValue");

              var providerValue = new MySqlGeometry();
              MySqlGeometry.TryParse(geometryValue.ProviderValue.ToString(), out providerValue);

              return providerValue.Value;
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:10,代码来源:MySqlSpatialServices.cs

示例2: EvaluateAndSaveGeometry

        /// <summary>
        ///     Parsing the THREEJS Geometry of an Object ... (including the color ...)
        /// </summary>
        /// <param name="geo"></param>
        /// <param name="model"></param>
        /// <param name="color"></param>
        public static void EvaluateAndSaveGeometry(DbGeometry geo, DtObject model, Color color)
        {
            // Create 3DPoints
            var splitpointlist = geo.Vertices
                .Select((x, i) => new { Index = i, Value = x })
                .GroupBy(x => x.Index / 3)
                .Select(x => x.Select(v => v.Value).ToList())
                .ToList();

            var points = splitpointlist.Select(item => new Point3D(item[0], item[1], item[2])).ToList();

            // Add the information as AttributeGroup
            model.AttributeGroups["geometry"].AddProperty("threejspoints", points);
            model.AttributeGroups["geometry"].AddProperty("geometryindices", geo.Faces);
            model.AttributeGroups["geometry"].AddProperty("color", color);
        }
开发者ID:corneliuspreidel,项目名称:TUM.CMS.VPLControl,代码行数:22,代码来源:GeometryWriter.cs

示例3: GetSpatialTypeName

        public override string GetSpatialTypeName(DbGeometry geometryValue)
        {
            if (geometryValue == null)
            throw new ArgumentNullException("geometryValue");

              var mysqlValue = GeometryFromProviderValue(geometryValue);

              return mysqlValue.SpatialTypeName;
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:9,代码来源:MySqlSpatialServices.cs

示例4: GetMeasure

        public override double? GetMeasure(DbGeometry geometryValue)
        {
            if (geometryValue == null)
            throw new ArgumentNullException("geometryValue");

              var mysqlValue = GeometryFromProviderValue(geometryValue);

              return mysqlValue.Measure;
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:9,代码来源:MySqlSpatialServices.cs

示例5: WorkerOnDoWork

        private void WorkerOnDoWork(object sender, DoWorkEventArgs doWorkEventArgs)
        {
            // Shoe ProgressBar
            Dispatcher.BeginInvoke((Action)delegate () {
                _control.LoadingGrid.Visibility = Visibility.Visible;
                _control.statusLabel.Content = "Status: Loading ...";
            });

            if (InputPorts[0] == null || ControlElements[0] == null || InputPorts[0].Data == null) return;

            if (InputPorts[0].Data.GetType() == typeof(DtoShortProject))
            {
                
                var project = InputPorts[0].Data as DtoShortProject;

                if (project != null)
                {
                    projectId = project.Id;
                    var topo = _controller.IntBase.APICore.Projects.GetTopology(project.Id);
                    if (topo == null)
                        return;
                    var model = _controller.IntBase.APICore.DtObjects.GetObjectGeometryAsThreeJs(topo.Id);
                    // var model = _controller.IntBase.APICore.DtObjects.GetObjectGeometry(topo.Id);

                    if (model.Objects == null)
                        return;

                    foreach (var elem in model.Objects)
                    {
                        var geom = new DbGeometry();
                        var jObject = elem.AttributeGroups["geometry"]["threejs"] as JObject;
                        if (jObject != null)
                        {
                            geom.Vertices = jObject.SelectToken("vertices").ToList().Select(value => value.Value<double>()).ToList();
                            geom.Faces = jObject.SelectToken("faces").ToList().Select(value => value.Value<uint>()).ToList();

                            var colorid = (int)jObject.SelectToken("metadata")["colorid"];
                            var colorInteger = model.Colors[colorid];
                            var color = Color.FromArgb((int)colorInteger);

                            GeometryWriter.EvaluateAndSaveGeometry(geom, elem, color);
                        }
                    }
                    
                    // model.Colors
                    // Color c = Color.FromArgb(someInt);

                    // var model = _controller.IntBase.APICore.DtObjects.GetObjectGeometry(topo.Id);
                    _elements = (List<DtObject>) model.Objects;
                }
                // _elements = _controller.IntBase.APICore.GetElementsFromTopologyId(project.Id);
                // OutputPorts[0].Data = _elements;
            }

            if (InputPorts[0].Data.GetType() == typeof(DtoDivision))
            {
                var dtoDivision = InputPorts[0].Data as DtoDivision;
                if (dtoDivision?.TopologyDivisionId != null)
                {
                    var model = _controller.IntBase.APICore.DtObjects.GetObjectGeometryAsThreeJs((Guid)dtoDivision.TopologyDivisionId);
                    projectId = dtoDivision.ProjectId;

                    foreach (var elem in model.Objects)
                    {
                        var geom = new DbGeometry();
                        var jObject = elem.AttributeGroups["geometry"]["threejs"] as JObject;
                        if (jObject != null)
                        {
                            geom.Vertices = jObject.SelectToken("vertices").ToList().Select(value => value.Value<double>()).ToList();
                            geom.Faces = jObject.SelectToken("faces").ToList().Select(value => value.Value<uint>()).ToList();

                            var colorid = (int)jObject.SelectToken("metadata")["colorid"];
                            var colorInteger = model.Colors[colorid];
                            var color = Color.FromArgb((int)colorInteger);

                            GeometryWriter.EvaluateAndSaveGeometry(geom, elem, color);
                        }
                    }
                    _elements = (List<DtObject>)model.Objects;
                }
            }

            doWorkEventArgs.Result = _elements;
        }
开发者ID:corneliuspreidel,项目名称:TUM.CMS.VPLControl,代码行数:84,代码来源:ElementContainerNode.cs

示例6: SymmetricDifference

        public override DbGeometry SymmetricDifference(DbGeometry geometryValue, DbGeometry otherGeometry)
        {
            if (geometryValue == null)
            throw new ArgumentNullException("geometryValue");

              if (otherGeometry == null)
            throw new ArgumentNullException("otherGeometry");

              var mysqlValue = GeometryFromProviderValue(geometryValue);

              var mysqlOtherValue = GeometryFromProviderValue(otherGeometry);

              return mysqlValue.SymmetricDifference(mysqlOtherValue);
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:14,代码来源:MySqlSpatialServices.cs

示例7: PointAt

 public override DbGeometry PointAt(DbGeometry geometryValue, int index)
 {
     throw new System.NotImplementedException();
 }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:4,代码来源:MySqlSpatialServices.cs

示例8: InteriorRingAt

        public override DbGeometry InteriorRingAt(DbGeometry geometryValue, int index)
        {
            if (geometryValue == null)
            throw new ArgumentNullException("geometryValue");

              var mysqlValue = GeometryFromProviderValue(geometryValue);

              return mysqlValue.InteriorRingAt(index);
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:9,代码来源:MySqlSpatialServices.cs

示例9: GetCoordinateSystemId

        public override int GetCoordinateSystemId(DbGeometry geometryValue)
        {
            if (geometryValue == null)
            throw new ArgumentNullException("geometryValue");

              var mysqlValue = GeometryFromProviderValue(geometryValue);

              return mysqlValue.CoordinateSystemId;
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:9,代码来源:MySqlSpatialServices.cs

示例10: GetConvexHull

        public override DbGeometry GetConvexHull(DbGeometry geometryValue)
        {
            if (geometryValue == null)
            throw new ArgumentNullException("geometryValue");

              var mysqlValue = GeometryFromProviderValue(geometryValue);

              return mysqlValue.ConvexHull;
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:9,代码来源:MySqlSpatialServices.cs

示例11: Distance

        public override double Distance(DbGeometry geometryValue, DbGeometry otherGeometry)
        {
            if (geometryValue == null)
            throw new ArgumentNullException("geometryValue");

              if (otherGeometry == null)
            throw new ArgumentNullException("otherGeometry");

              DbGeometry mysqlValue = DbGeometry.FromText(geometryValue.ProviderValue.ToString());

              Double? result = mysqlValue.Distance(otherGeometry);
              if (result != null)
            return result.Value;
              return 0;
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:15,代码来源:MySqlSpatialServices.cs

示例12: Disjoint

 public override bool Disjoint(DbGeometry geometryValue, DbGeometry otherGeometry)
 {
     throw new System.NotImplementedException();
 }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:4,代码来源:MySqlSpatialServices.cs

示例13: CreateWellKnownValue

        public override DbGeometryWellKnownValue CreateWellKnownValue(DbGeometry geometryValue)
        {
            if (geometryValue == null)
            throw new ArgumentNullException("geometryValue");

              var mysqlValue = GeometryFromProviderValue(geometryValue);

              return mysqlValue.WellKnownValue;
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:9,代码来源:MySqlSpatialServices.cs

示例14: Contains

        public override bool Contains(DbGeometry geometryValue, DbGeometry otherGeometry)
        {
            if (geometryValue == null)
             throw new ArgumentNullException("geometryValue");

               if (otherGeometry == null)
             throw new ArgumentNullException("otherGeometry");

               DbGeometry mysqlValue = DbGeometry.FromText(geometryValue.ProviderValue.ToString());
               return mysqlValue.Contains(otherGeometry);
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:11,代码来源:MySqlSpatialServices.cs

示例15: Buffer

        public override DbGeometry Buffer(DbGeometry geometryValue, double distance)
        {
            if (geometryValue == null)
            throw new ArgumentNullException("geometryValue");

              DbGeometry mysqlValue = DbGeometry.FromText(geometryValue.ProviderValue.ToString());
              return mysqlValue.Buffer(distance);
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:8,代码来源:MySqlSpatialServices.cs


注:本文中的DbGeometry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。