Examples of Appearance


Examples of javax.media.j3d.Appearance

        String shapeName = entry.getKey();
        // Assign shape name to its user data
        Shape3D shape = (Shape3D)entry.getValue();
        shape.setUserData(shapeName);
        if (shapeName.startsWith(WINDOW_PANE_SHAPE_PREFIX)) {
          Appearance appearance = shape.getAppearance();
          if (appearance == null) {
            appearance = new Appearance();
            shape.setAppearance(appearance);
          }
          if (appearance.getTransparencyAttributes() == null) {
            appearance.setTransparencyAttributes(WINDOW_PANE_TRANSPARENCY_ATTRIBUTES);
          }
        }
      }
    }
  }
View Full Code Here

Examples of javax.media.j3d.Appearance

    } else if (node instanceof Link) {
      turnOffLightsShareAndModulateTextures(((Link)node).getSharedGroup());
    } else if (node instanceof Light) {
      ((Light)node).setEnable(false);
    } else if (node instanceof Shape3D) {
      Appearance appearance = ((Shape3D)node).getAppearance();
      if (appearance != null) {
        Texture texture = appearance.getTexture();
        if (texture != null) {
          // Share textures data as much as possible
          Texture sharedTexture = TextureManager.getInstance().shareTexture(texture);
          if (sharedTexture != texture) {
            appearance.setTexture(sharedTexture);
          }
          TextureAttributes textureAttributes = appearance.getTextureAttributes();
          if (textureAttributes == null) {
            // Mix texture and shape color
            textureAttributes = new TextureAttributes();
            textureAttributes.setTextureMode(TextureAttributes.MODULATE);
            appearance.setTextureAttributes(textureAttributes);
            // Check shape color is white
            Material material = appearance.getMaterial();
            if (material == null) {
              appearance.setMaterial((Material)DEFAULT_MATERIAL.cloneNodeComponent(true));
            } else {
              Color3f color = new Color3f();
              DEFAULT_MATERIAL.getDiffuseColor(color);
              material.setDiffuseColor(color);
              DEFAULT_MATERIAL.getAmbientColor(color);
              material.setAmbientColor(color);
            }
          }
         
          // If texture image supports transparency
          if (TextureManager.getInstance().isTextureTransparent(sharedTexture)) {
            if (appearance.getTransparencyAttributes() == null) {
              // Add transparency attributes to ensure transparency works
              appearance.setTransparencyAttributes(
                  new TransparencyAttributes(TransparencyAttributes.NICEST, 0));
            }            
          }
        }
      }
View Full Code Here

Examples of javax.media.j3d.Appearance

      }
    } else if (node instanceof Link) {
      count = getVertexCount(((Link)node).getSharedGroup());
    } else if (node instanceof Shape3D) {
      Shape3D shape = (Shape3D)node;
      Appearance appearance = shape.getAppearance();
      RenderingAttributes renderingAttributes = appearance != null
          ? appearance.getRenderingAttributes() : null;
      if (renderingAttributes == null
          || renderingAttributes.getVisible()) {
        for (int i = 0, n = shape.numGeometries(); i < n; i++) {
          Geometry geometry = shape.getGeometry(i);
          if (geometry instanceof GeometryArray) {
View Full Code Here

Examples of javax.media.j3d.Appearance

      }
    } else if (node instanceof Link) {
      computeVerticesOnFloor(((Link)node).getSharedGroup(), vertices, parentTransformations);
    } else if (node instanceof Shape3D) {
      Shape3D shape = (Shape3D)node;
      Appearance appearance = shape.getAppearance();
      RenderingAttributes renderingAttributes = appearance != null
          ? appearance.getRenderingAttributes() : null;
      TransparencyAttributes transparencyAttributes = appearance != null
          ? appearance.getTransparencyAttributes() : null;
      if ((renderingAttributes == null
            || renderingAttributes.getVisible())
          && (transparencyAttributes == null
              || transparencyAttributes.getTransparency() < 1)) {
        // Compute shape geometries area
View Full Code Here

Examples of javax.media.j3d.Appearance

      }
    } else if (node instanceof Link) {
      computeAreaOnFloor(((Link)node).getSharedGroup(), nodeArea, parentTransformations);
    } else if (node instanceof Shape3D) {
      Shape3D shape = (Shape3D)node;
      Appearance appearance = shape.getAppearance();
      RenderingAttributes renderingAttributes = appearance != null
          ? appearance.getRenderingAttributes() : null;
      TransparencyAttributes transparencyAttributes = appearance != null
          ? appearance.getTransparencyAttributes() : null;
      if ((renderingAttributes == null
            || renderingAttributes.getVisible())
          && (transparencyAttributes == null
              || transparencyAttributes.getTransparency() < 1)) {
        // Compute shape geometries area
View Full Code Here

Examples of org.drools.planner.examples.tsp.domain.Appearance

            }
            previousAppearanceListField.setSelectedItem(visit.getPreviousAppearance());
            int result = JOptionPane.showConfirmDialog(TspListPanel.this.getRootPane(), previousAppearanceListField,
                    "Visit " + visit.getCity().getSafeName() + " after", JOptionPane.OK_CANCEL_OPTION);
            if (result == JOptionPane.OK_OPTION) {
                Appearance toAppearance = (Appearance) previousAppearanceListField.getSelectedItem();
//                tspPanel.doMove(visit, toAppearance);
                JOptionPane.showMessageDialog(TspListPanel.this, "Unsupported operation."); // TODO FIXME
                tspPanel.getWorkflowFrame().resetScreen();
            }
        }
View Full Code Here

Examples of org.pdfclown.documents.interaction.annotations.Appearance

          PdfName.H,
          PdfName.P
          );
      }

      Appearance appearance = widget.getAppearance();
      if(appearance == null)
      {widget.setAppearance(appearance = new Appearance(document));}

      AppearanceStates normalAppearance = appearance.getNormal();
      FormXObject onState = new FormXObject(document);
      normalAppearance.put(PdfName.Yes,onState);

