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
 Marker Demo
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

John

USA
94 Posts

Posted - Oct 19 2011 :  05:35:17  Show Profile  Reply
Fabrizio

a) The Marker demo illustrates how to create "markers" with MouseInteractVt := [miPutLineLabel];. Is it possible to select a iekLineLabel object and determine the pixel location of the "marker" created with a iekLineLabel object?

b) If a) is possible, is there a function to enter the pixel location of two iekLineLabel objects and determine the distance in pixels between the two "markers"?

TIA

John

fab

1310 Posts

Posted - Oct 20 2011 :  00:22:55  Show Profile  Reply
quote:
a) The Marker demo illustrates how to create "markers" with MouseInteractVt := [miPutLineLabel];. Is it possible to select a iekLineLabel object and determine the pixel location of the "marker" created with a iekLineLabel object?


It is possible to know the initial and ending coordinates of the line. Look at GetObjRect method.

quote:
b) If a) is possible, is there a function to enter the pixel location of two iekLineLabel objects and determine the distance in pixels between the two "markers"?


You have to calculate the distance manually.
Given the coordinates of the two objects you can calculate the distance with:


function GetTwoObjDistance(ie:TImageEnVect; hobj1, hobj2: integer): double;
var
  lx, ly: double;
  r1, r2:TRect;
begin
  ie.GetObjRect(hobj1, r1);
  ie.GetObjRect(hobj2, r2);
  lx := abs(r1.Left-r2.Left) * ie.MeasureCoefX;
  ly := abs(r1.Top-r2.Top) * ie.MeasureCoefY;
  result := sqrt(lx * lx + ly * ly);
end;


This sample code assumes that Left/Right and Top/Bottom coordinates coincide.
Go to Top of Page

John

USA
94 Posts

Posted - Oct 20 2011 :  11:58:15  Show Profile  Reply
Fabrizio

The Label end of the iekLineLabel can be positioned 360 degrees around the "non-label" or "Marker" position of the iekLineLabel object. Because of this, my concern is how to determining the absolute x and y positions of the "Marker" location.

With GetObjRect I can define the x and y coordinates for each end of a selected iekLineLabel object. (see below) However, I need to determine the distance between to separate "Markers" on two separate iekLineLabel objects. As a result, the "Marker" position (non-labeled end) of each iekLineLabel object must be able to be defined so that the correct x and y coordinates are used to calculate the distance between the two selected "Markers".

Given the flexability in positioning the "Label" end of the iekLineLabel object around the "Marker" end, how do I determine which end of the iekLineLabel (left or right) contains the label and which end of the iekLineLabel represents the "Marker"?

var
tempObjIndex: Integer;
tempRect: TRect;
tempLeft_x: Integer;
tempLeft_y: Integer;
tempRight_x: Integer;
tempRight_y: Integer;

begin
ImageEnVect1.GetObjRect(ImageEnVect1.SelObjects[tempObjIndex], tempRect);
tempLeft_x := tempRect.TopLeft.x;
tempLeft_y := tempRect.TopLeft.y;
tempRight_x := tempRect.BottomRight.x;
tempRight_y := tempRect.BottomRight.y;
end;


TIA

John


Go to Top of Page

fab

1310 Posts

Posted - Oct 20 2011 :  12:55:49  Show Profile  Reply
quote:
Given the flexability in positioning the "Label" end of the iekLineLabel object around the "Marker" end, how do I determine which end of the iekLineLabel (left or right) contains the label and which end of the iekLineLabel represents the "Marker"?


Actually the linelabel was not designed for this purpose, in fact it is a line, not a marker.
Instead you could put an image as marker, using iekBITMAP.
Go to Top of Page

John

USA
94 Posts

Posted - Oct 20 2011 :  18:14:08  Show Profile  Reply
Fabrizio

Whether I use miPutLine label as previously discussed, a miPutBitMap and use a small circle or even miPutEllipse (as in the Spot demo), I need to be able to clearly define the x and y coordinates of two different objects for the purposes previously stated. I do not see a mechanism to accomplish this with any of the three mentioned choices. Using either an identifiable end of a miPutLine or the center of an iePutEllipse would be ideal.

Am I missing something or is this beyond the current program capabilities? If the latter, would you consider adding this functionality for the forthcoming 4.0.2 release?

I appreciate your efforts and anticipate your reply.

John
Go to Top of Page

fab

1310 Posts

Posted - Oct 20 2011 :  23:04:04  Show Profile  Reply
The center of an object is just the top and left plus the half of the width and height, so you can use every object as a marker.

quote:
Am I missing something or is this beyond the current program capabilities? If the latter, would you consider adding this functionality for the forthcoming 4.0.2 release?


Maybe, but you can obtain the same effect (distance of two markers, if I understood well) with a little effort.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: