ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Drawing Polygons on ImageEnVect1 & maps
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

bruce

Peru
5 Posts

Posted - Dec 04 2014 :  15:42:45  Show Profile  Reply

The sample project "Geo Maps - Use the GPS data in photos to show Their location on a map."
The demo page is very interesting (http://www.imageen.com/demos/index.html).

But now I need to draw on the map (using code), polygons and circles (with geographic latitude and longitude)

The code could be as follows:

var
     Point: Array of TPoint;
begin

    Draw_hobj: ImageEnVect1.AddNewObject = ();
    ImageEnVect1.SetObjBackTo (Draw_hobj, -1);

    setlength (apoint, 3);
    Apoint [0] .X: = 500; // Map.LongitudeToBmpX (-16.3995);
    Apoint [0] .And: = 500; // Map.LatitudeToBmpY (-71.5373);

    Apoint [1] .X: = 600; // Map.LongitudeToBmpX (-16.4895);
    Apoint [1] .And: = 600; // Map.LatitudeToBmpY (-71.6473);

    Apoint [1] .X: = 200; // Map.LongitudeToBmpX (-16.4895);
    Apoint [1] .And: = 600; // Map.LatitudeToBmpY (-71.6473);

    ImageEnVect1.ObjKind [Draw_hobj]: = iekPOLYLINE;
    ImageEnVect1.ObjLabelPosition [Draw_hobj]: = ielBegin;
    ImageEnVect1.ObjTransparency [Draw_hobj]: = 100;
    ImageEnVect1.ObjPenWidth [Draw_hobj]: = 10;
    ImageEnVect1.ObjPenColor [Draw_hobj]: = clRed;
    ImageEnVect1.ObjStyle [Draw_hobj]: = [ievsSelectable, ievsVisible];
    ImageEnVect1.ObjName [Draw_hobj]: = 'None';
    ImageEnVect1.ObjText [Draw_hobj]: = 'hello';
    // Sept. With your Poly_pts some value //
    ImageEnVect1.OffScreenPaint: = true;
    ImageEnVect1.SetObjPolylinePoints (Draw_hobj, apoint);
    ImageEnVect1.Update;

It does not work when you load maps on the component ImageEnVect1

   map: = TIESlippyMap.Create (iesmpMapQuest, 'cache');
   map.Zoom: = 4;

   ImageEnVect1.SoftShadow.Enabled: = true;
   ImageEnVect1.LegacyBitmap: = false;
   ImageEnVect1.IEBitmap.VirtualBitmapProvider: = map;
   map.Zoom: = 15;
   map.Latitude: = -16.3995;
   map.Longitude: = -71.5373;

Some sage who can enlighten this grasshopper.

regards

Bruce Cano

xequte

39140 Posts

Posted - Dec 04 2014 :  16:27:38  Show Profile  Reply
Hi Bruce

In what way does it not work?

Please also see:

http://www.imageen.com/ieforum/topic.asp?TOPIC_ID=1905


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

bruce

Peru
5 Posts

Posted - Dec 04 2014 :  20:58:20  Show Profile  Reply
I try to explain with a simple example.

From 4 geographical coordinates (latitude, longitude) I want to draw a rectangular polygon on a TIESlippyMap.


    map: = TIESlippyMap.Create (iesmpMapQuest, 'cache');
    ImageEnVect1.LegacyBitmap: = false;
    ImageEnVect1.IEBitmap.VirtualBitmapProvider: = map;
    map.Zoom: = 15;
  
And when zooming or displacements, the polygon retain its position.

I wish to draw the polygon by code (will extract the coordinates of a database).

regards

Bruce

Developer System

--- --- translated by google
Go to Top of Page

xequte

39140 Posts

Posted - Dec 06 2014 :  18:57:27  Show Profile  Reply
Hi Bruce

Its not quite that simple, as the Slippy maps in ImageEn use a "Virtual bitmap," so there are no fixed positions. If you explicitly draw a polygon/circle then it will be in the wrong position when the image is scrolled or zoomed.

So either you output your map to another bitmap (i.e. so it is now a fixed image where the pixels/positions do not change) or you draw your polygon/circle "virtually".

The latter is the best solution if you wish your map to still be interactive. See the Geomaps demo and the way that the pins are drawn in the Backbuffer event of TImageEnView. In that event you will map a specific GPS coordinate to a screen position and draw your shape relative to that (and also stretching its size based on the level of zoom).

If you are using ImageEnVect objects instead, then whenever the map changed you would need to iterate through your objects and reposition them based on their GPS coordinates.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

bruce

Peru
5 Posts

Posted - Dec 15 2014 :  07:52:56  Show Profile  Reply
It is in plans to implement these features?

regards
Go to Top of Page

xequte

39140 Posts

Posted - Dec 16 2014 :  17:10:31  Show Profile  Reply
Hi Bruce

The nature of virtual bitmaps frees the display control from needing to understand its content. To implement automatic movement of objects on a virtual bitmap, it would need to understand its content and/or not be virtual. It makes more sense for the supplier of the virtual image update the location of objects or in some way notify the display app of the change.

There is not an easy solution to that from a generic library perspective. It would be easier for your app, knowing the content, to iterate through the objects and update their position.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: