本文整理汇总了C++中CheckBoxControl类的典型用法代码示例。如果您正苦于以下问题:C++ CheckBoxControl类的具体用法?C++ CheckBoxControl怎么用?C++ CheckBoxControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CheckBoxControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createLayerItem
void
createLayerItem( Grid* grid, int gridRow, int layerIndex, int numLayers, TerrainLayer* layer, bool isActive )
{
// a checkbox to enable/disable the layer:
CheckBoxControl* enabled = new CheckBoxControl( layer->getVisible() );
enabled->addEventHandler( new LayerVisibleHandler(layer) );
grid->setControl( 0, gridRow, enabled );
// the layer name
LabelControl* name = new LabelControl( layer->getName() );
grid->setControl( 1, gridRow, name );
ImageLayer* imageLayer = dynamic_cast< ImageLayer* > (layer );
if (imageLayer)
{
// an opacity slider
HSliderControl* opacity = new HSliderControl( 0.0f, 1.0f, imageLayer->getOpacity() );
opacity->setWidth( 125 );
opacity->setHeight( 12 );
opacity->addEventHandler( new LayerOpacityHandler(imageLayer) );
grid->setControl( 2, gridRow, opacity );
}
// move buttons
if ( layerIndex < numLayers-1 && isActive )
{
LabelControl* upButton = new LabelControl( "UP", 14 );
upButton->setBackColor( .4,.4,.4,1 );
upButton->setActiveColor( .8,0,0,1 );
upButton->addEventHandler( new MoveLayerHandler( layer, layerIndex+1 ) );
grid->setControl( 3, gridRow, upButton );
}
if ( layerIndex > 0 && isActive)
{
LabelControl* upButton = new LabelControl( "DOWN", 14 );
upButton->setBackColor( .4,.4,.4,1 );
upButton->setActiveColor( .8,0,0,1 );
upButton->addEventHandler( new MoveLayerHandler( layer, layerIndex-1 ) );
grid->setControl( 4, gridRow, upButton );
}
// add/remove button:
LabelControl* addRemove = new LabelControl( isActive? "REMOVE" : "ADD", 14 );
addRemove->setHorizAlign( Control::ALIGN_CENTER );
addRemove->setBackColor( .4,.4,.4,1 );
addRemove->setActiveColor( .8,0,0,1 );
if ( isActive )
addRemove->addEventHandler( new RemoveLayerHandler(layer) );
else
addRemove->addEventHandler( new AddLayerHandler(layer) );
grid->setControl( 5, gridRow, addRemove );
}
示例2: OnOptimized
static void
OnOptimized(CheckBoxControl &control)
{
is_locked = !control.GetState();
protected_task_manager->TargetLock(target_point, is_locked);
RefreshCalculator();
}
示例3: OnUserLevel
static void
OnUserLevel(CheckBoxControl &control)
{
const bool expert = control.GetState();
CommonInterface::SetUISettings().dialog.expert = expert;
Profile::Set(ProfileKeys::UserLevel, expert);
tab_menu->UpdateLayout();
}
示例4: OnUserLevel
static void
OnUserLevel(CheckBoxControl &control)
{
const bool expert = control.GetState();
CommonInterface::SetUISettings().dialog.expert = expert;
Profile::Set(szProfileUserLevel, expert);
wf->FilterAdvanced(expert);
wTabMenu->UpdateLayout();
}
示例5: createModelLayerItem
void
createModelLayerItem( Grid* grid, int gridRow, ModelLayer* layer, bool isActive )
{
// a checkbox to enable/disable the layer:
CheckBoxControl* enabled = new CheckBoxControl( layer->getVisible() );
enabled->addEventHandler( new ModelLayerVisibleHandler(layer) );
grid->setControl( 0, gridRow, enabled );
// the layer name
LabelControl* name = new LabelControl( layer->getName() );
grid->setControl( 1, gridRow, name );
// an opacity slider
HSliderControl* opacity = new HSliderControl( 0.0f, 1.0f, layer->getOpacity() );
opacity->setWidth( 125 );
opacity->setHeight( 12 );
opacity->addEventHandler( new ModelLayerOpacityHandler(layer) );
grid->setControl( 2, gridRow, opacity );
}
示例6: OnUserLevel
static void
OnUserLevel(CheckBoxControl &control)
{
const bool expert = control.GetState();
CommonInterface::SetUISettings().dialog.expert = expert;
Profile::Set(ProfileKeys::UserLevel, expert);
/* force layout update */
pager->PagerWidget::Move(pager->GetPosition());
}
示例7: OnNorthUp
static void
OnNorthUp(CheckBoxControl &control)
{
wdf->SetNorthUp(control.get_checked());
}
示例8: OnAutoZoom
static void
OnAutoZoom(CheckBoxControl &control)
{
wdf->SetAutoZoom(control.get_checked());
}
示例9: main
int
main(int argc, char** argv)
{
osg::Group* root = new osg::Group();
// try to load an earth file.
osg::ArgumentParser arguments(&argc,argv);
osgViewer::Viewer viewer(arguments);
viewer.setCameraManipulator( new EarthManipulator() );
// load an earth file and parse demo arguments
osg::Node* node = MapNodeHelper().load(arguments, &viewer);
if ( !node )
return usage(argv);
root->addChild( node );
// find the map node that we loaded.
MapNode* mapNode = MapNode::findMapNode(node);
if ( !mapNode )
return usage(argv);
// Group to hold all our annotation elements.
osg::Group* annoGroup = new osg::Group();
root->addChild( annoGroup );
//A group for all the editors
osg::Group* editorGroup = new osg::Group;
root->addChild( editorGroup );
editorGroup->setNodeMask( 0 );
HBox* box = ControlCanvas::getOrCreate(&viewer)->addControl( new HBox() );
box->setChildSpacing( 5 );
//Add a toggle button to toggle editing
CheckBoxControl* editCheckbox = new CheckBoxControl( false );
editCheckbox->addEventHandler( new ToggleNodeHandler( editorGroup ) );
box->addControl( editCheckbox );
LabelControl* labelControl = new LabelControl( "Edit Annotations" );
labelControl->setFontSize( 24.0f );
box->addControl( labelControl );
// Make a group for 2D items, and activate the decluttering engine. Decluttering
// will migitate overlap between elements that occupy the same screen real estate.
osg::Group* labelGroup = new osg::Group();
Decluttering::setEnabled( labelGroup->getOrCreateStateSet(), true );
annoGroup->addChild( labelGroup );
// Style our labels:
Style labelStyle;
labelStyle.getOrCreate<TextSymbol>()->alignment() = TextSymbol::ALIGN_CENTER_CENTER;
labelStyle.getOrCreate<TextSymbol>()->fill()->color() = Color::Yellow;
// A lat/long SRS for specifying points.
const SpatialReference* geoSRS = mapNode->getMapSRS()->getGeographicSRS();
//--------------------------------------------------------------------
// A series of place nodes (an icon with a text label)
{
Style pin;
pin.getOrCreate<IconSymbol>()->url()->setLiteral( "../data/placemark32.png" );
// bunch of pins:
labelGroup->addChild( new PlaceNode(mapNode, GeoPoint(geoSRS, -74.00, 40.71), "New York" , pin));
labelGroup->addChild( new PlaceNode(mapNode, GeoPoint(geoSRS, -77.04, 38.85), "Washington, DC", pin));
labelGroup->addChild( new PlaceNode(mapNode, GeoPoint(geoSRS,-118.40, 33.93), "Los Angeles" , pin));
labelGroup->addChild( new PlaceNode(mapNode, GeoPoint(geoSRS, -71.03, 42.37), "Boston" , pin));
labelGroup->addChild( new PlaceNode(mapNode, GeoPoint(geoSRS,-157.93, 21.35), "Honolulu" , pin));
labelGroup->addChild( new PlaceNode(mapNode, GeoPoint(geoSRS, 139.75, 35.68), "Tokyo" , pin));
labelGroup->addChild( new PlaceNode(mapNode, GeoPoint(geoSRS, -90.25, 29.98), "New Orleans" , pin));
labelGroup->addChild( new PlaceNode(mapNode, GeoPoint(geoSRS, -80.28, 25.82), "Miami" , pin));
labelGroup->addChild( new PlaceNode(mapNode, GeoPoint(geoSRS,-117.17, 32.72), "San Diego" , pin));
// test with an LOD:
osg::LOD* lod = new osg::LOD();
lod->addChild( new PlaceNode(mapNode, GeoPoint(geoSRS, 14.68, 50.0), "Prague", pin), 0.0, 1e6);
labelGroup->addChild( lod );
// absolute altitude:
labelGroup->addChild( new PlaceNode(mapNode, GeoPoint(geoSRS, -87.65, 41.90, 1000, ALTMODE_ABSOLUTE), "Chicago" , pin));
}
//--------------------------------------------------------------------
// a box that follows lines of latitude (rhumb line interpolation, the default)
{
Geometry* geom = new Polygon();
geom->push_back( osg::Vec3d(0, 40, 0) );
geom->push_back( osg::Vec3d(-60, 40, 0) );
geom->push_back( osg::Vec3d(-60, 60, 0) );
geom->push_back( osg::Vec3d(0, 60, 0) );
Style geomStyle;
geomStyle.getOrCreate<LineSymbol>()->stroke()->color() = Color::Cyan;
geomStyle.getOrCreate<LineSymbol>()->stroke()->width() = 5.0f;
geomStyle.getOrCreate<AltitudeSymbol>()->clamping() = AltitudeSymbol::CLAMP_TO_TERRAIN;
geomStyle.getOrCreate<AltitudeSymbol>()->technique() = AltitudeSymbol::TECHNIQUE_GPU;
FeatureNode* gnode = new FeatureNode(mapNode, new Feature(geom, geoSRS, geomStyle));
annoGroup->addChild( gnode );
//.........这里部分代码省略.........
示例10: main
int
main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc,argv);
osg::DisplaySettings::instance()->setMinimumNumStencilBits( 8 );
std::vector< std::string > imageFiles;
std::vector< Bounds > imageBounds;
//Read in the image files
std::string filename;
Bounds bounds;
while (arguments.read("--image", filename, bounds.xMin(), bounds.yMin(), bounds.xMax(), bounds.yMax()))
{
imageFiles.push_back( filename );
imageBounds.push_back( bounds );
}
if (imageFiles.empty())
{
imageFiles.push_back("../data/osgearth.gif");
imageBounds.push_back( Bounds(-100, 30, -90, 40) );
}
bool moveVert = arguments.read("--vert");
// load the .earth file from the command line.
osg::Node* earthNode = osgDB::readNodeFiles( arguments );
if (!earthNode)
return usage( "Unable to load earth model." );
osgViewer::Viewer viewer(arguments);
EarthManipulator* manip = new EarthManipulator();
viewer.setCameraManipulator( manip );
osg::Group* root = new osg::Group();
root->addChild( earthNode );
//Create the control panel
root->addChild( createControlPanel(&viewer) );
viewer.setSceneData( root );
osgEarth::MapNode* mapNode = osgEarth::MapNode::findMapNode( earthNode );
if ( mapNode )
{
for (unsigned int i = 0; i < imageFiles.size(); i++)
{
std::string imageFile = imageFiles[i];
//Read the image file and play it if it's a movie
osg::Image* image = osgDB::readImageFile(imageFile);
if (image)
{
osg::ImageStream* is = dynamic_cast<osg::ImageStream*>(image);
if (is)
{
is->play();
}
}
//Create a new ImageOverlay and set it's bounds
//ImageOverlay* overlay = new ImageOverlay(mapNode->getMap()->getProfile()->getSRS()->getEllipsoid(), image);
ImageOverlay* overlay = new ImageOverlay(mapNode);
overlay->setImage( image );
overlay->setBounds(imageBounds[i]);
root->addChild( overlay );
//Create a new ImageOverlayEditor and set it's node mask to 0 to hide it initially
#if OSG_MIN_VERSION_REQUIRED(2,9,6)
osg::Node* editor = new ImageOverlayEditor( overlay);
#else
//Just make an empty group for pre-2.9.6
osg::Node* editor = new osg::Group;
#endif
editor->setNodeMask( 0 );
root->addChild( editor );
// Add an image preview
ImageControl* imageCon = new ImageControl( image );
imageCon->setSize( 64, 64 );
imageCon->setVertAlign( Control::ALIGN_CENTER );
s_layerBox->setControl( 0, i, imageCon );
//Add some controls
CheckBoxControl* enabled = new CheckBoxControl( true );
enabled->addEventHandler( new EnabledHandler(overlay) );
enabled->setVertAlign( Control::ALIGN_CENTER );
s_layerBox->setControl( 1, i, enabled );
//The overlay name
LabelControl* name = new LabelControl( osgDB::getSimpleFileName( imageFile) );
name->setVertAlign( Control::ALIGN_CENTER );
s_layerBox->setControl( 2, i, name );
//.........这里部分代码省略.........
示例11: main
int
main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc,argv);
osg::DisplaySettings::instance()->setMinimumNumStencilBits( 8 );
osgViewer::Viewer viewer(arguments);
// load the .earth file from the command line.
osg::Node* earthNode = MapNodeHelper().load( arguments, &viewer );
if (!earthNode)
{
OE_NOTICE << "Unable to load earth model." << std::endl;
return 1;
}
MapNode* mapNode = MapNode::findMapNode( earthNode );
if ( !mapNode )
{
OE_NOTICE << "Input file was not a .earth file" << std::endl;
return 1;
}
earthNode->setNodeMask( 0x1 );
osgEarth::Util::EarthManipulator* earthManip = new EarthManipulator();
viewer.setCameraManipulator( earthManip );
osg::Group* root = new osg::Group();
root->addChild( earthNode );
//Create the MeasureToolHandler
MeasureToolHandler* measureTool = new MeasureToolHandler(root, mapNode);
measureTool->setIntersectionMask( 0x1 );
viewer.addEventHandler( measureTool );
//Create some controls to interact with the measuretool
ControlCanvas* canvas = new ControlCanvas( &viewer );
root->addChild( canvas );
canvas->setNodeMask( 0x1 << 1 );
Grid* grid = new Grid();
grid->setBackColor(0,0,0,0.5);
grid->setMargin( 10 );
grid->setPadding( 10 );
grid->setChildSpacing( 10 );
grid->setChildVertAlign( Control::ALIGN_CENTER );
grid->setAbsorbEvents( true );
grid->setVertAlign( Control::ALIGN_BOTTOM );
canvas->addControl( grid );
//Add a label to display the distance
// Add a text label:
grid->setControl( 0, 0, new LabelControl("Distance:") );
LabelControl* label = new LabelControl();
label->setFont( osgEarth::Registry::instance()->getDefaultFont() );
label->setFontSize( 24.0f );
label->setHorizAlign( Control::ALIGN_LEFT );
label->setText("click to measure");
grid->setControl( 1, 0, label );
//Add a callback to update the label when the distance changes
measureTool->addEventHandler( new MyMeasureToolCallback(label) );
Style style = measureTool->getLineStyle();
style.getOrCreate<LineSymbol>()->stroke()->color() = Color::Red;
style.getOrCreate<LineSymbol>()->stroke()->width() = 4.0f;
measureTool->setLineStyle(style);
//Add a checkbox to control if we are doing path based measurement or just point to point
grid->setControl( 0, 1, new LabelControl("Path"));
CheckBoxControl* checkBox = new CheckBoxControl(false);
checkBox->setHorizAlign(Control::ALIGN_LEFT);
checkBox->addEventHandler( new TogglePathHandler(measureTool));
grid->setControl( 1, 1, checkBox);
//Add a toggle to set the mode of the measuring tool
grid->setControl( 0, 2, new LabelControl("Great Circle"));
CheckBoxControl* mode = new CheckBoxControl(true);
mode->setHorizAlign(Control::ALIGN_LEFT);
mode->addEventHandler( new ToggleModeHandler(measureTool));
grid->setControl( 1, 2, mode);
//Add a mouse coords readout:
LabelControl* mouseLabel = new LabelControl();
grid->setControl( 0, 3, new LabelControl("Mouse:"));
grid->setControl( 1, 3, mouseLabel );
viewer.addEventHandler(new MouseCoordsTool(mapNode, mouseLabel) );
viewer.setSceneData( root );
// add some stock OSG handlers:
viewer.addEventHandler(new osgViewer::StatsHandler());
viewer.addEventHandler(new osgViewer::WindowSizeHandler());
viewer.addEventHandler(new osgViewer::ThreadingHandler());
viewer.addEventHandler(new osgViewer::LODScaleHandler());
viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));
viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage()));
//.........这里部分代码省略.........
示例12:
void
MacCreadySetupPanel::OnAction(int id)
{
TaskBehaviour &task_behaviour = CommonInterface::SetComputerSettings().task;
task_behaviour.auto_mc = auto_mc.GetState();
Profile::Set(ProfileKeys::AutoMc, task_behaviour.auto_mc);
}
示例13: Show
virtual void Show(const PixelRect &rc) override {
Layout layout(rc);
expert.SetState(CommonInterface::GetUISettings().dialog.expert);
expert.MoveAndShow(layout.expert);
if (borrowed2)
button2.MoveAndShow(layout.button2);
else
button2.Move(layout.button2);
if (borrowed1)
button1.MoveAndShow(layout.button1);
else
button1.Move(layout.button1);
}
示例14: SetWindow
void
MacCreadySetupPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
WindowStyle style;
style.Hide();
style.TabStop();
auto_mc.Create(parent, UIGlobals::GetDialogLook(), _("Auto"), rc, style,
*this, 1);
SetWindow(&auto_mc);
}
示例15: MoveChildren
void MoveChildren(const Layout &layout) {
waypoint_name.Move(layout.waypoint_name);
waypoint_details.Move(layout.waypoint_details);
waypoint_remove.Move(layout.waypoint_remove);
waypoint_relocate.Move(layout.waypoint_relocate);
type_label.Move(layout.type_label);
change_type.Move(layout.change_type);
map.Move(layout.map);
properties_dock.Move(layout.properties);
optional_starts.Move(layout.optional_starts);
score_exit.Move(layout.score_exit);
}