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


C# DPoint类代码示例

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


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

示例1: MouseClick

        public override void MouseClick(object sender, MouseEventArgs e)
        {
            if (map.InsertionLayer == null) return;

            CoordSys layerCoordsys = map.InsertionLayer.LayerCoordSys;

            CoordConverter oCC = new CoordConverter();
            oCC.Init(layerCoordsys, map.DisplayCoordSys);

            // this atPan converts DisplayCoordSys into Screen CoordSys[px]
            // DisplayCoordSys has Y axis up (unless its AT does not change it)
            // Screen Y axis is down
            AffineTransform atPan = new AffineTransform();
            atPan.OffsetInPlace((double)map.MapOffsetX, (double)map.MapOffsetY);
            atPan.MultiplyInPlace(map.MapScale, -map.MapScale);

            // add screen scale and offset transformation
            oCC.atMaster = oCC.atMaster.Compose(atPan);

            oCC.ConvertInverse(e.X, e.Y);

            DPoint pt = new DPoint(oCC.X, oCC.Y);
            // szukaj w tym miejscu feature
            List<Feature> ftrs = map.InsertionLayer.Search(pt);

            if (ftrs.Count == 0)
            {
                Feature oF = FeatureFactory.CreateSymbol(oCC.X, oCC.Y);
                map.InsertionLayer.FeaturesAdd(oF);
            }

            MapControl.Globals.Instance.MapControl.InvalidateMap();
        }
开发者ID:ravcio,项目名称:MapNet,代码行数:33,代码来源:MapToolAddEdit.cs

示例2: getRoutePoints

        public static IEnumerable<DPoint> getRoutePoints(string route_guid)
        {
            List<DPoint> pntsList = new System.Collections.Generic.List<DPoint>();
            string sql = "select * from routes_points where route_guid='" + route_guid + "' order by point_num";

            using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection))
            using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, connection))
            {
                DataSet ds = new DataSet();
                DataTable dt = new DataTable();
                ds.Reset();
                da.Fill(ds);
                dt = ds.Tables[0];

                if (dt == null || dt.Rows == null || dt.Rows.Count == 0)
                {
                    return null;
                }

                foreach (DataRow row in dt.Rows)
                {

                    DPoint mp = new DPoint();
                    mp.x = System.Convert.ToDouble(row["pointx"]);
                    mp.y = System.Convert.ToDouble(row["pointy"]);
                    pntsList.Add(mp);
                }
            }


            return pntsList;
        }
开发者ID:ohadmanor,项目名称:TDS,代码行数:32,代码来源:RoutesDB.cs

示例3: recordMovePoint

        public void recordMovePoint(DPoint point, DPoint newPoint)
        {
            undoElementCurrent.movePoint(point, new DPoint(point));

            point.X = newPoint.X;
            point.Y = newPoint.Y;
        }
开发者ID:ravcio,项目名称:MapNet,代码行数:7,代码来源:UndoManager.cs

示例4: createRoute

        // create a straight line route from source to dest
        public static Route createRoute(DPoint source, DPoint dest)
        {
            List<DPoint> points = new List<DPoint>();
            points.Add(source);
            points.Add(dest);

            return createRoute(points);
        }
开发者ID:ohadmanor,项目名称:TDS,代码行数:9,代码来源:RouteUtils.cs

