当前位置: 首页>>代码示例>>C++>>正文


C++ Pnt2f::setValues方法代码示例

本文整理汇总了C++中Pnt2f::setValues方法的典型用法代码示例。如果您正苦于以下问题:C++ Pnt2f::setValues方法的具体用法?C++ Pnt2f::setValues怎么用?C++ Pnt2f::setValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pnt2f的用法示例。


在下文中一共展示了Pnt2f::setValues方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BottomRight

void InternalWindow::BorderDraggedListener::mouseDragged(const MouseEventUnrecPtr e)
{
    Vec2f Size;
    bool PositionChange;
    Pnt2f Position;
    Pnt2f BottomRight(_InternalWindow->getPosition() + _InternalWindow->getSize());
    switch(_BorderDragged)
    {
        case WINDOW_LEFT_BORDER:
            Size.setValues(BottomRight.x() - e->getLocation().x(), _InternalWindow->getPreferredSize().y());
            PositionChange = true;
            Position = BottomRight - Size;
            break;
        case WINDOW_RIGHT_BORDER:
            PositionChange = false;
            Size.setValues(e->getLocation().x() - _InternalWindow->getPosition().x(), _InternalWindow->getPreferredSize().y());
            break;
        case WINDOW_TOP_BORDER:
            Size.setValues(_InternalWindow->getPreferredSize().x(), BottomRight.y() - e->getLocation().y());
            PositionChange = true;
            Position = BottomRight - Size;
            break;
        case WINDOW_BOTTOM_BORDER:
            PositionChange = false;
            Size.setValues(_InternalWindow->getPreferredSize().x(), e->getLocation().y() - _InternalWindow->getPosition().y());
            break;
        case WINDOW_TOP_LEFT_BORDER:
            Size.setValues(BottomRight.x() - e->getLocation().x(), BottomRight.y() - e->getLocation().y());
            PositionChange = true;
            Position = BottomRight - Size;
            break;
        case WINDOW_BOTTOM_RIGHT_BORDER:
            PositionChange = false;
            Size.setValues(e->getLocation().x() - _InternalWindow->getPosition().x(), e->getLocation().y() - _InternalWindow->getPosition().y());
            break;
        case WINDOW_TOP_RIGHT_BORDER:
            Size.setValues(e->getLocation().x() - _InternalWindow->getPosition().x(), BottomRight.y() - e->getLocation().y());
            PositionChange = true;
            Position.setValues(_InternalWindow->getPosition().x(), BottomRight.y() - Size.y());
            break;
        case WINDOW_BOTTOM_LEFT_BORDER:
            Size.setValues(BottomRight.x() - e->getLocation().x(), e->getLocation().y() - _InternalWindow->getPosition().y());
            PositionChange = true;
            Position.setValues( BottomRight.x() - Size.x(), _InternalWindow->getPosition().y());
            break;
    }

    if(PositionChange)
    {
        _InternalWindow->setPreferredSize(Size);
        _InternalWindow->setPosition(Position);
    }
    else
    {
        _InternalWindow->setPreferredSize(Size);
    }
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:57,代码来源:OSGInternalWindow.cpp

示例2: getBounds

void TexturedQuadUIDrawObject::getBounds(Pnt2f& TopLeft, Pnt2f& BottomRight) const
{
   TopLeft.setValues(
       osgMin(osgMin(osgMin(getPoint1().x(), getPoint2().x()),getPoint3().x()),getPoint4().x()),
       osgMin(osgMin(osgMin(getPoint1().y(), getPoint2().y()),getPoint3().y()),getPoint4().y()));
   
   BottomRight.setValues(
       osgMax(osgMax(osgMax(getPoint1().x(), getPoint2().x()),getPoint3().x()),getPoint4().x()),
       osgMax(osgMax(osgMax(getPoint1().y(), getPoint2().y()),getPoint3().y()),getPoint4().y()));
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:10,代码来源:OSGTexturedQuadUIDrawObject.cpp

示例3: 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));
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:12,代码来源:OSGComponent.cpp

示例4: getTitlebarBounds

