open-discussion > landmark moving fix
Showing 1-5 of 5 posts
Oct 4, 2011 03:10 PM | Carlos Becker
landmark moving fix
Hi. I have experienced a problem when moving a landmark when zoom
is not 1:1.
I have based the following fix on some other code present in v3d_core.cpp. Please check it to see if there are any inconsistencies.
thanks.
Index: v3d_core.cpp
===================================================================
--- v3d_core.cpp (revision 1962)
+++ v3d_core.cpp (working copy)
@@ -1748,7 +1748,10 @@
else if (b_moveCurrentLandmark==true && ind_landmarkToBeChanged>=0 && QApplication::keyboardModifiers()==Qt::ShiftModifier)
{
QPoint cp = e->pos(); ///(disp_scale*m_scale); //100909
-
+
+ cp.setX(double((e->x()-curDisplayCenter.x()))/(disp_scale*m_scale)+pixmap.width()/2.0+0.5);
+ cp.setY(double((e->y()-curDisplayCenter.y()))/(disp_scale*m_scale)+pixmap.height()/2.0+0.5);
+
int sx,sy,sz; //current selection location's x,y,z
switch(Ptype)
I have based the following fix on some other code present in v3d_core.cpp. Please check it to see if there are any inconsistencies.
thanks.
Index: v3d_core.cpp
===================================================================
--- v3d_core.cpp (revision 1962)
+++ v3d_core.cpp (working copy)
@@ -1748,7 +1748,10 @@
else if (b_moveCurrentLandmark==true && ind_landmarkToBeChanged>=0 && QApplication::keyboardModifiers()==Qt::ShiftModifier)
{
QPoint cp = e->pos(); ///(disp_scale*m_scale); //100909
-
+
+ cp.setX(double((e->x()-curDisplayCenter.x()))/(disp_scale*m_scale)+pixmap.width()/2.0+0.5);
+ cp.setY(double((e->y()-curDisplayCenter.y()))/(disp_scale*m_scale)+pixmap.height()/2.0+0.5);
+
int sx,sy,sz; //current selection location's x,y,z
switch(Ptype)
Oct 4, 2011 03:10 PM | Carlos Becker
RE: landmark moving fix
furthermore, when a landmark is moved the comments and other
information was not kept. This diff fixes that as well:
@@ -1770,9 +1773,12 @@
break;
}
- LocationSimple tmpLocation(sx,sy,sz);
- tmpLocation.inputProperty = imgData->listLandmarks.at(ind_landmarkToBeChanged).inputProperty;
- tmpLocation.radius = imgData->listLandmarks.at(ind_landmarkToBeChanged).radius;
+ // make a copy before replacing
+ LocationSimple tmpLocation = imgData->listLandmarks.at(ind_landmarkToBeChanged);
+ tmpLocation.x = sx;
+ tmpLocation.y = sy;
+ tmpLocation.z = sz;
+
imgData->listLandmarks.replace(ind_landmarkToBeChanged, tmpLocation);
imgData->setFocusFeatureViewText();
@@ -1770,9 +1773,12 @@
break;
}
- LocationSimple tmpLocation(sx,sy,sz);
- tmpLocation.inputProperty = imgData->listLandmarks.at(ind_landmarkToBeChanged).inputProperty;
- tmpLocation.radius = imgData->listLandmarks.at(ind_landmarkToBeChanged).radius;
+ // make a copy before replacing
+ LocationSimple tmpLocation = imgData->listLandmarks.at(ind_landmarkToBeChanged);
+ tmpLocation.x = sx;
+ tmpLocation.y = sy;
+ tmpLocation.z = sz;
+
imgData->listLandmarks.replace(ind_landmarkToBeChanged, tmpLocation);
imgData->setFocusFeatureViewText();
Oct 4, 2011 04:10 PM | Hanchuan Peng
RE: landmark moving fix
fixed in the version v2.700 (svn -r 1963). Thanks for the
suggestions!
-Hanchuan
Originally posted by Carlos Becker:
-Hanchuan
Originally posted by Carlos Becker:
furthermore, when a landmark is moved the
comments and other information was not kept. This diff fixes that
as well:
@@ -1770,9 +1773,12 @@
break;
}
- LocationSimple tmpLocation(sx,sy,sz);
- tmpLocation.inputProperty = imgData->listLandmarks.at(ind_landmarkToBeChanged).inputProperty;
- tmpLocation.radius = imgData->listLandmarks.at(ind_landmarkToBeChanged).radius;
+ // make a copy before replacing
+ LocationSimple tmpLocation = imgData->listLandmarks.at(ind_landmarkToBeChanged);
+ tmpLocation.x = sx;
+ tmpLocation.y = sy;
+ tmpLocation.z = sz;
+
imgData->listLandmarks.replace(ind_landmarkToBeChanged, tmpLocation);
imgData->setFocusFeatureViewText();
@@ -1770,9 +1773,12 @@
break;
}
- LocationSimple tmpLocation(sx,sy,sz);
- tmpLocation.inputProperty = imgData->listLandmarks.at(ind_landmarkToBeChanged).inputProperty;
- tmpLocation.radius = imgData->listLandmarks.at(ind_landmarkToBeChanged).radius;
+ // make a copy before replacing
+ LocationSimple tmpLocation = imgData->listLandmarks.at(ind_landmarkToBeChanged);
+ tmpLocation.x = sx;
+ tmpLocation.y = sy;
+ tmpLocation.z = sz;
+
imgData->listLandmarks.replace(ind_landmarkToBeChanged, tmpLocation);
imgData->setFocusFeatureViewText();
Oct 6, 2011 12:10 PM | Carlos Becker
RE: landmark moving fix
You are welcome, thank you for such a nice software ;)
I have run into other bugs related to landmarks and I realized that, as before, they have to do with coordinate transformations.
In the attached diff I have written a simple function based on your code to compute a transformation between screen coordinates and image coordinates, so that it can be reused.
I also removed the old code that hard-coded that transformation, calling this new function instead.
Best regards.
I have run into other bugs related to landmarks and I realized that, as before, they have to do with coordinate transformations.
In the attached diff I have written a simple function based on your code to compute a transformation between screen coordinates and image coordinates, so that it can be reused.
I also removed the old code that hard-coded that transformation, calling this new function instead.
Best regards.
Oct 6, 2011 08:10 PM | Hanchuan Peng
RE: landmark moving fix
excellent revision! I have committed
the change your made to the version v2.701. Thanks for the
contribution.
-hanchuan
Originally posted by Carlos Becker:
-hanchuan
Originally posted by Carlos Becker:
You are welcome, thank you for such a nice
software ;)
I have run into other bugs related to landmarks and I realized that, as before, they have to do with coordinate transformations.
In the attached diff I have written a simple function based on your code to compute a transformation between screen coordinates and image coordinates, so that it can be reused.
I also removed the old code that hard-coded that transformation, calling this new function instead.
Best regards.
I have run into other bugs related to landmarks and I realized that, as before, they have to do with coordinate transformations.
In the attached diff I have written a simple function based on your code to compute a transformation between screen coordinates and image coordinates, so that it can be reused.
I also removed the old code that hard-coded that transformation, calling this new function instead.
Best regards.