.TH "SbViewportRegion" 3 "Sat Oct 12 2013" "Version 4.0.0a" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SbViewportRegion \- .PP The \fBSbViewportRegion\fP class is a viewport within a full window\&. .PP The \fBSbViewportRegion\fP class contains information to represent a subview within a window\&. It stores information about the origin and size of the subview, aswell as the size of the underlying 'full' window\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBSbViewportRegion\fP (void)" .br .ti -1c .RI "\fBSbViewportRegion\fP (short width, short height)" .br .ti -1c .RI "\fBSbViewportRegion\fP (\fBSbVec2s\fP winSize)" .br .ti -1c .RI "\fBSbViewportRegion\fP (const \fBSbViewportRegion\fP &vpReg)" .br .ti -1c .RI "void \fBsetWindowSize\fP (short width, short height)" .br .ti -1c .RI "void \fBsetWindowSize\fP (\fBSbVec2s\fP winSize)" .br .ti -1c .RI "void \fBsetViewport\fP (float left, float bottom, float width, float height)" .br .ti -1c .RI "void \fBsetViewport\fP (\fBSbVec2f\fP origin, \fBSbVec2f\fP size)" .br .ti -1c .RI "void \fBsetViewportPixels\fP (short left, short bottom, short width, short height)" .br .ti -1c .RI "void \fBsetViewportPixels\fP (\fBSbVec2s\fP origin, \fBSbVec2s\fP size)" .br .ti -1c .RI "const \fBSbVec2s\fP & \fBgetWindowSize\fP (void) const " .br .ti -1c .RI "const \fBSbVec2f\fP & \fBgetViewportOrigin\fP (void) const " .br .ti -1c .RI "const \fBSbVec2s\fP & \fBgetViewportOriginPixels\fP (void) const " .br .ti -1c .RI "const \fBSbVec2f\fP & \fBgetViewportSize\fP (void) const " .br .ti -1c .RI "const \fBSbVec2s\fP & \fBgetViewportSizePixels\fP (void) const " .br .ti -1c .RI "float \fBgetViewportAspectRatio\fP (void) const " .br .ti -1c .RI "void \fBscaleWidth\fP (float ratio)" .br .ti -1c .RI "void \fBscaleHeight\fP (float ratio)" .br .ti -1c .RI "void \fBsetPixelsPerInch\fP (float ppi)" .br .ti -1c .RI "float \fBgetPixelsPerInch\fP (void) const " .br .ti -1c .RI "float \fBgetPixelsPerPoint\fP (void) const " .br .ti -1c .RI "void \fBprint\fP (FILE *file) const " .br .in -1c .SS "Friends" .in +1c .ti -1c .RI "int \fBoperator==\fP (const \fBSbViewportRegion\fP ®1, const \fBSbViewportRegion\fP ®2)" .br .ti -1c .RI "int \fBoperator!=\fP (const \fBSbViewportRegion\fP ®1, const \fBSbViewportRegion\fP ®2)" .br .in -1c .SH "Detailed Description" .PP The \fBSbViewportRegion\fP class is a viewport within a full window\&. .PP The \fBSbViewportRegion\fP class contains information to represent a subview within a window\&. It stores information about the origin and size of the subview, aswell as the size of the underlying 'full' window\&. Available methods include inquiries and manipulation in both normalized coordinates and pixel coordinates\&. .PP Below is a small example showing how the viewport of a viewer class can be modified, within a 'proper' Coin and window system context\&. Hit 'D' or 'U' to move the viewport region 40 pixels down or up, respectively\&. Click 'Esc' and zoom with left + middle mouse buttons, to see how the region is defined, where no 3D geometry will be visible outside it\&. Click 'Esc' again to use 'U' and 'D'\&. .PP .PP .nf // Copyright (C) by Kongsberg Oil & Gas Technologies\&. All rights reserved\&. #include #include #include #include #include #include // ************************************************************ static void keypresscbfunc(void * userdata, SoEventCallback * keyboardcb) { SoQtExaminerViewer * viewer = (SoQtExaminerViewer *)userdata; const SoEvent * event = keyboardcb->getEvent(); int shift = 0; if (SO_KEY_PRESS_EVENT(event, U)) { shift = 40; keyboardcb->setHandled(); } else if (SO_KEY_PRESS_EVENT(event, D)) { shift = -40; keyboardcb->setHandled(); } if (keyboardcb->isHandled()) { SbViewportRegion vpr = viewer->getViewportRegion(); SbVec2s size = vpr\&.getViewportSizePixels(); SbVec2s origin = vpr\&.getViewportOriginPixels(); origin[1] -= shift; vpr\&.setViewportPixels(origin, size); viewer->setViewportRegion(vpr); } } // ************************************************************ int main(int argc, char ** argv) { QWidget * window = SoQt::init(argv[0]); SoSeparator * root = new SoSeparator; root->ref(); root->addChild(new SoCone); SoQtExaminerViewer * viewer = new SoQtExaminerViewer(window); SoEventCallback * eventcb = new SoEventCallback; eventcb->addEventCallback(SoKeyboardEvent::getClassTypeId(), keypresscbfunc, viewer); root->insertChild(eventcb, 0); viewer->setViewing(FALSE); viewer->setDecoration(FALSE); viewer->setSceneGraph(root); viewer->show(); SoQt::show(window); SoQt::mainLoop(); delete viewer; root->unref(); return 0; } .fi .PP .PP \fBSee Also:\fP .RS 4 \fBSbViewVolume\fP .RE .PP .SH "Constructor & Destructor Documentation" .PP .SS "SbViewportRegion::SbViewportRegion (void)" The default \fBSbViewportRegion\fP constructor initializes the viewport to fully cover a [100, 100] size window with 72 pixels per inch resolution\&. .SS "SbViewportRegion::SbViewportRegion (shortwidth, shortheight)" Construct and initialize an \fBSbViewportRegion\fP instance with the given pixel value window dimensions\&. The viewport within this window will be set to cover the window completely\&. .SS "SbViewportRegion::SbViewportRegion (\fBSbVec2s\fPwinsizearg)" Construct and initialize an \fBSbViewportRegion\fP instance with the given pixel value window dimensions\&. The viewport within this window will be set to cover the window completely\&. .SS "SbViewportRegion::SbViewportRegion (const \fBSbViewportRegion\fP &vpReg)" Copy constructor\&. .SH "Member Function Documentation" .PP .SS "void SbViewportRegion::setWindowSize (shortwidth, shortheight)" Set the window size in pixels\&. The viewport rectangle dimensions will stay intact\&. .PP \fBSee Also:\fP .RS 4 \fBgetWindowSize()\fP .RE .PP .SS "void SbViewportRegion::setWindowSize (\fBSbVec2s\fPwinsizearg)" This is an overloaded member function, provided for convenience\&. It differs from the above function only in what argument(s) it accepts\&. .SS "void SbViewportRegion::setViewport (floatleft, floatbottom, floatwidth, floatheight)" Set up the origin and size of the viewport region in normalized coordinates\&. .PP \fBSee Also:\fP .RS 4 \fBgetViewportOrigin()\fP, \fBgetViewportSize()\fP, \fBsetViewportPixels()\fP\&. .RE .PP .SS "void SbViewportRegion::setViewport (\fBSbVec2f\fPorigin, \fBSbVec2f\fPsize)" This is an overloaded member function, provided for convenience\&. It differs from the above function only in what argument(s) it accepts\&. .SS "void SbViewportRegion::setViewportPixels (shortleft, shortbottom, shortwidth, shortheight)" Set up the origin and size of the viewport region in pixel coordinates\&. .PP \fBSee Also:\fP .RS 4 \fBgetViewportOriginPixels()\fP, \fBgetViewportSizePixels()\fP, \fBsetViewport()\fP .RE .PP .SS "void SbViewportRegion::setViewportPixels (\fBSbVec2s\fPorigin, \fBSbVec2s\fPsize)" This is an overloaded member function, provided for convenience\&. It differs from the above function only in what argument(s) it accepts\&. .SS "const \fBSbVec2s\fP & SbViewportRegion::getWindowSize (void) const" Returns window dimensions (which are in absolute (i\&.e\&. pixel) coordinates)\&. .PP \fBSee Also:\fP .RS 4 \fBsetWindowSize()\fP\&. .RE .PP .SS "const \fBSbVec2f\fP & SbViewportRegion::getViewportOrigin (void) const" Return normalized viewport origin coordinates\&. .PP \fBSee Also:\fP .RS 4 \fBsetViewport()\fP, \fBgetViewportOriginPixels()\fP\&. .RE .PP .SS "const \fBSbVec2s\fP & SbViewportRegion::getViewportOriginPixels (void) const" Return viewport origin coordinates in pixel values\&. .PP \fBSee Also:\fP .RS 4 \fBsetViewportPixels()\fP, \fBgetViewportOrigin()\fP\&. .RE .PP .SS "const \fBSbVec2f\fP & SbViewportRegion::getViewportSize (void) const" Returns the normalized viewport size\&. .PP \fBSee Also:\fP .RS 4 \fBsetViewport()\fP, \fBgetViewportSizePixels()\fP\&. .RE .PP .SS "const \fBSbVec2s\fP & SbViewportRegion::getViewportSizePixels (void) const" Returns viewport size in pixel coordinates\&. .PP \fBSee Also:\fP .RS 4 \fBsetViewportPixels()\fP, \fBgetViewportSize()\fP\&. .RE .PP .SS "float SbViewportRegion::getViewportAspectRatio (void) const" Returns the aspect ratio of the viewport region\&. The aspect ratio is calculated as pixelwidth divided on pixelheight\&. .SS "void SbViewportRegion::scaleWidth (floatratio)" Scale the width of the viewport region\&. .PP The scale factor should not make the viewport larger than the window\&. If this happens, the viewport will be clamped\&. .PP The scaling will be done around the viewport region center point, but if this causes the viewport origin to be moved below (0,0), the origin coordinates will be clamped\&. .PP \fBSee Also:\fP .RS 4 \fBscaleHeight()\fP\&. .RE .PP .SS "void SbViewportRegion::scaleHeight (floatratio)" Scale the height of the viewport region\&. .PP The scale factor should not make the viewport larger than the window\&. If this happens, the viewport will be clamped\&. .PP The scaling will be done around the viewport region center point, but if this causes the viewport origin to be moved below (0,0), the origin coordinates will be clamped\&. .PP \fBSee Also:\fP .RS 4 \fBscaleWidth()\fP\&. .RE .PP .SS "void SbViewportRegion::setPixelsPerInch (floatppi)" Set pixels per inch\&. Default value is 72\&. .PP \fBSee Also:\fP .RS 4 \fBgetPixelsPerInch()\fP\&. .RE .PP .SS "float SbViewportRegion::getPixelsPerInch (void) const" Get pixels per inch\&. .PP \fBSee Also:\fP .RS 4 \fBsetPixelsPerInch()\fP\&. .RE .PP .SS "float SbViewportRegion::getPixelsPerPoint (void) const" Get pixels per point\&. A \fIpoint\fP is defined as something you can put 72 of per inch\&.\&.\&. .PP \fBSee Also:\fP .RS 4 \fBsetPixelsPerInch()\fP, \fBgetPixelsPerInch()\fP\&. .RE .PP .SS "void SbViewportRegion::print (FILE *fp) const" Dump the state of this object to the \fIfile\fP stream\&. Only works in debug version of library, method does nothing in an optimized compile\&. .SH "Friends And Related Function Documentation" .PP .SS "int operator== (const \fBSbViewportRegion\fP ®1, const \fBSbViewportRegion\fP ®2)\fC [friend]\fP" Compares two \fBSbViewportRegion\fP instances for equality\&. .SS "int operator!= (const \fBSbViewportRegion\fP ®1, const \fBSbViewportRegion\fP ®2)\fC [friend]\fP" Compares two \fBSbViewportRegion\fP instances for inequality\&. .PP \fBSince:\fP .RS 4 Coin 2\&.4 .RE .PP .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.