示例5: EmfGraphics

        public EmfGraphics(DRect bounds, DPoint screenMM, DPoint deviceRes)
        {
            this.screenMM = screenMM;
            this.deviceRes = deviceRes;

            // create memory stream
            ms = new MemoryStream();
            // write header
            Emf.MetafileHeaderExtension2 h = new Emf.MetafileHeaderExtension2();
            h.EmfHeader.Type = 1;
            h.EmfHeader.Size = (uint)Marshal.SizeOf(typeof(Emf.MetafileHeaderExtension2));
            h.EmfHeader.Bounds = new Emf.RectL((int)bounds.X, (int)bounds.Y, (int)bounds.Right, (int)bounds.Bottom);
            double pixelWidth = screenMM.X / deviceRes.X;
            double pixelHeight = screenMM.Y / deviceRes.Y;
            h.EmfHeader.Frame = new Emf.RectL((int)(bounds.X * 100 * pixelWidth),
                (int)(bounds.Y * 100 * pixelHeight),
                (int)(bounds.Right * 100 * pixelWidth),
                (int)(bounds.Bottom * 100 * pixelHeight));
            h.EmfHeader.Signature = (uint)Emf.FormatSignature.ENHMETA_SIGNATURE;
            h.EmfHeader.Version = 0x00010000;
            h.EmfHeader.Bytes = 0; // size of metafile (set later on)
            h.EmfHeader.Records = 0; // num of records in metafile (set later on)
            h.EmfHeader.Handles = 0; // max number of gdi objects used at one time (set later on)
            h.EmfHeader.Reserved = 0;
            h.EmfHeader.nDescription = 0;
            h.EmfHeader.offDescription = 0;
            h.EmfHeader.nPalEntries = 0; // set later on
            h.EmfHeader.Device = new Wmf.SizeL((uint)deviceRes.X, (uint)deviceRes.Y);
            h.EmfHeader.Millimeters = new Wmf.SizeL((uint)screenMM.X, (uint)screenMM.Y);
            h.EmfHeaderExtension1.cbPixelFormat = 0;
            h.EmfHeaderExtension1.offPixelFormat = 0;
            h.EmfHeaderExtension1.bOpenGL = 0;
            h.EmfHeaderExtension2.MicrometersX = (uint)(screenMM.X * 1000);
            h.EmfHeaderExtension2.MicrometersY = (uint)(screenMM.Y * 1000);
            byte[] data = RawSerialize(h);
            ms.Write(data, 0, data.Length);

            WriteRecordHeader(Emf.RecordType.EMR_SETMAPMODE, 12);
            WriteUInt(0x08); // MM_ANISOTROPIC

            WriteRecordHeader(Emf.RecordType.EMR_SETWINDOWORGEX, 16);
            WritePointL(new Wmf.PointL(h.EmfHeader.Bounds.Left, h.EmfHeader.Bounds.Top));
            WriteRecordHeader(Emf.RecordType.EMR_SETWINDOWEXTEX, 16);
            WriteSizeL(new Wmf.SizeL((uint)(h.EmfHeader.Bounds.Right - h.EmfHeader.Bounds.Left),
                (uint)(h.EmfHeader.Bounds.Bottom - h.EmfHeader.Bounds.Top)));
            WriteRecordHeader(Emf.RecordType.EMR_SETVIEWPORTORGEX, 16);
            WritePointL(new Wmf.PointL(h.EmfHeader.Bounds.Left, h.EmfHeader.Bounds.Top));
            WriteRecordHeader(Emf.RecordType.EMR_SETVIEWPORTEXTEX, 16);
            WriteSizeL(new Wmf.SizeL((uint)(h.EmfHeader.Bounds.Right - h.EmfHeader.Bounds.Left),
                (uint)(h.EmfHeader.Bounds.Bottom - h.EmfHeader.Bounds.Top)));

            WriteRecordHeader(Emf.RecordType.EMR_SETBKMODE, 12);
            WriteUInt(0x01); // TRANSPARENT
            WriteRecordHeader(Emf.RecordType.EMR_SETTEXTALIGN, 12);
            WriteUInt(Wmf.TA_LEFT | Wmf.TA_TOP);
        }
开发者ID:djpnewton,项目名称:ddraw,代码行数:56,代码来源:EmfGraphics.cs

示例6: BodyHitTest

 protected override DHitTest BodyHitTest(DPoint pt, List<Figure> children)
 {
     DPoints pts = DrawPoints();
     if (Fill.IsEmpty)
     {
         if (DGeom.PointInPolyline(pt, pts, SwHalf + noFillThresh))
             return DHitTest.Body;
     }
     else if (DGeom.PointInPolygon(pt, pts) || DGeom.PointInPolyline(pt, pts, SwHalf))
         return DHitTest.Body;
     return DHitTest.None;
 }
开发者ID:djpnewton,项目名称:ddraw,代码行数:12,代码来源:FigurePolygons.cs

示例7: BoundingBoxOfRotatedRect

 public static DRect BoundingBoxOfRotatedRect(DRect rect, double angle, DPoint origin)
 {
     if (angle == 0)
         return rect;
     DPoint p1 = RotatePoint(rect.TopLeft, origin, angle);
     DPoint p2 = RotatePoint(rect.TopRight, origin, angle);
     DPoint p3 = RotatePoint(rect.BottomLeft, origin, angle);
     DPoint p4 = RotatePoint(rect.BottomRight, origin, angle);
     double x = Math.Min(Math.Min(p1.X, p2.X), Math.Min(p3.X, p4.X));
     double y = Math.Min(Math.Min(p1.Y, p2.Y), Math.Min(p3.Y, p4.Y));
     double right = Math.Max(Math.Max(p1.X, p2.X), Math.Max(p3.X, p4.X));
     double bottom = Math.Max(Math.Max(p1.Y, p2.Y), Math.Max(p3.Y, p4.Y));
     return new DRect(x, y, right - x, bottom - y);
 }
开发者ID:djpnewton,项目名称:ddraw,代码行数:14,代码来源:DGeom.cs

示例8: planStraightLineRoute

        public static typRoute planStraightLineRoute(DPoint source, DPoint dest, String routeName)
        {
            typRoute route = new typRoute();
            route.RouteName = routeName;
            route.arr_legs = new List<typLegSector>();

            typLegSector legSector = new typLegSector();
            legSector.FromLongn = source.x;
            legSector.FromLatn = source.y;
            legSector.ToLongn = dest.x;
            legSector.ToLatn = dest.y;
            legSector.LegDistance = (float)TerrainService.MathEngine.CalcDistance(legSector.FromLongn, legSector.FromLatn, legSector.ToLongn, legSector.ToLatn) / 1000f;
            route.arr_legs.Add(legSector);

            return route;
        }
开发者ID:ohadmanor,项目名称:TDS,代码行数:16,代码来源:RoutePlanner.cs

示例9: MouseMove

        public override void MouseMove(object sender, MouseEventArgs e)
        {
            base.MouseMove(sender, e);

            // highlight polilines and points

            if (map.InsertionLayer == null) return;

            CoordSys layerCoordsys = map.InsertionLayer.LayerCoordSys;

            CoordConverter oCC = new CoordConverter();
            oCC.Init(layerCoordsys, map.DisplayCoordSys);

            // this atPan converts DisplayCoordSys into Screen CoordSys[px]
            // DisplayCoordSys has Y axis up (unless its AT does not change it)
            // Screen Y axis is down
            AffineTransform atPan = new AffineTransform();
            atPan.OffsetInPlace((double)map.MapOffsetX, (double)map.MapOffsetY);
            atPan.MultiplyInPlace(map.MapScale, -map.MapScale);

            // add screen scale and offset transformation
            oCC.atMaster = oCC.atMaster.Compose(atPan);

            int margin = 5;

            oCC.ConvertInverse(e.X, e.Y);
            DPoint pt_center = new DPoint(oCC.X, oCC.Y);
            oCC.ConvertInverse(e.X - margin, e.Y - margin);
            DPoint pt1 = new DPoint(oCC.X, oCC.Y);
            oCC.ConvertInverse(e.X + margin, e.Y + margin);
            DPoint pt2 = new DPoint(oCC.X, oCC.Y);
            // szukaj w tym miejscu feature
            //List<Feature> ftrs = map.InsertionLayer.Search(pt);

            // construct search rectangle (10px wide)
            DRect rect = new DRect(pt1.X, pt2.Y, pt2.X, pt1.Y);

            //map.InsertionLayer.SelectWithinRectangle(rect);
        }
开发者ID:ravcio,项目名称:MapNet,代码行数:39,代码来源:MapToolAddEdit.cs

示例10: DistBetweenPtAndLine

        public static double DistBetweenPtAndLine(DPoint pt, DPoint linep1, DPoint linep2, out DPoint linept)
        {
            /* Calculate the distance between a point and a line */

            // below is based from http://www.allegro.cc/forums/thread/589720/644831#target

            double A = pt.X - linep1.X;
            double B = pt.Y - linep1.Y;
            double C = linep2.X - linep1.X;
            double D = linep2.Y - linep1.Y;

            double dot = A * C + B * D;
            double len_sq = C * C + D * D;
            double param = dot / len_sq;

            if (param < 0)
                linept = new DPoint(linep1.X, linep1.Y);
            else if (param > 1)
                linept = new DPoint(linep2.X, linep2.Y);
            else
                linept = new DPoint(linep1.X + param * C, linep1.Y + param * D);

            return DistBetweenTwoPts(linept, pt);
        }
开发者ID:djpnewton,项目名称:ddraw,代码行数:24,代码来源:DGeom.cs

示例11: SetPageSize

 public abstract void SetPageSize(DPoint pageSize);
开发者ID:djpnewton,项目名称:ddraw,代码行数:1,代码来源:DViewer.cs

示例12: DoMouseUp

 protected void DoMouseUp(DMouseButton btn, DPoint pt)
 {
     if (MouseUp != null)
         MouseUp(this, btn, pt);
 }
开发者ID:djpnewton,项目名称:ddraw,代码行数:5,代码来源:DViewer.cs

示例13: DoMouseMove

 protected void DoMouseMove(DPoint pt)
 {
     if (MouseMove != null)
         MouseMove(this, pt);
 }
开发者ID:djpnewton,项目名称:ddraw,代码行数:5,代码来源:DViewer.cs

示例14: DoMouseDown

 protected void DoMouseDown(DMouseButton btn, DPoint pt)
 {
     if (MouseDown != null)
         MouseDown(this, btn, pt);
 }
开发者ID:djpnewton,项目名称:ddraw,代码行数:5,代码来源:DViewer.cs

示例15: DoDoubleClick

 protected void DoDoubleClick(DPoint pt)
 {
     if (DoubleClick != null)
         DoubleClick(this, pt);
 }
开发者ID:djpnewton,项目名称:ddraw,代码行数:5,代码来源:DViewer.cs


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