ColorComponent

This class represents the concept ColorComponent.

Class

class Appearance
class ColorComponent
   property B
      range double (64 bit), cardinality [1, 1]
   property G
      range double (64 bit), cardinality [1, 1]
   property R
      range double (64 bit), cardinality [1, 1]
   property W
      range double (64 bit), cardinality [1, 1]    

Example (based on pure API calls)

Here you can find code snippits that show how the API call ColorComponent can be used.

using RDF;      //  include at least engine.cs within your solution

public void CreateColorComnponent()
{
    Int64 model = RDF.engine.CreateModel();

    if (model != 0)
    {
        //
        //  Classes
        //
        Int64   classColor = RDF.engine.GetClassByName(model, "Color"),
                classColorComponent = RDF.engine.GetClassByName(model, "ColorComponent"),
                classCube = RDF.engine.GetClassByName(model, "Cube"),
                classMaterial = RDF.engine.GetClassByName(model, "Material");

        //
        //  Object Properties (relations)
        //
        Int64   propertyAmbient = RDF.engine.GetPropertyByName(model, "ambient"),
                propertyColor = RDF.engine.GetPropertyByName(model, "color"),
                propertyDiffuse = RDF.engine.GetPropertyByName(model, "diffuse"),
                propertyEmissive = RDF.engine.GetPropertyByName(model, "emissive"),
                propertyMaterial = RDF.engine.GetPropertyByName(model, "material"),
                propertySpecular = RDF.engine.GetPropertyByName(model, "specular");

        //
        //  Datatype Properties (attributes)
        //
        Int64   propertyB = RDF.engine.GetPropertyByName(model, "B"),
                propertyG = RDF.engine.GetPropertyByName(model, "G"),
                propertyLength = RDF.engine.GetPropertyByName(model, "length"),
                propertyR = RDF.engine.GetPropertyByName(model, "R"),
                propertyW = RDF.engine.GetPropertyByName(model, "W");

        //
        //  Instances (creating)
        //
        Int64   myInstanceColor = RDF.engine.CreateInstance(classColor, (string) null),
                myInstanceColorComponent = RDF.engine.CreateInstance(classColorComponent, (string) null),
                myInstanceCube = RDF.engine.CreateInstance(classCube, (string) null),
                myInstanceMaterial = RDF.engine.CreateInstance(classMaterial, (string) null);

        RDF.engine.SetObjectProperty(myInstanceColor, propertyAmbient, ref myInstanceColorComponent, 1);
        RDF.engine.SetObjectProperty(myInstanceColor, propertyDiffuse, ref myInstanceColorComponent, 1);
        RDF.engine.SetObjectProperty(myInstanceColor, propertyEmissive, ref myInstanceColorComponent, 1);
        RDF.engine.SetObjectProperty(myInstanceColor, propertySpecular, ref myInstanceColorComponent, 1);

        double  R = 0.0, G = 1.0, B = 0.0, W = 0.5;
        RDF.engine.SetDatatypeProperty(myInstanceColorComponent, propertyR, ref R, 1);
        RDF.engine.SetDatatypeProperty(myInstanceColorComponent, propertyG, ref G, 1);
        RDF.engine.SetDatatypeProperty(myInstanceColorComponent, propertyB, ref B, 1);
        RDF.engine.SetDatatypeProperty(myInstanceColorComponent, propertyW, ref W, 1);

        double  length = 1.8;       
        RDF.engine.SetDatatypeProperty(myInstanceCube, propertyLength, ref length, 1);
        RDF.engine.SetObjectProperty(myInstanceCube, propertyMaterial, ref myInstanceMaterial, 1);

        RDF.engine.SetObjectProperty(myInstanceMaterial, propertyColor, ref myInstanceColor, 1);
        
        //
        //  The resulting model can be viewed in 3D-Editor.exe
        //
        RDF.engine.SaveModel(model, "c:\\created\\myColorComponent.bin");
        RDF.engine.CloseModel(model);
    }
}