本文整理汇总了C++中SpatialDataView::getRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ SpatialDataView::getRotation方法的具体用法?C++ SpatialDataView::getRotation怎么用?C++ SpatialDataView::getRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpatialDataView
的用法示例。
在下文中一共展示了SpatialDataView::getRotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: orient
//.........这里部分代码省略.........
return;
}
SpatialDataView* pSpatialDataView = NULL;
if (pView->isKindOf("SpatialDataView") == true)
{
pSpatialDataView = static_cast<SpatialDataView*> (pView);
}
else if (pView->isKindOf("ProductView") == true)
{
ProductView* pProductView = static_cast<ProductView*> (pView);
GraphicLayer* pLayoutLayer = NULL;
pLayoutLayer = pProductView->getLayoutLayer();
if (pLayoutLayer == pLayer)
{
list<GraphicObject*> viewObjects;
pLayoutLayer->getObjects(VIEW_OBJECT, viewObjects);
list<GraphicObject*>::iterator iter = viewObjects.begin();
while (iter != viewObjects.end())
{
GraphicObject* pObject = *iter;
if (pObject != NULL)
{
View* pObjectView = pObject->getObjectView();
if (pObjectView != NULL)
{
if (pObjectView->isKindOf("SpatialDataView") == true)
{
pSpatialDataView = static_cast<SpatialDataView*> (pObjectView);
}
}
}
++iter;
}
}
}
if (pSpatialDataView == NULL)
{
return;
}
LayerList* pLayerList = pSpatialDataView->getLayerList();
VERIFYNRV(pLayerList != NULL);
RasterElement* pRaster = pLayerList->getPrimaryRasterElement();
VERIFYNRV(pRaster != NULL);
if (!pRaster->isGeoreferenced())
{
return;
}
// Calculate the angle of the object relative to the pixel coordinates
updateHandles();
LocationType pixelStart = mHandles[7];
ProductView* pProductView = dynamic_cast<ProductView*> (pView);
if (pProductView != NULL)
{
// Convert to the screen coordinate system
double dScreenX = 0;
double dScreenY = 0;
pLayer->translateDataToWorld(pixelStart.mX, pixelStart.mY, pixelStart.mX, pixelStart.mY);
pProductView->translateWorldToScreen(pixelStart.mX, pixelStart.mY, dScreenX, dScreenY);
// Convert to the spatial data view coordinate system
pSpatialDataView->translateScreenToWorld(dScreenX,
dScreenY, pixelStart.mX, pixelStart.mY);
pLayer->translateWorldToData(pixelStart.mX, pixelStart.mY, pixelStart.mX, pixelStart.mY);
}
double dAngle;
if (GeoAlgorithms::getAngleToNorth(pRaster, dAngle, pixelStart) == false)
{
return;
}
// Update the angle if the object is in the layout layer
if (pProductView != NULL)
{
// Rotation
dAngle -= pSpatialDataView->getRotation();
// Pitch
double dPitch = pSpatialDataView->getPitch();
if (dPitch > 0.0)
{
dAngle *= -1.0;
}
}
// Rotate the object
setRotation(dAngle);
// Update the orientation flag
DirectionalArrowObjectImp::orient();
}
示例2: draw
//.........这里部分代码省略.........
arrowHeadOffset = arrowHeadOffset - .1;
}
else
{
break;
}
arrowHeadOffset = (arrowHeadOffset < 0) ? 0.0 : arrowHeadOffset;
}
// Get arrow head base point coordinates from calculated arrow head info
startPerc = (arrowLength == 0.0) ? 0.0 : 1 - (arrowHeadOffset/arrowLength);
startPerc = (startPerc < 0.0) ? 0.0 : startPerc;
startPerc = (startPerc > 1.0) ? 1.0 : startPerc;
DrawUtil::getParallelLine(arrowStartPoint, arrowEndPoint, arrowHeadOffset, startPerc, 1.0f,
arrowHeadBasePoint, junkLocation);
// End bar coordinates
LocationType barStartPoint1;
LocationType barStartPoint2; // The points that make up the start bar-end (ll corner)
LocationType barEndPoint1;
LocationType barEndPoint2; // The points that make up the end bar-end (ur corner)
double barLength = 0; // Bar-ends length
barLength = (pixelSize == 0.0) ? 0.0 : (mBarEndLength * sqrtLineWidth) / pixelSize;
DrawUtil::getPerpendicularLine(llCorner, urCorner, barLength, barStartPoint1, barStartPoint2);
DrawUtil::getPerpendicularLine(urCorner, llCorner, barLength, barEndPoint1, barEndPoint2);
// Calculate text info
double textOffset = 0; // Perpendicular offset from text to text anchor
int maxTextureSize = 0; // The max allowable texture size
textOffset = (pixelSize == 0.0) ? 0.0 : (mTextOffset * sqrtLineWidth) / pixelSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
QFontMetrics ftMetrics(font);
double viewRotation = pView->getRotation();
viewRotation = GeoConversions::convertDegToRad(viewRotation);
if (mDrawnDistanceUnit != pLayer->getDistanceUnits() ||
mDrawnGeocoord != pLayer->getGeocoordType() ||
mDrawnDmsFormat != pLayer->getGeoFormat())
{
refreshGeoInformation(); // only modifies cache stuff
}
if (pLayer->getDisplayEndPoints())
{
// Calculate start and end text info
bool startLocDrawTop = false; // Whether to draw the start lat/lon text on the top of the specified point
bool endLocDrawTop = true; // Whether to draw the end lat/lon text on the top of the specified point
if (urCorner.mY < llCorner.mY)
{
startLocDrawTop = true;
endLocDrawTop = false;
}
// Calculate start and end location text info
LocationType startLocPoint; // The location to display the "start location" text
LocationType endLocPoint; // The location to display the "end location" text
startLocPoint = llCorner;
endLocPoint = urCorner;
startLocPoint.mY += textOffset;
endLocPoint.mY += textOffset;
if (!mStartLocText.isEmpty())
{
DrawUtil::drawRotatedText(mStartLocTextTexture, mStartLocText, font,
textColor, startLocPoint, viewRotation, startLocDrawTop);