void InternalWindow::getTitlebarBounds(Pnt2f& TopLeft, Pnt2f& BottomRight) const
{
    if(getDrawDecorations() && getDrawTitlebar() && getDrawnBorder()->getType().isDerivedFrom(WindowBorder::getClassType()))
    {
        dynamic_pointer_cast<WindowBorder>(getDrawnBorder())->getTitlebarBounds(0, 0, getSize().x(), getSize().y(), TopLeft, BottomRight);
    }
    else
    {
        TopLeft.setValues(0,0);
        BottomRight.setValues(0,0);
    }
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:12,代码来源:OSGInternalWindow.cpp

示例5: getTitlebarBounds

void WindowBorder::getTitlebarBounds(const Real32 x, const Real32 y , const Real32 Width, const Real32 Height, Pnt2f& TopLeft, Pnt2f& BottomRight)
{
    Real32 LeftIn(0.0f), RightIn(0.0f), BottomIn(0.0f), UpperIn(0.0f);
    if(getOuterBorder() != NULL)
    {
        getOuterBorder()->getInsets(LeftIn, RightIn, UpperIn, BottomIn);
    }

    TopLeft.setValues(x+LeftIn, y+UpperIn);
    if(getTitlebar() != NULL)
    {
        UpperIn += getTitlebar()->getSize().y();
    }

    BottomRight.setValues(x+Width-RightIn, y+UpperIn);
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:16,代码来源:OSGWindowBorder.cpp

示例6: draw

void GlassLayer::draw(Graphics* const TheGraphics, const Pnt2f& TopLeft, const Pnt2f& BottomRight, const Real32 Opacity) const
{
    Pnt2f IntermediatePosition;
    Vec3f Bounds(BottomRight- TopLeft);
    
    //Setup the Blending equations properly
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_BLEND);

    glBegin(GL_TRIANGLE_FAN);
        glColor4f(getEdgeColor().red(),getEdgeColor().green(),getEdgeColor().blue(),getEdgeColor().alpha() * Opacity);
        glVertex2f(getStartPosition().x(), getEndPosition().y());
        glColor4f(getCenterColor().red(),getCenterColor().green(),getCenterColor().blue(),getCenterColor().alpha() * Opacity);
        glVertex2fv(getStartPosition().getValues());
        for(UInt32 i(0) ; i<_Segments.size(); ++i)
        {
            IntermediatePosition.setValues(_Segments[i].x() * Bounds.x(),_Segments[i].y() * Bounds.y());
            glVertex2fv(IntermediatePosition.getValues());
        }
        glVertex2fv(getEndPosition().getValues());
    glEnd();

    glDisable(GL_BLEND);

}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:25,代码来源:OSGGlassLayer.cpp

示例7: getViewBounds

void UIViewport::getViewBounds(Pnt2f& TopLeft, Pnt2f& BottomRight)
{
    Pnt2f InsetsTopLeft, InsetsBottomRight;
    getInsideInsetsBounds(InsetsTopLeft, InsetsBottomRight);

    TopLeft.setValues(getViewPosition().x(),getViewPosition().y());
    BottomRight = TopLeft + (InsetsBottomRight - InsetsTopLeft);
}
开发者ID:msteners,项目名称:OpenSGToolbox,代码行数:8,代码来源:OSGUIViewport.cpp

示例8: 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()) );
        }
    }
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:17,代码来源:OSGPolygonUIDrawObject.cpp

示例9: 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;
}
开发者ID:ahuballah,项目名称:OpenSGToolbox,代码行数:16,代码来源:OSGWindowEventProducer.cpp

示例10: getBounds

