コード例 #1
0
ファイル: LinkRetained.java プロジェクト: scijava/java3d-core
 @Override
 void setCompiled() {
   super.setCompiled();
   if (sharedGroup != null) {
     sharedGroup.setCompiled();
   }
 }
コード例 #2
0
ファイル: LinkRetained.java プロジェクト: scijava/java3d-core
  @Override
  void removeNodeData(SetLiveState s) {
    if (refCount <= 0) {
      // either not in sharedGroup or last instance in sharedGroup
      // remove this node from parentTransformLink's childTransformLink
      if (parentTransformLink != null) {
        ArrayList<NodeRetained> obj;
        if (parentTransformLink instanceof TransformGroupRetained) {
          obj = ((TransformGroupRetained) parentTransformLink).childTransformLinks;
        } else {
          obj = ((SharedGroupRetained) parentTransformLink).childTransformLinks;
        }
        synchronized (obj) {
          obj.remove(this);
        }
      }

      // remove this node from parentSwitchLink's childSwitchLink
      if (parentSwitchLink != null) {
        for (int i = 0; i < parentSwitchLink.childrenSwitchLinks.size(); i++) {
          ArrayList<NodeRetained> switchLinks = parentSwitchLink.childrenSwitchLinks.get(i);
          if (switchLinks.contains(this)) {
            switchLinks.remove(this);
            break;
          }
        }
      }
    }
    super.removeNodeData(s);
  }
コード例 #3
0
ファイル: LinkRetained.java プロジェクト: scijava/java3d-core
 @Override
 void setBoundsAutoCompute(boolean autoCompute) {
   super.setBoundsAutoCompute(autoCompute);
   if (!autoCompute) {
     localBounds = getBounds();
   }
 }
コード例 #4
0
ファイル: LinkRetained.java プロジェクト: scijava/java3d-core
  @Override
  void setNodeData(SetLiveState s) {

    super.setNodeData(s);

    // add this node to parentTransformLink's childTransformLink
    if (s.childTransformLinks != null) {
      // do not duplicate shared nodes
      synchronized (s.childTransformLinks) {
        if (!inSharedGroup || !s.childTransformLinks.contains(this)) {
          s.childTransformLinks.add(this);
        }
      }
    }

    // add this node to parentSwitchLink's childSwitchLink
    if (s.childSwitchLinks != null) {
      if (!inSharedGroup
          ||
          // only add if not already added in sharedGroup
          !s.childSwitchLinks.contains(this)) {
        s.childSwitchLinks.add(this);
      }
    }
  }
コード例 #5
0
ファイル: LinkRetained.java プロジェクト: scijava/java3d-core
  /** assign a name to this node when it is made live. */
  @Override
  void clearLive(SetLiveState s) {

    if (sharedGroup != null) {
      HashKey newKeys[] = getNewKeys(s.locale.nodeId, s.keys);
      super.clearLive(s);
      HashKey oldKeys[] = s.keys;
      s.keys = newKeys;
      s.inSharedGroup = true;
      this.sharedGroup.parents.remove(this);
      this.sharedGroup.clearLive(s);
      s.inSharedGroup = inSharedGroup;
      s.keys = oldKeys;
    } else {
      super.clearLive(s);
    }
  }
コード例 #6
0
ファイル: LinkRetained.java プロジェクト: scijava/java3d-core
  @Override
  void updateCollidable(HashKey keys[], boolean collide[]) {
    super.updateCollidable(keys, collide);

    if (sharedGroup != null) {
      HashKey newKeys[] = getNewKeys(locale.nodeId, keys);
      sharedGroup.updateCollidable(newKeys, collide);
    }
  }
コード例 #7
0
ファイル: LinkRetained.java プロジェクト: scijava/java3d-core
  @Override
  void updatePickable(HashKey keys[], boolean pick[]) {
    super.updatePickable(keys, pick);

    if (sharedGroup != null) {
      HashKey newKeys[] = getNewKeys(locale.nodeId, keys);
      sharedGroup.updatePickable(newKeys, pick);
    }
  }
コード例 #8
0
ファイル: LinkRetained.java プロジェクト: scijava/java3d-core
  /** assign a name to this node when it is made live. */
  @Override
  void setLive(SetLiveState s) {

    super.doSetLive(s);

    if (inBackgroundGroup) {
      throw new IllegalSceneGraphException(J3dI18N.getString("LinkRetained0"));
    }

    if (nodeId == null) {
      nodeId = universe.getNodeId();
    }

    if (sharedGroup != null) {
      this.sharedGroup.parents.add(this);
      HashKey newKeys[] = getNewKeys(s.locale.nodeId, s.keys);
      HashKey oldKeys[] = s.keys;
      s.keys = newKeys;
      s.inSharedGroup = true;
      if (visited) {
        throw new SceneGraphCycleException(J3dI18N.getString("LinkRetained1"));
      }
      visited = true;
      try {
        this.sharedGroup.setLive(s);
      } catch (SceneGraphCycleException e) {
        throw e;
      } finally {
        visited = false;
      }

      s.inSharedGroup = inSharedGroup;
      s.keys = oldKeys;

      localBounds.setWithLock(this.sharedGroup.localBounds);
    }

    super.markAsLive();
  }
コード例 #9
0
ファイル: LinkRetained.java プロジェクト: scijava/java3d-core
  @Override
  void compile(CompileState compState) {

    super.compile(compState);

    // XXXX: for now keep the static transform in the parent tg
    compState.keepTG = true;

    // don't remove this group node
    mergeFlag = SceneGraphObjectRetained.DONT_MERGE;

    if (J3dDebug.devPhase && J3dDebug.debug) {
      compState.numLinks++;
    }
  }