Search in sources :

Example 6 with CompositeComponent

use of artisynth.core.modelbase.CompositeComponent in project artisynth_core by artisynth.

the class SelectionPopup method isVisible.

private boolean isVisible(RenderableComponent rcomp) {
    RenderProps props = rcomp.getRenderProps();
    if (props != null) {
        return props.isVisible();
    }
    CompositeComponent parent = rcomp.getParent();
    if (parent instanceof RenderableComponentList) {
        return ((RenderableComponentList<?>) parent).rendersSubComponents();
    }
    return false;
}
Also used : RenderableComponentList(artisynth.core.modelbase.RenderableComponentList) RenderProps(maspack.render.RenderProps) MutableCompositeComponent(artisynth.core.modelbase.MutableCompositeComponent) CompositeComponent(artisynth.core.modelbase.CompositeComponent)

Example 7 with CompositeComponent

use of artisynth.core.modelbase.CompositeComponent in project artisynth_core by artisynth.

the class CollisionManager method getExternallyCollidableBodies.

private static void getExternallyCollidableBodies(List<CollidableBody> list, ModelComponent mc) {
    if (mc instanceof CompositeComponent) {
        CompositeComponent comp = (CompositeComponent) mc;
        for (int i = 0; i < comp.numComponents(); i++) {
            ModelComponent c = comp.get(i);
            if (c instanceof Collidable) {
                Collidable col = (Collidable) c;
                if (isCollidableBody(col) && isExternallyCollidable(col)) {
                    list.add((CollidableBody) c);
                }
            }
            getExternallyCollidableBodies(list, c);
        }
    }
}
Also used : ModelComponent(artisynth.core.modelbase.ModelComponent) CompositeComponent(artisynth.core.modelbase.CompositeComponent)

Example 8 with CompositeComponent

use of artisynth.core.modelbase.CompositeComponent in project artisynth_core by artisynth.

the class CollisionManager method getInternallyCollidableBodies.

private static void getInternallyCollidableBodies(List<CollidableBody> list, ModelComponent mc) {
    if (mc instanceof CompositeComponent) {
        CompositeComponent comp = (CompositeComponent) mc;
        for (int i = 0; i < comp.numComponents(); i++) {
            ModelComponent c = comp.get(i);
            if (c instanceof Collidable) {
                Collidable col = (Collidable) c;
                if (isCollidableBody(col) && isInternallyCollidable(col)) {
                    list.add((CollidableBody) c);
                }
            }
            getInternallyCollidableBodies(list, c);
        }
    }
}
Also used : ModelComponent(artisynth.core.modelbase.ModelComponent) CompositeComponent(artisynth.core.modelbase.CompositeComponent)

Example 9 with CompositeComponent

use of artisynth.core.modelbase.CompositeComponent in project artisynth_core by artisynth.

the class AuxMaterialElementDesc method write.

public void write(PrintWriter pw, NumberFormat fmt, Object ref) throws IOException {
    CompositeComponent ancestor = ComponentUtils.castRefToAncestor(ref);
    pw.print("[ ");
    IndentingPrintWriter.addIndentation(pw, 2);
    printElementReference(pw, ancestor);
    pw.println("");
    getAllPropertyInfo().writeNonDefaultProps(this, pw, fmt);
    IndentingPrintWriter.addIndentation(pw, -2);
    pw.println("]");
}
Also used : CompositeComponent(artisynth.core.modelbase.CompositeComponent)

Example 10 with CompositeComponent

use of artisynth.core.modelbase.CompositeComponent in project artisynth_core by artisynth.

the class NumericProbeEditor method getFullPropPath.

/**
 * returns the full string path of a property by going up the hierachy and
 * finding all its parent properties (if any) and component path.
 */
protected String getFullPropPath(Property prop) {
    String compPath = prop.getName();
    ModelComponent root = myMain.getRootModel();
    Object host = prop.getHost();
    // System.out.println("Looking for parent path...");
    if (host instanceof CompositeProperty) {
        while (host instanceof CompositeProperty) {
            String name = ((CompositeProperty) host).getPropertyInfo().getName();
            // System.out.println(name);
            compPath = name + "." + compPath;
            host = ((CompositeProperty) host).getPropertyHost();
        }
        String baseComp = ComponentUtils.getPathName((CompositeComponent) root, (ModelComponent) host);
        compPath = baseComp + ComponentUtils.componentPropertySeparator + compPath;
    } else {
        compPath = ComponentUtils.getPathName((CompositeComponent) root, (ModelComponent) prop.getHost());
        compPath += ComponentUtils.componentPropertySeparator + prop.getName();
    }
    // System.out.println("found component base path: "+compPath);
    return compPath;
}
Also used : ModelComponent(artisynth.core.modelbase.ModelComponent) CompositeComponent(artisynth.core.modelbase.CompositeComponent) CompositeProperty(maspack.properties.CompositeProperty)

Aggregations

CompositeComponent (artisynth.core.modelbase.CompositeComponent)12 ModelComponent (artisynth.core.modelbase.ModelComponent)7 Point (artisynth.core.mechmodels.Point)3 MutableCompositeComponent (artisynth.core.modelbase.MutableCompositeComponent)3 ContactPoint (artisynth.core.mechmodels.ContactPoint)2 Component (java.awt.Component)2 JComponent (javax.swing.JComponent)2 HasMenuItems (artisynth.core.modelbase.HasMenuItems)1 PropertyChangeEvent (artisynth.core.modelbase.PropertyChangeEvent)1 RenderableComponentList (artisynth.core.modelbase.RenderableComponentList)1 RootModel (artisynth.core.workspace.RootModel)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 CompositeProperty (maspack.properties.CompositeProperty)1 EditingProperty (maspack.properties.EditingProperty)1 Property (maspack.properties.Property)1 RenderProps (maspack.render.RenderProps)1 LabeledComponentBase (maspack.widgets.LabeledComponentBase)1 LabeledControl (maspack.widgets.LabeledControl)1 OptionPanel (maspack.widgets.OptionPanel)1