本文整理汇总了Java中edu.umd.cs.piccolo.PNode.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Java PNode.setVisible方法的具体用法?Java PNode.setVisible怎么用?Java PNode.setVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.piccolo.PNode
的用法示例。
在下文中一共展示了PNode.setVisible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillEmptyVisibleSlots
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
* Go through the list of visible nuclei and fill any unoccupied slots
* with invisible nuclei and make them visible.
*/
private void fillEmptyVisibleSlots(){
for (int i = 0; i < _visibleNucleusNodes.length; i++){
if (_visibleNucleusNodes[i] == null){
// Fill this slot.
for (int j = 0; j < getChildrenCount(); j++){
PNode childNode = getChild(j);
if (childNode instanceof AbstractAtomicNucleusNode){
// Add this to the list of visible nuclei.
childNode.setVisible(true);
_visibleNucleusNodes[i] = (AbstractAtomicNucleusNode)childNode;
positionVisibleNucleus(i);
break;
}
}
}
}
}
示例2: setAllOfTypeVisible
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
* Sets the visibility of all graphics of a specified type
*
* @param graphicClass
* @param isVisible
*/
public void setAllOfTypeVisible( Class graphicClass, boolean isVisible ) {
Iterator nodeIt = canvas.getAllNodes().iterator();
while( nodeIt.hasNext() ) {
PNode node = (PNode)nodeIt.next();
if( graphicClass.isInstance( node ) ) {
node.setVisible( isVisible );
}
}
if( !isVisible ) {
invisibleGraphicClasses.add( graphicClass );
}
else {
invisibleGraphicClasses.remove( graphicClass );
}
}
示例3: setAllOfTypeVisible
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
* Sets the visibility of all graphics of a specified type
*
* @param graphicClass
* @param isVisible
*/
public void setAllOfTypeVisible( Class graphicClass, boolean isVisible ) {
Iterator nodeIt = modelElementToGraphicMap.values().iterator();
while( nodeIt.hasNext() ) {
GraphicRecord graphicRecord = (GraphicRecord)nodeIt.next();
if( graphicClass.isInstance( graphicRecord.getGraphic() ) ) {
PNode node = (PNode)graphicRecord.getGraphic();
node.setVisible( isVisible );
}
}
if( !isVisible ) {
invisibleGraphicClasses.add( graphicClass );
}
else {
invisibleGraphicClasses.remove( graphicClass );
}
}
示例4: setTopLevelNodeVisible
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void setTopLevelNodeVisible( PNode topLevelNode ) {
// hide all top-level nodes
gameSettingsNode.setVisible( false );
gamePlayParentNode.setVisible( false );
if ( gameOverNode != null ) {
gameOverNode.setVisible( false );
}
// make one visible
topLevelNode.setVisible( true );
}
示例5: updateDragHandle
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private static void updateDragHandle( PNode dragHandleNode, final double barHeight, final double graphHeight ) {
// handles are invisible if the bar extends above or below the graph's bounds
dragHandleNode.setVisible( barHeight > 0 && barHeight <= graphHeight );
if ( dragHandleNode.getVisible() ) {
// position the handle at the top of the bar
dragHandleNode.setOffset( dragHandleNode.getXOffset(), graphHeight - barHeight );
}
}
示例6: updateCount
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void updateCount( ManualGeneExpressionModel model ) {
int numProteinTypesCollected = 0;
if ( model.proteinACollected.get() > 0 ) {
numProteinTypesCollected++;
}
if ( model.proteinBCollected.get() > 0 ) {
numProteinTypesCollected++;
}
if ( model.proteinCCollected.get() > 0 ) {
numProteinTypesCollected++;
}
removeAllChildren();
PNode collectedQuantityIndicator = new VBox(
5,
new HBox( 4, new ReadoutPText( PROTEIN_COUNT_CAPTION_PART_1 ), new IntegerBox( numProteinTypesCollected ) ),
new ReadoutPText( PROTEIN_COUNT_CAPTION_PART_2 ) {{
setFont( READOUT_FONT );
}}
);
if ( collectedQuantityIndicator.getFullBoundsReference().width > MAX_CONTENT_WIDTH ) {
// Scale to fit.
collectedQuantityIndicator.setScale( MAX_CONTENT_WIDTH / getFullBoundsReference().width );
}
// Offset the collection complete indicator so that it will be
// centered when it is shown.
collectionCompleteNode.centerFullBoundsOnPoint( collectedQuantityIndicator.getFullBoundsReference().getCenterX(),
collectedQuantityIndicator.getFullBoundsReference().getCenterY() );
// Add both nodes, so that the overall size of the node is
// consistent, but only show one of them based upon whether the
// collection is complete.
addChild( collectedQuantityIndicator );
addChild( collectionCompleteNode );
// Set the visibility.
collectedQuantityIndicator.setVisible( numProteinTypesCollected != NUM_PROTEIN_TYPES );
collectionCompleteNode.setVisible( numProteinTypesCollected == NUM_PROTEIN_TYPES );
}
示例7: updateShapesDebugNodes
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void updateShapesDebugNodes() {
shapesDebugParentNode.removeAllChildren();
PNode voltageShapesDebugNode = new VoltageShapesDebugNode( model.circuit, model.voltmeter );
shapesDebugParentNode.addChild( voltageShapesDebugNode );
voltageShapesDebugNode.setVisible( getGlobalProperties().voltageShapesVisibleProperty.get() );
PNode eFieldShapesDebugNode = new EFieldShapesDebugNode( model.circuit );
shapesDebugParentNode.addChild( eFieldShapesDebugNode );
eFieldShapesDebugNode.setVisible( getGlobalProperties().eFieldShapesVisibleProperty.get() );
}
示例8: updateShapesDebugNodes
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void updateShapesDebugNodes() {
shapesDebugParentNode.removeAllChildren();
PNode voltageShapesDebugNode = new VoltageShapesDebugNode( model.currentCircuitProperty.get(), model.voltmeter );
shapesDebugParentNode.addChild( voltageShapesDebugNode );
voltageShapesDebugNode.setVisible( getGlobalProperties().voltageShapesVisibleProperty.get() );
PNode eFieldShapesDebugNode = new EFieldShapesDebugNode( model.currentCircuitProperty.get() );
shapesDebugParentNode.addChild( eFieldShapesDebugNode );
eFieldShapesDebugNode.setVisible( getGlobalProperties().eFieldShapesVisibleProperty.get() );
}
示例9: modelElementAdded
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
* When a ModelElement is added to the Model, we create a graphic, if a factor has be installed for that
* class of ModelElement
*
* @param modelElement
*/
public void modelElementAdded( ModelElement modelElement ) {
PNode graphic = null;
PNode layer = canvas;
// Look up the inheritance chain for a graphic factory that will work for the
// model element
Class modelElementClass = modelElement.getClass();
GraphicFactory graphicFactory = null;
while( modelElementClass != Object.class && graphicFactory == null ) {
graphicFactory = (GraphicFactory)modelElementClassToGraphicFactory.get( modelElementClass );
modelElementClass = modelElementClass.getSuperclass();
}
// If we found a graphic factory for the model element, have it make a graphic
// and add it to the view
if( graphicFactory != null ) {
graphic = graphicFactory.createGraphic( modelElement );
// If the graphic factory has a layer associated with it, put the
// graphic on that layer. Otherwise, put it right on the canvas
if( graphicFactory.getLayer() != null ) {
layer = graphicFactory.getLayer();
}
else {
layer = canvas;
}
if( invisibleGraphicClasses.contains( graphic.getClass() ) ) {
graphic.setVisible( false );
}
modelElementToGraphicMap.put( modelElement, new GraphicRecord( graphic, layer ) );
addGraphic( graphic, layer );
}
}
示例10: setVisible
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void setVisible( List<PNode> nodes, boolean visible ) {
if ( nodes != null ) {
for ( PNode node : nodes ) {
node.setVisible( visible );
}
}
}
示例11: setValuesVisible
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public void setValuesVisible( boolean visible ) {
for ( PNode node : tickLabelNodes ) {
node.setVisible( visible );
}
}
示例12: MultipleCapacitorsCanvas
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public MultipleCapacitorsCanvas( final MultipleCapacitorsModel model, final CLModelViewTransform3D mvt, CLGlobalProperties globalProperties ) {
super( model, mvt, globalProperties );
this.model = model;
/*
* Maximums, for calibrating various view representations.
* Note that for charge and fields, we get these values from the DielectricModel,
* so that density of charge and field will be the same across all modules.
*/
final double maxPlateCharge = DielectricModel.getMaxPlateCharge();
final double maxExcessDielectricPlateCharge = DielectricModel.getMaxExcessDielectricPlateCharge();
final double maxEffectiveEField = DielectricModel.getMaxEffectiveEField();
final double maxDielectricEField = DielectricModel.getMaxDielectricEField();
final double eFieldReferenceMagnitude = MultipleCapacitorsModel.getEFieldReferenceMagnitude();
// One node for each circuit. These persist so we don't have to do cleanup when the current circuit changes.
circuitParentNode = new PNode();
for ( ICircuit circuit : model.getCircuits() ) {
PNode node = new MultipleCapacitorsCircuitNode( circuit, mvt, false /* dielectricVisible */,
getPlateChargesVisibleProperty(), getEFieldVisibleProperty(), getDielectricChargeViewProperty(),
maxPlateCharge, maxExcessDielectricPlateCharge, maxEffectiveEField, maxDielectricEField );
node.setVisible( false );
circuitParentNode.addChild( node );
}
// meters
capacitanceMeterNode = new CapacitanceMeterNode( model.capacitanceMeter, mvt, CLStrings.TOTAL_CAPACITANCE );
plateChargeMeterNode = new PlateChargeMeterNode( model.plateChargeMeter, mvt, CLStrings.STORED_CHARGE );
storedEnergyMeterNode = new StoredEnergyMeterNode( model.storedEnergyMeter, mvt, CLStrings.STORED_ENERGY );
VoltmeterNode voltmeterNode = new VoltmeterNode( model.voltmeter, mvt );
EFieldDetectorNode eFieldDetectorNode = new EFieldDetectorNode( model.eFieldDetector, mvt, eFieldReferenceMagnitude, globalProperties.dev, true /* eFieldDetectorSimplified */ );
// debug
shapesDebugParentNode = new PComposite();
// rendering order
addChild( circuitParentNode );
addChild( capacitanceMeterNode );
addChild( plateChargeMeterNode );
addChild( storedEnergyMeterNode );
addChild( eFieldDetectorNode );
addChild( voltmeterNode );
addChild( shapesDebugParentNode );
// When the current circuit changes, make the proper circuit node visible.
model.currentCircuitProperty.addObserver( new SimpleObserver() {
public void update() {
updateCircuitNodes();
}
} );
// change visibility of debug shapes
RichSimpleObserver shapesVisibilityObserver = new RichSimpleObserver() {
public void update() {
updateShapesDebugNodes();
}
};
shapesVisibilityObserver.observe( globalProperties.eFieldShapesVisibleProperty, globalProperties.voltageShapesVisibleProperty );
}
示例13: modelElementAdded
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public void modelElementAdded( ModelElement modelElement ) {
PNode graphic = null;
PNode layer = canvas;
if( modelElement instanceof Dipole ) {
graphic = new DipoleGraphic( (Dipole)modelElement, model.getSampleMaterial() );
layer = dipolesLayer;
}
else if( modelElement instanceof SampleChamber ) {
graphic = new SampleChamberGraphic( (SampleChamber)modelElement );
layer = sampleChamberLayer;
}
else if( modelElement instanceof SimpleMagnet ) {
graphic = new ElectromagnetGraphic( (GradientElectromagnet)modelElement );
layer = magnetCoilLayer;
}
else if( modelElement instanceof LinearGradientMagnet ) {
graphic = new GradientMagnetGraphic( (GradientElectromagnet)modelElement );
layer = magnetCoilLayer;
}
else if( modelElement instanceof RadiowaveSource
&& !( modelElement instanceof PlaneWaveCycle ) ) {
graphic = new RadiowaveSourceGraphic( (RadiowaveSource)modelElement, module );
// graphic = new RadiowaveSourceGraphicPrev( (RadiowaveSource)modelElement, phetPCanvas, module );
layer = controlLayer;
}
else if( modelElement instanceof Photon ) {
graphic = PhotonGraphic.getInstance( (Photon)modelElement );
layer = rfLayer;
}
else if( modelElement instanceof Detector ) {
graphic = new DetectorGraphic( (Detector)modelElement );
layer = controlLayer;
}
else if( modelElement instanceof PlaneWaveMedium ) {
PlaneWaveMedium pwm = (PlaneWaveMedium)modelElement;
double maxOpacity = 0.25;
if( pwm.getSource() instanceof MriEmittedPhoton ) {
maxOpacity = 0.5;
}
graphic = new PlaneWaveGraphic( pwm,
maxOpacity,
Color.black );
layer = rfLayer;
}
// If we created a graphic, add it to the canvas
if( graphic != null ) {
if( invisibleGraphicClasses.contains( graphic.getClass() ) ) {
graphic.setVisible( false );
}
modelElementToGraphicMap.put( modelElement, new GraphicRecord( graphic, layer ) );
addGraphic( graphic, layer );
}
}
示例14: setNodeVisibility
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void setNodeVisibility( boolean visible, PNode... nodes ) {
for ( PNode node : nodes ) {
node.setVisible( visible );
}
}
示例15: showAll
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void showAll( PNode node ) {
node.setVisible( true );
for ( int i = 0; i < node.getChildrenCount(); i++ ) {
showAll( node.getChild( i ) );
}
}