Click here to Skip to main content
15,886,258 members
Articles / Programming Languages / C#
Article

Mapview Implementation in C#

Rate me:
Please Sign up or sign in to vote.
1.27/5 (15 votes)
7 Jun 20042 min read 97.4K   1.8K   26   13
Mapview Implementation in C#

Image 1

Introduction

Graphic applications which make the backbone for CAD/CAM/GIS applications need to have a canvas or view control on which all the graphic elements are rendered. Any complex model in CAD/CAM/GIS applications is composed of basic graphic elements such as lines, arc, circle, ellipse, rectangles, polylines, polygons…etc.

The complex models are easily created by performing the simple operation on the graphic elements, and these basic editing features include copy, cut, paste, move, delete, scale, mirror.

Mapview is an attempt to create a C# component that can be used to create and edit the graphic elements interactively.

Background

Mapview control is a C# component, which allows the user to create various types of vector graphical elements and which will be created and edited interactively.

To avoid this inconvenience, this implementation is logically divided to geometrical model and view. When you're editing objects inside the Mapview, geometrical model (presented in "real world" coordinates) is changing and the view (client coordinates) stays the same, and when you rescale and scroll the Mapview, the geometrical model stays unchanged.

Mapview model could have several views showing different parts of the model. All views are updated automatically when the model changes, it means that if you moving or editing shape in one of the views you will see changes in others.

Using Mapview

The sample code is having the detailed description about using the application. This is initial version of the control and some of the functionality is yet to be implemented.

The initial upload is having a blue-print of the functionality of the program and most of the features are in there basic and advanced implementation state.

Creating the graphic elements is in advanced state of implementation. Spline/Curve/Closed Curve is yet to be implemented.

Different ways of selecting the already existing objects is implemented.

Moving/Deleting the selected elements is implemented.

Copy/Cut/Past is yet to be implemented.

View commands like Zoom In, Zoom Out, Zoom Window, Zoom Extents and Pan are to fine tuned and fix the bugs.

Using the code

The sample code is having the detailed description about using the application. This is initial version of the control and some of the functionality is yet to be implemented.

Enthusiastic users are encouraged to take the code implement/modify/fine tune the code wherever required.

Points of Interest

I would like to make an efficient FREE CAD/GIS graphic engine in .NET using C#. So, that the users need not depend on the proprietary software's to make the applications. This is the first step in that direction.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 1 Pin
Wertugo55525-Aug-09 22:23
Wertugo55525-Aug-09 22:23 
GeneralUseless Pin
JSMeloche12-Sep-08 11:28
JSMeloche12-Sep-08 11:28 
GeneralPlease!Hellp! Pin
pl_vlad17-Feb-07 5:24
pl_vlad17-Feb-07 5:24 
GeneralBe nice if it compiled Pin
gfhfff5-Dec-06 20:28
gfhfff5-Dec-06 20:28 
QuestionMore Background on GDI+ and graphics design Pin
maxnetpromo7-Oct-05 22:20
maxnetpromo7-Oct-05 22:20 
QuestionWhat does swap? Pin
Royaeh kohestan22-Jun-04 2:09
Royaeh kohestan22-Jun-04 2:09 
AnswerRe: What does swap? Pin
Kalyan Kumar8-Jul-04 19:41
Kalyan Kumar8-Jul-04 19:41 
GeneralWorking version request Pin
pxp7-Jun-04 15:09
pxp7-Jun-04 15:09 
GeneralRe: Working version request Pin
pxp7-Jun-04 15:25
pxp7-Jun-04 15:25 
Got it working,...

Modify Mapview.cs @ public void Zoom

Change case GIS.Geometry.ZoomType.Pan: to:

case GIS.Geometry.ZoomType.Pan:<br />
    Point PtDelta = new Point( Pts[1].X-Pts[0].X + (int) realRect.X, Pts[1].Y-Pts[0].Y + (int) realRect.Y);<br />
    if((PtDelta.X <0) || (PtDelta.X + realRect.Width > realView.Width))<br />
        PtDelta.X=0;<br />
    else<br />
        PtDelta.X -= (int) realRect.X;<br />
    if((PtDelta.Y <0) || (PtDelta.Y + realRect.Height > realView.Height))<br />
        PtDelta.Y=0;<br />
    else<br />
        PtDelta.Y -= (int) realRect.Y;<br />
    realRect.Offset(PtDelta);<br />
    m_StartingPoint = m_EndingPoint;<br />
    Refresh();<br />
    break;


Also @ line 801 --> change pts to Pts



"Additional information: Out of memory." in GeoUtil.cs

static public Matrix Swap(RectangleF src, RectangleF dest)
breaks @ line 405: Matrix NewMatrix = new Matrix(src, Point3);


Any easy solution for the Out of memory problem ?
I have 1000+ Mb free memory available fore executing the app.
GeneralCrap-tastic Pin
Michael.Fischer3-Jun-04 7:13
Michael.Fischer3-Jun-04 7:13 
GeneralRe: Crap-tastic Pin
Colin Angus Mackay4-Jun-04 14:15
Colin Angus Mackay4-Jun-04 14:15 
GeneralRe: Crap-tastic Pin
jaxterama24-Aug-04 18:02
jaxterama24-Aug-04 18:02 
GeneralImage SRC Incorrect Pin
Craig Eddy3-Jun-04 1:22
Craig Eddy3-Jun-04 1:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.