本文整理汇总了Java中edu.umd.cs.piccolo.PNode.removeChild方法的典型用法代码示例。如果您正苦于以下问题:Java PNode.removeChild方法的具体用法?Java PNode.removeChild怎么用?Java PNode.removeChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.piccolo.PNode
的用法示例。
在下文中一共展示了PNode.removeChild方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateNumberOfMoleculeNodes
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void updateNumberOfMoleculeNodes( PNode parent, int count, double diameter, float transparency, Color color ) {
// remove nodes
while ( count < parent.getChildrenCount() && count >= 0 ) {
parent.removeChild( parent.getChildrenCount() - 1 );
}
// add nodes
while ( count > parent.getChildrenCount() ) {
DotNode node = new DotNode( diameter, color, transparency );
Point2D p = getRandomPoint();
double x = p.getX() - ( node.getFullBoundsReference().getWidth() / 2 );
double y = p.getY() - ( node.getFullBoundsReference().getHeight() / 2 );
node.setOffset( x, y );
parent.addChild( node );
}
assert( count == parent.getChildrenCount() );
}
示例2: updateNumberOfMoleculeNodes
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void updateNumberOfMoleculeNodes( PNode parent, int count, double scale, float transparency, Image image ) {
// remove nodes
while ( count < parent.getChildrenCount() && count >= 0 ) {
parent.removeChild( parent.getChildrenCount() - 1 );
}
// add nodes
while ( count > parent.getChildrenCount() ) {
ImageNode node = new ImageNode( image, scale, transparency );
Point2D p = getRandomPoint();
double x = p.getX() - ( node.getFullBoundsReference().getWidth() / 2 );
double y = p.getY() - ( node.getFullBoundsReference().getHeight() / 2 );
node.setOffset( x, y );
parent.addChild( node );
}
assert( count == parent.getChildrenCount() );
}
示例3: updateMoleculeNodes
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void updateMoleculeNodes( PNode parent, Molecule molecule, int count ) {
// remove nodes
while ( count < parent.getChildrenCount() && count >= 0 ) {
parent.removeChild( parent.getChildrenCount() - 1 );
}
// add nodes
while ( count > parent.getChildrenCount() ) {
// create node
PImage node = new PImage( molecule.getImage() );
node.setScale( MOLECULE_IMAGE_SCALE );
parent.addChild( node );
// move to a random location
Point2D p = getRandomPoint();
double x = p.getX() - ( node.getFullBoundsReference().getWidth() / 2 );
double y = p.getY() - ( node.getFullBoundsReference().getHeight() / 2 );
node.setOffset( x, y );
}
assert( count == parent.getChildrenCount() );
}
示例4: modelElementRemoved
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public void modelElementRemoved( ModelElement modelElement ) {
GraphicRecord graphicRecord = (GraphicRecord)modelElementToGraphicMap.get( modelElement );
if( graphicRecord != null ) {
PNode layer = graphicRecord.getLayer();
PNode graphic = graphicRecord.getGraphic();
layer.removeChild( graphic );
modelElementToGraphicMap.remove( modelElement );
}
}
示例5: removeLineNode
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private static void removeLineNode( Line line, PNode parent ) {
for ( int i = 0; i < parent.getChildrenCount(); i++ ) {
PNode node = parent.getChild( i );
if ( node instanceof LineNode ) {
LineNode lineNode = (LineNode) node;
if ( lineNode.line == line ) {
parent.removeChild( node );
break;
}
}
}
}
示例6: removeNucleonNodeFromLayers
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private boolean removeNucleonNodeFromLayers( SubatomicParticleNode nucleonNode ) {
boolean found = false;
for ( PNode nucleusLayer : nucleusLayers ) {
if ( nucleusLayer.removeChild( nucleonNode ) != null ) {
found = true;
break;
}
}
return found;
}
示例7: handleParticleRemoved
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
* Handle the removal of the particle within the model that is being
* represented in the view by this particle node. This is done by
* removing ourself from the canvas and by cleaning up any memory
* references so that we can be garbage collected.
*/
private void handleParticleRemoved() {
// Remove ourself from the canvas.
PNode parent = getParent();
if ( parent != null ) {
parent.removeChild( this );
}
// Remove all children, since they have a reference to this object.
removeAllChildren();
// Explicitly clear our reference to the particle in the model.
m_particle = null;
}
示例8: modelElementRemoved
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public void modelElementRemoved( ModelElement modelElement ) {
ArrayList<NodeRecord> nodeRecordList = _nodeRecordsMap.get( modelElement );
if ( nodeRecordList != null ) {
for ( NodeRecord nodeRecord : new ArrayList<NodeRecord>( nodeRecordList ) ) {
PNode node = nodeRecord.getNode();
PNode parent = nodeRecord.getParent();
parent.removeChild( node );
}
_nodeRecordsMap.remove( modelElement );
}
}
示例9: createCurve
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
private void createCurve( MRModel model, PNode curveLayer ) {
if( energyProfileGraphic != null ) {
try {
curveLayer.removeChild( energyProfileGraphic );
}
catch( ArrayIndexOutOfBoundsException e ) {
}
}
energyProfileGraphic = new EnergyProfileGraphic( model.getEnergyProfile(),
curveAreaSize,
curveColor );
curveLayer.addChild( energyProfileGraphic );
}
示例10: modelElementRemoved
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
/**
* When a model element is removed from the model, we remove its associated graphic
* from the layer it's on, and remove the graphic from our records
*
* @param modelElement
*/
public void modelElementRemoved( ModelElement modelElement ) {
GraphicRecord graphicRecord = (GraphicRecord)modelElementToGraphicMap.get( modelElement );
if( graphicRecord != null ) {
PNode layer = graphicRecord.getLayer();
PNode graphic = graphicRecord.getGraphic();
layer.removeChild( graphic );
modelElementToGraphicMap.remove( modelElement );
}
}
示例11: removeFromCanvas
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public void removeFromCanvas(PNode channelLayer, PNode edgeLayer){
channelLayer.removeChild(this.channelLayer);
edgeLayer.removeChild(this.edgeLayer);
}
示例12: removeFromCanvas
import edu.umd.cs.piccolo.PNode; //导入方法依赖的package包/类
public void removeFromCanvas( PNode channelLayer, PNode edgeLayer ) {
channelLayer.removeChild( this.channelLayer );
edgeLayer.removeChild( this.edgeLayer );
}