Property — Aspose.3D FOSS for Java

Example

Property repre­zentuoja vieną pavadintą, tipizuotą metaduomenų lauką, priskirtą bet kuriam A3DObject (įskaitant Node, Mesh, AnimationClip, kt.). Savybės pasiekiamos per PropertyCollection grąžinamą obj.getProperties(). Galite skaityti, rašyti ir išvardinti savybes, kad saugotumėte vartotojo apibrėžtus duomenis šalia scenos elementų.

Example: com.aspose.threed

import com.aspose.threed.Property;

Example

Property objektai paprastai nėra tiesiogiai konstruojami programos kode. Jie kuriami kviečiant A3DObject.getProperty() arba randami per A3DObject.findProperty().

ExampleExampleExample
nameStringSavybės pavadinimas
valueObjectPradinė reikšmė (neprivaloma)

Example

ExampleExampleExampleExampleExample
nameStringgetName()Tik skaitymui skirta savybės pavadinimas
valueObjectgetValue()setValue(Object)Dabartinė reikšmė; skaitoma ir rašoma
valueTypeClass<?>getValueType()Java Class dabartinės reikšmės

Example

ExampleGrąžinimo tipasExample
getExtra(String name)ObjectGauti pavadintą papildomą metaduomenų lauką, saugomą šioje savybėje
setExtra(String name, Object value)voidNustato pavadintą papildomą metaduomenų lauką
getBindPoint(AnimationNode anim, boolean create)BindPointGrąžina animacijos susiejimo tašką šiai savybei nurodytame AnimationNode; praeiti true sukurti, jei nėra
getKeyframeSequence(AnimationNode anim, boolean create)KeyframeSequenceGrąžina raktų kadro seką šiai savybei nurodytame AnimationNode

Example

import com.aspose.threed.Scene;
import com.aspose.threed.Node;
import com.aspose.threed.Property;
import com.aspose.threed.PropertyCollection;

Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("tagged_node");

// Access the property collection
PropertyCollection props = node.getProperties();

// Get a property by name (read raw value)
Object val = node.getProperty("name");
System.out.println(val);   // "tagged_node"

// Find a property object
Property prop = node.findProperty("name");
if (prop != null) {
    System.out.println(prop.getName());         // "name"
    System.out.println(prop.getValue());        // "tagged_node"
    System.out.println(prop.getValueType());    // class java.lang.String
}

// Enumerate all properties
for (Property p : props) {
    System.out.println("  " + p.getName() + " = " + p.getValue());
}

// Store a custom value on a property (extra metadata)
if (prop != null) {
    prop.setExtra("ui_label", "Scene Origin Node");
    Object label = prop.getExtra("ui_label");
    System.out.println(label);   // "Scene Origin Node"
}

Žr. taip pat

 Lietuvių