void UIFont::getBounds(const std::string& Text, Pnt2f& TopLeft, Pnt2f& BottomRight)
{
    TextLayoutParam layoutParam;
    layoutParam.spacing = 1.1;
    layoutParam.majorAlignment = TextLayoutParam::ALIGN_BEGIN;
    layoutParam.minorAlignment = TextLayoutParam::ALIGN_BEGIN;

    TextLayoutResult layoutResult;
    layout(Text, layoutParam, layoutResult);

    //Vec2f BottomLeft, TopRight;
    Vec2f size = Vec2f(layoutResult.textBounds.x()*getSize(),layoutResult.textBounds.y()*getSize());
    // _face->calculateBoundingBox(layoutResult,BottomLeft, TopRight);

    TopLeft.setValues(0, 0);
    BottomRight.setValue(size);
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:17,代码来源:OSGUIFont.cpp

示例11: 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;
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:42,代码来源:OSGUIRectangleMouseTransformFunctor.cpp

示例12: adjustVolume

	/// \brief Adjust the Volume of this DynamicTerrain Node (for culling!)
	void DynamicTerrain::adjustVolume( Volume & volume )
	{   
		volume.setValid();
		volume.setEmpty();

		const Pnt2f& worldOffset = getWorldOffset();
		const Pnt2f& worldSize = getWorldSize();
		Pnt2f worldMax;

		worldMax.setValues ( worldOffset[0] + worldSize[0],
							 worldOffset[1] + worldSize[1] );

		const float heightScale = getHeightDataScale();
		const float heightOffset = getHeightDataOffset();

		const float minHeight = heightScale * imageHeightSource_.getMinHeight() + heightOffset;
		const float maxHeight = heightScale * imageHeightSource_.getMaxHeight() + heightOffset;

		volume.extendBy( Pnt3f( worldOffset[ 0 ], minHeight, worldOffset[ 1 ] ) );
		volume.extendBy( Pnt3f( worldMax[ 0 ], maxHeight, worldMax[ 1 ] ) );
	}
开发者ID:chengzg,项目名称:OSGAddOnsGV,代码行数:22,代码来源:OSGDynamicTerrain.cpp

示例13: draw

void GradientLayer::draw(Graphics* const TheGraphics, const Pnt2f& TopLeft, const Pnt2f& BottomRight, const Real32 Opacity) const
{
	if(getMFColors()->size() == getMFStops()->size())
	{
		if(getMFColors()->size() == 1)
		{
			TheGraphics->drawQuad(TopLeft, Pnt2f(BottomRight.x(), TopLeft.y()), BottomRight, Pnt2f(TopLeft.x(), BottomRight.y()), getColors(0), getColors(0), getColors(0), getColors(0), Opacity);
		}
		else
		{
			Pnt2f StartPosition= TopLeft;
			StartPosition[0] += getStartPosition()[0]*(BottomRight[0] - TopLeft[0]);
			StartPosition[1] += getStartPosition()[1]*(BottomRight[1] - TopLeft[1]);
			Pnt2f EndPosition= TopLeft;
			EndPosition[0] += getEndPosition()[0]*(BottomRight[0] - TopLeft[0]);
			EndPosition[1] += getEndPosition()[1]*(BottomRight[1] - TopLeft[1]);
			
			//Calculate the coordinate system
			Vec2f u(EndPosition-StartPosition);
			u.normalize();
			Vec3f v3D(Vec3f(u.x(), u.y(), 0.0f).cross(Vec3f(0.0,0.0,-1.0)));
			Vec2f v(v3D.x(), v3D.y());
			Matrix22<Real32> CoordinateSystem(u.x(), u.y(), v.x(), v.y());

			Pnt2f Min;
			Pnt2f Max;
			{
				//Calculate the bounding box in the new coordinate system
				Pnt2f UVTopLeft(CoordinateSystem*TopLeft), 
					UVBottomRight(CoordinateSystem*BottomRight), 
					UVTopRight(CoordinateSystem*Vec2f(BottomRight.x(), TopLeft.y())),
					UVBottomLeft(CoordinateSystem*Vec2f(TopLeft.x(), BottomRight.y()));


				Min.setValues( osgMin(UVTopLeft.x(), osgMin(UVBottomRight.x(), osgMin(UVTopRight.x(), UVBottomLeft.x()))),
							   osgMin(UVTopLeft.y(), osgMin(UVBottomRight.y(), osgMin(UVTopRight.y(), UVBottomLeft.y()))));
				Max.setValues( osgMax(UVTopLeft.x(), osgMax(UVBottomRight.x(), osgMax(UVTopRight.x(), UVBottomLeft.x()))),
							   osgMax(UVTopLeft.y(), osgMax(UVBottomRight.y(), osgMax(UVTopRight.y(), UVBottomLeft.y()))));
			}

			Pnt2f Origin(CoordinateSystem.inverse() * Min);
			Real32 PreStartLength(((CoordinateSystem*StartPosition).x()-Min.x())/(Max.x() - Min.x())),
				   PostEndLength((Max.x()- (CoordinateSystem*EndPosition).x())/(Max.x() - Min.x())),
				   GradientLength(1.0f-PostEndLength-PreStartLength);
			
			if(getSpreadMethod() == SPREAD_REFLECT||
			   getSpreadMethod() == SPREAD_REPEAT)
			{
				//Code for drawing the Gradient with Repeating/Reflection
					//Determine the Number of Repeats
					UInt32 RepeatCount = static_cast<UInt32>(osgCeil(1.0f/GradientLength));

					//Determine the relative location in the gradient that the Start left is at
					Real32 StartGradientLocation = PreStartLength - GradientLength * osgCeil(PreStartLength/GradientLength);

					//Determine whether the start is a reflection or normal
					bool isReflection = getSpreadMethod() == SPREAD_REFLECT && static_cast<UInt32>(osgCeil(PreStartLength/GradientLength))%2==1;

					for(UInt32 i(0) ; i<RepeatCount ; ++i)
					{
						if(isReflection)
						{
							drawGradient(TheGraphics, Origin, Max-Min,u,StartGradientLocation+GradientLength*(i+1),StartGradientLocation+GradientLength*i,Opacity);					
						}
						else
						{
							drawGradient(TheGraphics, Origin, Max-Min,u,StartGradientLocation+GradientLength*i,StartGradientLocation+GradientLength*(i+1),Opacity);					
						}

						if(getSpreadMethod() == SPREAD_REFLECT)
						{
							isReflection = !isReflection;
						}
					}
				
			}
			else
			{
				//Code for drawing the Gradient with Padding
				
				//Front Pad
				if(PreStartLength != 0.0f)
				{
					drawPad(TheGraphics, Origin,
                            Max-Min,u,0.0,PreStartLength,getMFColors()->front(),Opacity);
				}
				
				drawGradient(TheGraphics, Origin, Max-Min,u,PreStartLength,PreStartLength+GradientLength,Opacity);
				
				//End Pad
				if(PostEndLength != 0.0f)
				{
					drawPad(TheGraphics, Origin, Max-Min,u,PreStartLength+GradientLength,1.0,getMFColors()->back(),Opacity);
				}
			}
		}
	}
}
开发者ID:ahuballah,项目名称:OpenSGToolbox,代码行数:98,代码来源:OSGGradientLayer.cpp


注:本文中的Pnt2f::setValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。