//TODO:verify!!!
//   appearance.getRollover().put(PdfName.Yes,onState);
View Full Code Here

Examples of org.pdfclown.documents.interaction.annotations.Appearance

          PdfName.H,
          PdfName.P
          );
      }

      Appearance appearance = widget.getAppearance();
      if(appearance == null)
      {widget.setAppearance(appearance = new Appearance(document));}

      AppearanceStates normalAppearance = appearance.getNormal();
      FormXObject onState = normalAppearance.get(new PdfName(((DualWidget)widget).getWidgetName()));

//TODO:verify!!!
//   appearance.getRollover().put(new PdfName(...),onState);
//   appearance.getDown().put(new PdfName(...),onState);
View Full Code Here

Examples of org.pdfclown.documents.interaction.annotations.Appearance

    )
  {
    Document document = field.getDocument();
    Widget widget = field.getWidgets().get(0);

    Appearance appearance = widget.getAppearance();
    if(appearance == null)
    {widget.setAppearance(appearance = new Appearance(document));}

    FormXObject normalAppearanceState = new FormXObject(document);
    {
      Rectangle2D widgetBox = widget.getBox();
      Dimension2D size = new Dimension(widgetBox.getWidth(),widgetBox.getHeight());
      normalAppearanceState.setSize(size);
      PrimitiveComposer composer = new PrimitiveComposer(normalAppearanceState);

      composer.beginLocalState();
      float lineWidth = 1;
      composer.setLineWidth(lineWidth);
      composer.setFillColor(getBackColor());
      composer.setStrokeColor(getForeColor());
      Rectangle2D frame = new Rectangle2D.Double(lineWidth/2,lineWidth/2,size.getWidth()-lineWidth,size.getHeight()-lineWidth);
      composer.drawRectangle(frame,5);
      composer.fillStroke();
      composer.end();

      String caption = (String)field.getValue();
      if(caption != null)
      {
        BlockComposer blockComposer = new BlockComposer(composer);
        blockComposer.begin(frame,AlignmentXEnum.Center,AlignmentYEnum.Middle);
        composer.setFillColor(getForeColor());
        composer.setFont(
          new StandardType1Font(
            document,
            StandardType1Font.FamilyEnum.Helvetica,
            true,
            false
            ),
          (float)(size.getHeight() * 0.5)
          );
        blockComposer.showText(caption);
        blockComposer.end();
      }

      composer.flush();
    }
    appearance.getNormal().put(null,normalAppearanceState);
  }
View Full Code Here

Examples of org.pdfclown.documents.interaction.annotations.Appearance

    )
  {
    Document document = field.getDocument();
    Widget widget = field.getWidgets().get(0);

    Appearance appearance = widget.getAppearance();
    if(appearance == null)
    {widget.setAppearance(appearance = new Appearance(document));}

    widget.getBaseDataObject().put(
      PdfName.DA,
      new PdfString("/Helv " + getFontSize() + " Tf 0 0 0 rg")
      );

    FormXObject normalAppearanceState = new FormXObject(document);
    {
      Rectangle2D widgetBox = widget.getBox();
      Dimension2D size = new Dimension(widgetBox.getWidth(),widgetBox.getHeight());
      normalAppearanceState.setSize(size);
      PrimitiveComposer composer = new PrimitiveComposer(normalAppearanceState);

      composer.beginLocalState();
      float lineWidth = 1;
      composer.setLineWidth(lineWidth);
      composer.setFillColor(getBackColor());
      composer.setStrokeColor(getForeColor());
      Rectangle2D frame = new Rectangle2D.Double(lineWidth/2,lineWidth/2,size.getWidth()-lineWidth,size.getHeight()-lineWidth);
      composer.drawRectangle(frame,5);
      composer.fillStroke();
      composer.end();

      composer.beginMarkedContent(PdfName.Tx);
      composer.setFont(
        new StandardType1Font(
          document,
          StandardType1Font.FamilyEnum.Helvetica,
          false,
          false
          ),
        getFontSize()
        );
      composer.showText(
        (String)field.getValue(),
        new Point2D.Double(0,size.getHeight()/2),
        AlignmentXEnum.Left,
        AlignmentYEnum.Middle,
        0
        );
      composer.end();

      composer.flush();
    }
    appearance.getNormal().put(null,normalAppearanceState);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.