Package javax.media.j3d

Examples of javax.media.j3d.SceneGraphObject


        return tp;
    }
   
    private void _createChildren(ArrayList<AbstractNode> tpn, Stack<SceneGraphObject> sgos){
       
        SceneGraphObject sg=sgos.pop();
   
        AbstractNode an=tpn.get(tpn.size()-1);
        Enumeration<?> children=an.children();
        AbstractNode cn=null;
        while(children.hasMoreElements()){
View Full Code Here


    public void paste(boolean deepClone){
        ArrayList<SceneGraphTreeNode> v=getTree().getClipBoard().get();
        CompoundEdit compoundEdit = new CompoundEdit();
        for(SceneGraphTreeNode o: v){
            SceneGraphTreeNode cn=o.cloneNode(deepClone, this);
            SceneGraphObject replaced=addSceneGraphObject((SceneGraphObject)cn.getGraphObject());
            compoundEdit.addEdit(new AddEdit(this,
                    (SceneGraphObject)cn.getGraphObject(),
                    replaced));
        }
        compoundEdit.end();
View Full Code Here

     * @param parent used to create a new tree node according to the cloned
     * scene graph object
     * @return a clone of the tree node with a clone of the scene graph object in
     */
    public SceneGraphTreeNode cloneNode(boolean deepClone, AbstractNode parent){
        SceneGraphObject o=(SceneGraphObject)getGraphObject();
        Node n=getSceneGraphNode();
        AttachDetach ad=null;
        if(n!=null && n.isLive()){
            ad=new AttachDetach(n);
            ad.detach();
View Full Code Here

            else{
                if(_resourceKey.equals("paste")){
                    setEnabled(((SceneGraphTreeNode)getNode()).canPaste());
                }
                else if(_resourceKey.equals("copy")){
                    SceneGraphObject o=(SceneGraphObject)getNode().getGraphObject();
                    if((o instanceof Node)||(o instanceof NodeComponent)){
                        setEnabled(true);
                    }
                    else{
                        setEnabled(false);
View Full Code Here

     */
    public void addGraphObject(SceneGraphObject obj, Node owner, AttachDetach ad) {
        int[] cap = getCapabilities();
        boolean capChange = false;
        ArrayList<Integer> olds = new ArrayList<Integer>();
        SceneGraphObject co=getCapableObject(obj);
        for (int i : cap) {
            if (!co.getCapability(i)) {
                // there is need to change
                capChange = true;
                olds.add(new Integer(i));
            }
        }
        if (capChange) {
            boolean detached=false;
            if (ad != null && ad.getNode().isLive()) {
                ad.detach();
                detached=true;
            }
            for (int i : cap) {
                co.setCapability(i);
            }
            if (detached) {
                ad.attach();
            }
            _oldCapabilities.put(co, olds);
View Full Code Here

    /**
     * Remove a graph object to stop applying these data changes on
     */
    public void removeGraphObject(GraphObjectReference gnr, AttachDetach ad) {
        _references.remove(gnr);
        SceneGraphObject co=getCapableObject(gnr.getObject());
        ArrayList<Integer> olds = _oldCapabilities.get(co);
        if (olds != null) {
            boolean detached=false;
            if (ad != null && ad.getNode().isLive()) {
                ad.detach();
                detached=true;
            }
            for (Integer i : olds) {
                co.clearCapability(i);
            }
            if (detached) {
                ad.attach();
            }
            _oldCapabilities.put(co, olds);
View Full Code Here

/* 188 */     return createState(symbol);
/*     */   }
/*     */
/*     */   public SceneGraphObjectState createState(SymbolTableData symbol)
/*     */   {
/* 196 */     SceneGraphObject obj = symbol.getJ3dNode();
/* 197 */     if (obj == null) return this.nullObject;
/*     */ String name = obj.getClass().getName();
/*     */     SceneGraphObjectState ret;
/*     */     try
/*     */     {
/* 203 */       Class state = Class.forName("com.sun.j3d.utils.scenegraph.io.state." + name + "State", true, this.classLoader);
/* 204 */       ret = constructStateObj(symbol, state, obj.getClass());
/*     */     } catch (ClassNotFoundException e) {
/* 206 */       ret = checkSuperClasses(symbol);
/* 207 */       if (!(obj instanceof SceneGraphIO))
/* 208 */         System.out.println("Could not find com.sun.j3d.utils.scenegraph.io.state." + name + "State, using superclass " + ret.getClass().getName());
/* 209 */       if (ret == null) {
/* 210 */         throw new SGIORuntimeException("No State class for " + obj.getClass().getName());
/*     */       }
/*     */     }
/*     */
/* 214 */     symbol.nodeState = ret;
/*     */
View Full Code Here

/*     */
/* 142 */     String[] names = getNames();
/* 143 */     out.writeInt(names.length);
/* 144 */     for (int i = 0; i < names.length; i++) {
/* 145 */       out.writeUTF(names[i]);
/* 146 */       SceneGraphObject node = (SceneGraphObject)this.namedObjects.get(names[i]);
/* 147 */       SymbolTableData symbol = getSymbol(node);
/* 148 */       if (symbol != null)
/* 149 */         out.writeInt(symbol.nodeID);
/*     */       else {
/* 151 */         out.writeInt(0);
View Full Code Here

/* 56 */     super(symbol, control);
/*    */   }
/*    */
/*    */   protected SceneGraphObject createNode(String className)
/*    */   {
/*    */     SceneGraphObject ret;
/*    */     try {
/* 63 */       ret = super.createNode(className);
/*    */     } catch (SGIORuntimeException e) {
/* 65 */       ret = new UnresolvedBehavior();
/*    */     }
View Full Code Here

/* 261 */     throw new SGIORuntimeException("createNode() not implemented in class " + getClass().getName());
/*     */   }
/*     */
/*     */   protected SceneGraphObject createNode(Class state)
/*     */   {
/*     */     SceneGraphObject ret;
/*     */     try
/*     */     {
/* 275 */       ret = (SceneGraphObject)state.newInstance();
/*     */     }
/*     */     catch (IllegalAccessException exce)
View Full Code Here

TOP

Related Classes of javax.media.j3d.SceneGraphObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.