本文整理汇总了C++中Pnt2f::x方法的典型用法代码示例。如果您正苦于以下问题:C++ Pnt2f::x方法的具体用法?C++ Pnt2f::x怎么用?C++ Pnt2f::x使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pnt2f
的用法示例。
在下文中一共展示了Pnt2f::x方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: layoutSize
Vec2f AbsoluteLayout::layoutSize(const MFUnrecComponentPtr* Components,
const Component* ParentComponent,
SizeType TheSizeType) const
{
Vec2f Result(0.0,0.0);
Vec2f ComponentSize;
Pnt2f ComponentPosition;
for(UInt32 i(0) ; i<Components->size() ; ++i)
{
ComponentPosition = dynamic_cast<AbsoluteLayoutConstraints*>((*Components)[i]->getConstraints())->getPosition();
ComponentSize = getComponentSize((*Components)[i],TheSizeType);
if(ComponentPosition.x() + ComponentSize.x() > Result.x())
{
Result[0] = ComponentPosition.x() + ComponentSize.x();
}
if(ComponentPosition.y() + ComponentSize.y() > Result.y())
{
Result[1] = ComponentPosition.y() + ComponentSize.y();
}
}
return Result;
}
示例2: Alpha
void Graphics3DExtrude::drawText(const Pnt2f& Position, const std::string& Text, const UIFontUnrecPtr TheFont, const Color4f& Color, const Real32& Opacity) const
{
TextLayoutParam layoutParam;
layoutParam.spacing = 1.1;
layoutParam.majorAlignment = TextLayoutParam::ALIGN_BEGIN;
layoutParam.minorAlignment = TextLayoutParam::ALIGN_BEGIN;
TextLayoutResult layoutResult;
TheFont->layout(Text, layoutParam, layoutResult);
TheFont->getTexture()->activate(getDrawEnv());
Real32 Alpha(Color.alpha() * Opacity * getOpacity());
//Setup the blending equations properly
glPushAttrib(GL_COLOR_BUFFER_BIT);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glColor4f(Color.red(), Color.green(), Color.blue(), Alpha );
glPushMatrix();
glTranslatef(Position.x(), Position.y(), 0.0);
glScalef(TheFont->getSize(), TheFont->getSize(), 1);
drawCharacters(layoutResult, TheFont);
glPopMatrix();
TheFont->getTexture()->deactivate(getDrawEnv());
glDisable(GL_BLEND);
glPopAttrib();
}
示例3: TheColumn
void TableHeader::MarginDraggedListener::mouseDragged(const MouseEventUnrecPtr e)
{
if(e->getButton() == e->BUTTON1)
{
Pnt2f MousePosInComponent = ViewportToComponent(e->getLocation(), TableHeaderRefPtr(_TableHeader), e->getViewport());
TableColumnRefPtr TheColumn(_TableHeader->getColumnModel()->getColumn(_TableHeader->_ResizingColumn));
Real32 NewWidth(MousePosInComponent.x() - _TableHeader->getColumnHeaders(_TableHeader->_ResizingColumn)->getPosition().x());
if(NewWidth <= 0 || NewWidth < TheColumn->getMinWidth())
{
NewWidth = TheColumn->getMinWidth();
}
if(NewWidth > TheColumn->getMaxWidth())
{
NewWidth = TheColumn->getMaxWidth();
}
//Get the new desired center for this margin
TheColumn->setWidth(NewWidth);
_TableHeader->updateLayout();
}
}
示例4: drawGradient
void GradientLayer::drawGradient(Graphics* const TheGraphics, const Pnt2f& Origin, const Vec2f& Size, const Vec2f& UAxis, const Real32& Start, const Real32& End, const Real32& Opacity) const
{
glPushMatrix();
Matrix Transformation;
Transformation.setTransform(Vec3f(Origin.x()+Start*UAxis.x()*Size.x(), Origin.y()+Start*UAxis.y()*Size.x(),0.0f), Quaternion(Vec3f(1.0f,0.0f,0.0f),Vec3f(UAxis.x(), UAxis.y(), 0.0f)), Vec3f(Size.x()*(End-Start), Size.y(),0.0f));
glMultMatrixf(Transformation.getValues());
if (osgMin(getMFColors()->size(),getMFStops()->size()) > 1)
{
if(getMFColors()->size() != getMFStops()->size())
{
SWARNING << "GradientLayer::drawGradient: The number of colors and the number of stops are not equal." << std::endl;
}
UInt32 NumStops = osgMin(getMFColors()->size(),getMFStops()->size());
Real32 CurentRelaviteStop= 0.0f;
for(UInt32 i(0) ; i<NumStops-1 ; ++i)
{
TheGraphics->drawQuad(Pnt2f(getStops(i),0.0f),
Pnt2f(getStops(i+1),0.0f),
Pnt2f(getStops(i+1),1.0f),
Pnt2f(getStops(i),1.0f),
getColors(i),
getColors(i+1),
getColors(i+1),
getColors(i),
Opacity);
}
}
glPopMatrix();
}
示例5: handleColBorderMouseDragged
void TableHeader::handleColBorderMouseDragged(MouseEventDetails* const e)
{
if(e->getButton() == MouseEventDetails::BUTTON1)
{
Pnt2f MousePosInComponent = ViewportToComponent(e->getLocation(), this, e->getViewport());
TableColumnRefPtr TheColumn(getColumnModel()->getColumn(_ResizingColumn));
Real32 NewWidth(MousePosInComponent.x() - getColumnHeaders(_ResizingColumn)->getPosition().x());
if(NewWidth <= 0 || NewWidth < TheColumn->getMinWidth())
{
NewWidth = TheColumn->getMinWidth();
}
if(NewWidth > TheColumn->getMaxWidth())
{
NewWidth = TheColumn->getMaxWidth();
}
//Get the new desired center for this margin
TheColumn->setWidth(NewWidth);
updateLayout();
}
}
示例6: getBounds
void PolygonUIDrawObject::getBounds(Pnt2f& TopLeft, Pnt2f& BottomRight) const
{
if(getMFVerticies()->size() > 0)
{
TopLeft = getVerticies(0);
BottomRight = TopLeft;
//Determine Top Left And Bottom Right
for(UInt32 i(0) ; i<getMFVerticies()->size(); ++i)
{
TopLeft.setValues( osgMin(TopLeft.x(), getVerticies(i).x()),
osgMin(TopLeft.y(), getVerticies(i).y()) );
BottomRight.setValues(osgMax<Real32>(BottomRight.x(), getVerticies(i).x()),
osgMax<Real32>(BottomRight.y(), getVerticies(i).y()) );
}
}
}
示例7: maximizeVisibility
void UIViewport::maximizeVisibility(const Pnt2f& TopLeft, const Pnt2f& BottomRight)
{
//Scroll as little as possible until as much as can be is visible
Pnt2f ViewTopLeft, ViewBottomRight;
getViewBounds(ViewTopLeft,ViewBottomRight);
Pnt2f NewViewPosition(getViewPosition());
//Vertical
if(ViewTopLeft.y() > TopLeft.y())
{
//Scroll up
NewViewPosition[1] = TopLeft.y();
}
else if(ViewBottomRight.y() < BottomRight.y())
{
Pnt2f InsetsTopLeft, InsetsBottomRight;
getInsideInsetsBounds(InsetsTopLeft, InsetsBottomRight);
//Scroll down
NewViewPosition[1] = BottomRight.y() - (InsetsBottomRight - InsetsTopLeft).y();
}
//Horizontal
if(ViewTopLeft.x() > TopLeft.x())
{
//Scroll left
NewViewPosition[0] = TopLeft.x();
}
else if(ViewBottomRight.x() < BottomRight.x())
{
Pnt2f InsetsTopLeft, InsetsBottomRight;
getInsideInsetsBounds(InsetsTopLeft, InsetsBottomRight);
//Scroll right
NewViewPosition[0] = BottomRight.x() - (InsetsBottomRight - InsetsTopLeft).x();
}
setViewPosition(NewViewPosition);
}
示例8: updateCursor
void WindowEventProducer::updateCursor(Pnt2f MousePos)
{
CursorRegionListItor ListItor;
bool CursorChanged(false);
for(ListItor = _CursorRegions.begin() ; ListItor != _CursorRegions.end() ; ++ListItor)
{
if(MousePos.x() >= ListItor->_TopLeft.x() &&
MousePos.y() >= ListItor->_TopLeft.y() &&
MousePos.x() <= ListItor->_BottomRight.x() &&
MousePos.y() <= ListItor->_TopLeft.y())
{
setCursorType(ListItor->_CursorType);
CursorChanged = true;
}
}
if(!CursorChanged)
{
setCursorType(CURSOR_POINTER);
}
}
示例9: getInsideBorderBounds
void Component::getInsideBorderBounds(Pnt2f& TopLeft, Pnt2f& BottomRight) const
{
Real32 TopInset(0), LeftInset(0), BottomInset(0), RightInset(0);
if(getBorder() != NULL)
{
//Get Border Insets
getBorder()->getInsets(LeftInset,RightInset,TopInset,BottomInset);
}
TopLeft.setValues(LeftInset, TopInset);
BottomRight.setValues(TopLeft.x()+getSize().x()-(LeftInset + RightInset), TopLeft.y()+getSize().y()-(TopInset + BottomInset));
}
示例10: columnAtPoint
TableColumnRefPtr TableHeader::columnAtPoint(const Pnt2f& point) const
{
Int32 ColumnIndex = getColumnModel()->getColumnIndexAtX(point.x());
if(ColumnIndex == -1)
{
return NULL;
}
else
{
return getColumnModel()->getColumn(ColumnIndex);
}
}
示例11: drawBraceHighlight
void TextDomArea::drawBraceHighlight(Graphics * const TheGraphics, Real32 Opacity) const
{
if(getLayoutManager()->getBracesHighlightFlag())
{
if(getLayoutManager()->getStartingBraceLine() != -1 && getLayoutManager()->getStartingBraceIndex() != -1)
{
Pnt2f thePosition = getLayoutManager()->getXYPosition(getLayoutManager()->getStartingBraceLine(),getLayoutManager()->getStartingBraceIndex(),true);
TheGraphics->drawRect(thePosition,Pnt2f(thePosition.x()+5,thePosition.y()+getLayoutManager()->getHeightOfLine()),Color4f(0.7,0.7,0.0,1.0),Opacity);
}
if(getLayoutManager()->getEndingBraceLine() != -1 && getLayoutManager()->getEndingBraceIndex() != -1)
{
if(getLayoutManager()->getEndingBraceLine()<getLayoutManager()->getRootElement()->getElementCount())
{
PlainDocumentLeafElementRefPtr temp = dynamic_cast<PlainDocumentLeafElement*>(getLayoutManager()->getRootElement()->getElement(getLayoutManager()->getEndingBraceLine()));
if(getLayoutManager()->getEndingBraceIndex() < temp->getTextLength())
{
Pnt2f thePosition = getLayoutManager()->getXYPosition(getLayoutManager()->getEndingBraceLine(),getLayoutManager()->getEndingBraceIndex(),true);
TheGraphics->drawRect(thePosition,Pnt2f(thePosition.x()+5,thePosition.y()+getLayoutManager()->getHeightOfLine()),Color4f(0.7,0.7,0.0,1.0),Opacity);
}
}
}
}
}
示例12: drawPad
void GradientLayer::drawPad(Graphics* const TheGraphics, const Pnt2f& Origin, const Vec2f& Size, const Vec2f& UAxis, const Real32& Start, const Real32& End, const Color4f Color, const Real32& Opacity) const
{
glPushMatrix();
Matrix Transformation;
Transformation.setTransform(Vec3f(Origin.x()+Start*UAxis.x()*Size.x(), Origin.y()+Start*UAxis.y()*Size.x(),0.0f), Quaternion(Vec3f(1.0f,0.0f,0.0f),Vec3f(UAxis.x(), UAxis.y(), 0.0f)), Vec3f(Size.x()*(End-Start), Size.y(),0.0f));
glMultMatrixf(Transformation.getValues());
TheGraphics->drawRect(Pnt2f(0.0,0.0f),
Pnt2f(1.0,1.0f),
Color,
Opacity);
glPopMatrix();
}
示例13: LineStart
void Graphics3DExtrude::drawTextUnderline(const Pnt2f& Position, const std::string& Text, const UIFontUnrecPtr TheFont, const Color4f& Color, const Real32& Opacity) const
{
Pnt2f TextTopLeft, TextBottomRight;
TheFont->getBounds(Text, TextTopLeft, TextBottomRight);
Pnt2f CharacterTopLeft, CharacterBottomRight;
TheFont->getBounds("A", CharacterTopLeft, CharacterBottomRight);
//Line Start Point
Pnt2f LineStart(Position.x() + TextTopLeft.x(), Position.y() + CharacterBottomRight.y()-1);
//Line End Point
Pnt2f LineEnd(LineStart + Vec2f(TextBottomRight.x()-TextTopLeft.x(),1));
drawRect(LineStart, LineEnd, Color, Opacity);
}
示例14: windowToViewport
ViewportUnrecPtr WindowEventProducer::windowToViewport(const Pnt2f& WindowPoint, Pnt2f& ViewportPoint)
{
ViewportUnrecPtr ThePort;
for(UInt32 i(0) ; i<getMFPort()->size() ; ++i)
{
ThePort = getPort(i);
if(ThePort->getEnabled())
{
ViewportPoint.setValues(WindowPoint.x() - ThePort->getPixelLeft(), WindowPoint.y() - ThePort->getPixelBottom());
return ThePort;
}
}
return NULL;
}
示例15: viewportToRenderingSurface
bool UIRectangleMouseTransformFunctor::viewportToRenderingSurface(const Pnt2f& ViewportPoint,
const Viewport* TheViewport,
Pnt2f& Result) const
{
//Get Viewport to View Space line
Line l;
if( !TheViewport->getCamera()->calcViewRay( l, ViewportPoint.x(), ViewportPoint.y(), *TheViewport ) )
{
return false;
}
//Transform Line to UIRectangle Space
Matrix m ;
getParent()->accumulateMatrix(m);
m.invert();
Pnt3f pos;
Vec3f dir;
m.multFull(l.getPosition (), pos);
m.mult (l.getDirection(), dir);
l.setValue(pos, dir);
//ia->scale(dir.length());
//Intersect the Line with the UIRectangle quad
Real32 t;
if(!intersectLineRect(l,getParent()->getPoint(),
getParent()->getPoint() + Vec3f(getParent()->getWidth(),0,0),
getParent()->getPoint() + Vec3f(getParent()->getWidth(),getParent()->getHeight(),0),
getParent()->getPoint() + Vec3f(0,getParent()->getHeight(),0)
,t))
{
return false;
}
//Return the point on the quad of the intersection if there was one
Result.setValues(l.getPosition().x() + t*l.getDirection().x() - getParent()->getPoint().x(),
getParent()->getHeight() - l.getPosition().y() - t*l.getDirection().y() + getParent()->getPoint().y());
return true;
}