C++ Data Model draft implementation: 84/1884/3
Manuel Juliachs [Fri, 10 Sep 2010 15:30:43 +0000 (17:30 +0200)]
- N-gons and Polyline data classes mostly functional

-Stubs for the Triangle mesh and n-gons grid classes
 (no methods implemented yet)

Change-Id: Ib51d22296e7179411631c1e63df4dcbc5981dd3b

25 files changed:
scilab/modules/graphic_objects/Makefile.am
scilab/modules/graphic_objects/Makefile.in
scilab/modules/graphic_objects/includes/Data3D.hxx [new file with mode: 0644]
scilab/modules/graphic_objects/includes/DataController.hxx
scilab/modules/graphic_objects/includes/DataModel.hxx
scilab/modules/graphic_objects/includes/DataProperties.hxx [new file with mode: 0644]
scilab/modules/graphic_objects/includes/NgonData.hxx [new file with mode: 0644]
scilab/modules/graphic_objects/includes/NgonGeneralData.hxx [new file with mode: 0644]
scilab/modules/graphic_objects/includes/NgonGridData.hxx [new file with mode: 0644]
scilab/modules/graphic_objects/includes/NgonPolylineData.hxx [new file with mode: 0644]
scilab/modules/graphic_objects/includes/TriangleMeshData.hxx [new file with mode: 0644]
scilab/modules/graphic_objects/includes/graphicObjectProperties.h
scilab/modules/graphic_objects/src/c/graphic_objects.vcproj
scilab/modules/graphic_objects/src/cpp/Data3D.cpp [new file with mode: 0644]
scilab/modules/graphic_objects/src/cpp/NgonData.cpp [new file with mode: 0644]
scilab/modules/graphic_objects/src/cpp/NgonGeneralData.cpp [new file with mode: 0644]
scilab/modules/graphic_objects/src/cpp/NgonPolylineData.cpp [new file with mode: 0644]
scilab/modules/graphic_objects/src/cpp/createGraphicObject.cpp
scilab/modules/graphic_objects/src/cpp/dataModel.cpp
scilab/modules/graphic_objects/src/cpp/getGraphicObjectProperty.cpp
scilab/modules/graphic_objects/src/cpp/setGraphicObjectProperty.cpp
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/GraphicObjectProperties.java
scilab/modules/graphic_objects/src/scripts/propertiesMap.properties
scilab/modules/graphics/src/c/getHandleProperty/get_data_property.c
scilab/modules/graphics/src/c/getHandleProperty/set_data_property.c

index 00f292e..d19c89c 100644 (file)
@@ -37,7 +37,12 @@ GRAPHIC_OBJECTS_CPP_SOURCES =        src/cpp/createGraphicObject.cpp \
                                                                src/cpp/getGraphicObjectProperty.cpp \
                                                                src/cpp/setGraphicObjectProperty.cpp \
                                                                src/cpp/deleteGraphicObject.cpp \
-                                                               src/cpp/dataModel.cpp
+                                                               src/cpp/dataModel.cpp \
+                                                               src/cpp/Data3D.cpp \
+                                                               src/cpp/NgonData.cpp \
+                                                               src/cpp/NgonGeneralData.cpp \
+                                                               src/cpp/NgonPolylineData.cpp
+
 
 GIWS_WRAPPERS = src/jni/graphic_objects.giws.xml
 
@@ -115,4 +120,4 @@ includes/graphicObjectsProperties.h: Makefile.am src/scripts/propertiesMap.prope
        @$(top_srcdir)/modules/graphic_objects/src/scripts/genPropertiesName.sh --java $(top_srcdir)/modules/graphic_objects/src/scripts/propertiesMap.properties $(top_srcdir)/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/GraphicObjectProperties.java
 if GUI
 USEANT=1
-endif
\ No newline at end of file
+endif
index 3d1423f..c80dcef 100644 (file)
@@ -140,7 +140,11 @@ am__objects_6 = libscigraphic_objects_la-createGraphicObject.lo \
        libscigraphic_objects_la-getGraphicObjectProperty.lo \
        libscigraphic_objects_la-setGraphicObjectProperty.lo \
        libscigraphic_objects_la-deleteGraphicObject.lo \
-       libscigraphic_objects_la-dataModel.lo
+       libscigraphic_objects_la-dataModel.lo \
+       libscigraphic_objects_la-Data3D.lo \
+       libscigraphic_objects_la-NgonData.lo \
+       libscigraphic_objects_la-NgonGeneralData.lo \
+       libscigraphic_objects_la-NgonPolylineData.lo
 am_libscigraphic_objects_la_OBJECTS = $(am__objects_2) \
        $(am__objects_3) $(am__objects_4) $(am__objects_5) \
        $(am__objects_6)
@@ -513,7 +517,11 @@ GRAPHIC_OBJECTS_CPP_SOURCES = src/cpp/createGraphicObject.cpp \
                                                                src/cpp/getGraphicObjectProperty.cpp \
                                                                src/cpp/setGraphicObjectProperty.cpp \
                                                                src/cpp/deleteGraphicObject.cpp \
-                                                               src/cpp/dataModel.cpp
+                                                               src/cpp/dataModel.cpp \
+                                                               src/cpp/Data3D.cpp \
+                                                               src/cpp/NgonData.cpp \
+                                                               src/cpp/NgonGeneralData.cpp \
+                                                               src/cpp/NgonPolylineData.cpp
 
 GIWS_WRAPPERS = src/jni/graphic_objects.giws.xml
 GATEWAY_C_SOURCES = sci_gateway/c/gw_graphic_objects.c
@@ -642,6 +650,10 @@ distclean-compile:
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_disable_la-nographic_objects.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-CallGraphicController.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-Data3D.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-NgonData.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-NgonGeneralData.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-NgonPolylineData.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-createGraphicObject.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-dataModel.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigraphic_objects_la-deleteGraphicObject.Plo@am__quote@
@@ -755,6 +767,34 @@ libscigraphic_objects_la-dataModel.lo: src/cpp/dataModel.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_objects_la-dataModel.lo `test -f 'src/cpp/dataModel.cpp' || echo '$(srcdir)/'`src/cpp/dataModel.cpp
 
+libscigraphic_objects_la-Data3D.lo: src/cpp/Data3D.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigraphic_objects_la-Data3D.lo -MD -MP -MF $(DEPDIR)/libscigraphic_objects_la-Data3D.Tpo -c -o libscigraphic_objects_la-Data3D.lo `test -f 'src/cpp/Data3D.cpp' || echo '$(srcdir)/'`src/cpp/Data3D.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigraphic_objects_la-Data3D.Tpo $(DEPDIR)/libscigraphic_objects_la-Data3D.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/Data3D.cpp' object='libscigraphic_objects_la-Data3D.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_objects_la-Data3D.lo `test -f 'src/cpp/Data3D.cpp' || echo '$(srcdir)/'`src/cpp/Data3D.cpp
+
+libscigraphic_objects_la-NgonData.lo: src/cpp/NgonData.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigraphic_objects_la-NgonData.lo -MD -MP -MF $(DEPDIR)/libscigraphic_objects_la-NgonData.Tpo -c -o libscigraphic_objects_la-NgonData.lo `test -f 'src/cpp/NgonData.cpp' || echo '$(srcdir)/'`src/cpp/NgonData.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigraphic_objects_la-NgonData.Tpo $(DEPDIR)/libscigraphic_objects_la-NgonData.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/NgonData.cpp' object='libscigraphic_objects_la-NgonData.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_objects_la-NgonData.lo `test -f 'src/cpp/NgonData.cpp' || echo '$(srcdir)/'`src/cpp/NgonData.cpp
+
+libscigraphic_objects_la-NgonGeneralData.lo: src/cpp/NgonGeneralData.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigraphic_objects_la-NgonGeneralData.lo -MD -MP -MF $(DEPDIR)/libscigraphic_objects_la-NgonGeneralData.Tpo -c -o libscigraphic_objects_la-NgonGeneralData.lo `test -f 'src/cpp/NgonGeneralData.cpp' || echo '$(srcdir)/'`src/cpp/NgonGeneralData.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigraphic_objects_la-NgonGeneralData.Tpo $(DEPDIR)/libscigraphic_objects_la-NgonGeneralData.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/NgonGeneralData.cpp' object='libscigraphic_objects_la-NgonGeneralData.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_objects_la-NgonGeneralData.lo `test -f 'src/cpp/NgonGeneralData.cpp' || echo '$(srcdir)/'`src/cpp/NgonGeneralData.cpp
+
+libscigraphic_objects_la-NgonPolylineData.lo: src/cpp/NgonPolylineData.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigraphic_objects_la-NgonPolylineData.lo -MD -MP -MF $(DEPDIR)/libscigraphic_objects_la-NgonPolylineData.Tpo -c -o libscigraphic_objects_la-NgonPolylineData.lo `test -f 'src/cpp/NgonPolylineData.cpp' || echo '$(srcdir)/'`src/cpp/NgonPolylineData.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigraphic_objects_la-NgonPolylineData.Tpo $(DEPDIR)/libscigraphic_objects_la-NgonPolylineData.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/cpp/NgonPolylineData.cpp' object='libscigraphic_objects_la-NgonPolylineData.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigraphic_objects_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigraphic_objects_la-NgonPolylineData.lo `test -f 'src/cpp/NgonPolylineData.cpp' || echo '$(srcdir)/'`src/cpp/NgonPolylineData.cpp
+
 mostlyclean-libtool:
        -rm -f *.lo
 
diff --git a/scilab/modules/graphic_objects/includes/Data3D.hxx b/scilab/modules/graphic_objects/includes/Data3D.hxx
new file mode 100644 (file)
index 0000000..3643fa5
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifndef DATA_3D_H
+#define DATA_3D_H
+
+#include <string>
+
+#include "DataProperties.hxx"
+
+extern "C" {
+#include "BOOL.h"
+
+#include <stdio.h>
+}
+
+/**
+ * An abstract 3D data class
+ * To be completed
+ */
+
+class Data3D
+{
+protected:
+    /* To be added: a member indicating how color is specified (per-vertex or per-facet) */
+
+public :
+    Data3D(void);
+
+    virtual ~Data3D(void);
+
+    virtual int getPropertyFromName(char* propertyName) { return UNKNOWN_DATA_PROPERTY; }
+
+    virtual int setDataProperty(int property, void* value, int numElements);
+
+    virtual void* getDataProperty(int property);
+
+    virtual void setData(double* data, int numElements) { return; }
+
+    virtual void setDataX(double* data, int numElements) { return; }
+
+    virtual void setDataY(double* data, int numElements) { return; }
+
+    virtual void setDataZ(double* data, int numElements) { return; }
+
+    virtual double* getData(void) { return NULL; }
+
+    virtual double* getDataX(void) { return NULL; }
+
+    virtual double* getDataY(void) { return NULL; }
+
+    virtual double* getDataZ(void) { return NULL; }
+
+    virtual int setXCoordinatesShift(double* data, int numElements) { return 0; }
+
+    virtual double* getXCoordinatesShift(void) { return NULL; }
+
+    virtual int setYCoordinatesShift(double* data, int numElements) { return 0; }
+
+    virtual double* getYCoordinatesShift(void) { return NULL; }
+
+    virtual int setZCoordinatesShift(double* data, int numElements) { return 0; }
+
+    virtual double* getZCoordinatesShift(void) { return NULL; }
+
+    virtual int getNumElements(void) { return -1; }
+
+    virtual void setNumElements(int numElements) { return; }
+
+    int setNumElementsArray(int* numElementsArray) { return 0; }
+
+    virtual void setNumVerticesPerGon(int numVerticesPerGon) { return; }
+
+    virtual int getNumVerticesPerGon(void) { return 0; }
+
+    virtual void setNumGons(int numGons) { return; }
+
+    virtual int getNumGons(void) { return 0; }
+
+    virtual void setZCoordinatesSet(int zCoordinatesSet) { return; }
+
+    virtual int getZCoordinatesSet(void) { return 0; };
+
+    virtual int getXCoordinatesShiftSet(void) { return 0; }
+
+    virtual void setXCoordinatesShiftSet(int xShiftSet) { return; }
+
+    virtual int getYCoordinatesShiftSet(void) { return 0; }
+
+    virtual void setYCoordinatesShiftSet(int yShiftSet) { return; }
+
+    virtual int getZCoordinatesShiftSet(void) { return 0; }
+
+    virtual void setZCoordinatesShiftSet(int zShiftSet) { return; }
+};
+
+#endif
index 4286a9b..7a44f32 100644 (file)
@@ -20,13 +20,24 @@ class DataController
 {
 
 public :
-    static BOOL setGraphicObjectProperty(char *_pstID, double _dblValue)
+    static BOOL setGraphicObjectProperty(char *_pstID, char* _pstName, void* _dblValue, int numElements)
     {
-        return DataModel::get()->setGraphicObjectProperty(_pstID, _dblValue);
+        return DataModel::get()->setGraphicObjectProperty(_pstID, _pstName, _dblValue, numElements);
     }
 
-    static double getGraphicObjectProperty(char *_pstID)
+    static void* getGraphicObjectProperty(char *_pstID, char* _pstName)
     {
-        return DataModel::get()->getGraphicObjectProperty(_pstID);
+        return DataModel::get()->getGraphicObjectProperty(_pstID, _pstName);
     }
+
+    static int getGraphicObjectIntProperty(char* _pstID, char* _pstName)
+    {
+        return DataModel::get()->getGraphicObjectIntProperty(_pstID, _pstName);
+    }
+
+    static char* createDataObject(char* _pstID, char* _sType)
+    {
+        return DataModel::get()->createDataObject(_pstID, _sType);
+    }
+
 };
index 62a2d8d..2e3d1b6 100644 (file)
  *
  */
 
+#ifndef DATA_MODEL_H
+#define DATA_MODEL_H
+
 #include <map>
 #include <string>
 
+#include "Data3D.hxx"
+
+#include "NgonGeneralData.hxx"
+#include "NgonGridData.hxx"
+#include "NgonPolylineData.hxx"
+#include "TriangleMeshData.hxx"
+
+#include "graphicObjectProperties.h"
+
 extern "C" {
 #include "BOOL.h"
+
+#include <stdio.h>
 }
 
 class DataModel
@@ -22,7 +36,7 @@ class DataModel
 private :
     DataModel()
     {
-        m_dataMap = new std::map<std::string, double>();
+        m_dataMap = new std::map<std::string, Data3D*>();
     }
 
 public :
@@ -37,18 +51,40 @@ public :
     }
 
 public :
-    BOOL setGraphicObjectProperty(char *_pstID, double _dblValue)
-    {
-        (*m_dataMap)[std::string(_pstID)] = _dblValue;
-        return TRUE;
-    }
+    /**
+     * Sets a graphic object property
+     * As some set methods allocate memory, the FALSE return value also indicates
+     * a failed allocation for these methods, which overlaps with the non-existing
+     * property return value (also FALSE); returning an int, with -1 for a failed
+     * allocation would possibly solve this problem.
+     */
+    BOOL setGraphicObjectProperty(char *_pstID, char* _pstName, void* _dblValue, int numElements);
 
-    double getGraphicObjectProperty(char *_pstID)
-    {
-        return (*m_dataMap)[std::string(_pstID)];
-    }
+    /** Returns a graphic object vector property */
+    void* getGraphicObjectProperty(char *_pstID, char* _pstName);
+
+    /**
+     * Returns a graphic object integer property
+     * Implemented in order to avoid returning the address of a
+     * static local variable across too many function calls (see the getProperty
+     * methods of the different Data classes when integer values are returned)
+     * Possibly redundant with getGraphicObjectProperty
+     */
+    int getGraphicObjectIntProperty(char *_pstID, char* _pstName);
+
+    /** Creates a data object */
+    char* createDataObject(char* _pstID, char* _sType);
+
+    /**
+     * Deletes a data object
+     * To be implemented
+     */
+    void deleteDataObject(char* _pstID);
 
 private :
     static DataModel *m_me;
-    std::map<std::string, double> *m_dataMap;
+
+    std::map<std::string, Data3D*> *m_dataMap;
 };
+
+#endif
diff --git a/scilab/modules/graphic_objects/includes/DataProperties.hxx b/scilab/modules/graphic_objects/includes/DataProperties.hxx
new file mode 100644 (file)
index 0000000..765e63d
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifndef DATA_PROPERTIES_H
+#define DATA_PROPERTIES_H
+
+/*
+ * Properties values
+ * A static enum would probably be better.
+ * To be modified.
+ */
+
+#define UNKNOWN_DATA_PROPERTY   0
+
+#define NUM_GONS                1
+#define NUM_VERTICES_PER_GON    2
+
+#define NUM_ELEMENTS            3
+#define NUM_ELEMENTS_ARRAY      4
+#define COORDINATES             5
+#define X_COORDINATES           6
+#define Y_COORDINATES           7
+#define Z_COORDINATES           8
+
+#define X_COORDINATES_SHIFT     9
+#define Y_COORDINATES_SHIFT     10
+#define Z_COORDINATES_SHIFT     11
+#define X_COORDINATES_SHIFT_SET 12
+#define Y_COORDINATES_SHIFT_SET 13
+#define Z_COORDINATES_SHIFT_SET 14
+#define Z_COORDINATES_SET       15
+
+
+
+#endif
diff --git a/scilab/modules/graphic_objects/includes/NgonData.hxx b/scilab/modules/graphic_objects/includes/NgonData.hxx
new file mode 100644 (file)
index 0000000..b12331e
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifndef NGON_DATA_H
+#define NGON_DATA_H
+
+#include <string>
+
+#include "Data3D.hxx"
+
+extern "C" {
+#include "BOOL.h"
+
+#include <stdio.h>
+}
+
+/**
+ * Abstract class for n-gon data
+ */
+
+class NgonData : public Data3D
+{
+protected :
+
+    /** The total number of n-gons */
+    int numGons;
+
+    /** The number of vertices making up a single n-gon */
+    int numVerticesPerGon;
+
+public :
+    NgonData(void);
+
+    ~NgonData(void);
+
+    /**
+     * Returns the value corresponding to a property name
+     */
+    int getPropertyFromName(char* propertyName);
+
+    /**
+     * Sets the data property
+     */
+    int setDataProperty(int property, void* value, int numElements);
+
+    /**
+     * Returns the data property
+     */
+    void* getDataProperty(int property);
+
+    /**
+     * Sets the number of n-gons
+     */
+    void setNumGons(int numGons);
+
+    /**
+     * Returns the number of n-gons
+     */
+    int getNumGons(void);
+
+    /**
+     * Sets the number of vertices making up a single n-gon
+     */
+    void setNumVerticesPerGon(int numVerticesPerGon);
+
+    /**
+     * Returns the number of vertices making up a single n-gon
+     */
+    int getNumVerticesPerGon(void);
+
+#if 0
+    virtual double* getData();
+
+    virtual void setData(double* data);
+#endif
+
+};
+
+#endif
diff --git a/scilab/modules/graphic_objects/includes/NgonGeneralData.hxx b/scilab/modules/graphic_objects/includes/NgonGeneralData.hxx
new file mode 100644 (file)
index 0000000..bd7617f
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifndef NGON_GENERAL_DATA_H
+#define NGON_GENERAL_DATA_H
+
+#include <string>
+
+#include "NgonData.hxx"
+
+extern "C" {
+#include "BOOL.h"
+
+#include <stdio.h>
+}
+
+/**
+ * General n-gon data class
+ */
+
+class NgonGeneralData : public NgonData
+{
+private :
+
+
+    /** The x coordinates array */
+    double* xCoordinates;
+
+    /** The y coordinates array */
+    double* yCoordinates;
+
+    /** The z coordinates array */
+    double* zCoordinates;
+
+    /** The array of color values */
+    double* colorValues;
+
+protected : 
+    /** The coordinates array */
+    double* coordinates;
+
+public :
+    NgonGeneralData(void);
+
+    virtual ~NgonGeneralData(void);
+
+    int getPropertyFromName(char* propertyName);
+
+    int setDataProperty(int property, void* value, int numElements);
+
+    void* getDataProperty(int property);
+
+    /**
+     * Returns the data coordinates array
+     */
+    double* getData();
+
+    /**
+     * Returns the data x coordinates array
+     */
+    double* getDataX(void);
+
+    /**
+     * Returns the data y coordinates array
+     */
+    double* getDataY(void);
+
+    /**
+     * Returns the data z coordinates array
+     */
+    double* getDataZ(void);
+
+    /**
+     * Sets the coordinates data
+     * @param data the data (3 * numElements values)
+     * @param numElements the number of points in the data array ( #n-gons * #vertices per n-gon)
+     */
+    void setData(double* data, int numElements);
+
+    /**
+     * Sets the x coordinates data
+     * @param data the data (numElements values)
+     * @param numElements the number of points in the data array ( #n-gons * #vertices per n-gon)
+     */
+    void setDataX(double* data, int numElements);
+
+    /**
+     * Sets the y coordinates data
+     * @param data the data (numElements values)
+     * @param numElements the number of points in the data array ( #n-gons * #vertices per n-gon)
+     */
+    void setDataY(double* data, int numElements);
+
+    /**
+     * Sets the z coordinates data
+     * @param data the data (numElements values)
+     * @param numElements the number of points in the data array ( #n-gons * #vertices per n-gon)
+     */
+    void setDataZ(double* data, int numElements);
+
+    /**
+     * Returns the number of elements (number of n-gons)
+     */
+    int getNumElements(void);
+
+    /**
+     * Sets the number of elements (number of n-gons)
+     * Incorrectly implemented for now.
+     * setNumElementsArray must be used instead.
+     */
+    void setNumElements(int numElements);
+
+    /**
+     * Sets the number of elements (number of n-gons and
+     * the number of vertices per n-gon)
+     * Resizes the data coordinates array if required, must therefore
+     * be called any setData* call.
+     * @param numElementsArray 2-element array (# n-gons, # vertices per n-gon)
+     * @return 1 if it succeeded, 0 if the allocation failed
+     */
+    int setNumElementsArray(int* numElementsArray);
+
+    /**
+     * Returns the color values array
+     * To be implemented
+     */
+    double* getColors(void);
+
+    /**
+     * Sets the color values array
+     * To be implemented
+     */
+    void setColors(double* colors, int numElements);
+};
+
+#endif
diff --git a/scilab/modules/graphic_objects/includes/NgonGridData.hxx b/scilab/modules/graphic_objects/includes/NgonGridData.hxx
new file mode 100644 (file)
index 0000000..65459d6
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifndef NGON_GRID_DATA_H
+#define NGON_GRID_DATA_H
+
+#include <string>
+
+#include "NgonData.hxx"
+
+extern "C" {
+#include "BOOL.h"
+
+#include <stdio.h>
+}
+
+/**
+ * n-gons grid data stub class
+ * To be fully implemented
+ */
+
+class NgonGridData : public NgonData
+{
+private :
+
+    /** The x coordinates array */
+    double* xCoordinates;
+
+    /** The y coordinates array */
+    double* yCoordinates;
+
+    /** The z coordinates array */
+    double* zCoordinates;
+
+    /** The grid x size */
+    int xSize;
+
+    /** The grid y size */
+    int ySize;
+
+public :
+    /* To be implemented */
+    NgonGridData(void)
+    {
+        numGons = 0;
+        numVerticesPerGon = 0;
+
+        xCoordinates = NULL;
+        yCoordinates = NULL;
+        zCoordinates = NULL;
+
+        xSize = 0;
+        ySize = 0;
+    }
+
+    /* To be implemented */
+    double* getData()
+    {
+        return zCoordinates;
+    }
+
+    /* To be implemented */
+    void setData(double* data)
+    {
+
+    }
+
+};
+
+#endif
diff --git a/scilab/modules/graphic_objects/includes/NgonPolylineData.hxx b/scilab/modules/graphic_objects/includes/NgonPolylineData.hxx
new file mode 100644 (file)
index 0000000..74a21f2
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifndef NGON_POLYLINE_DATA_H
+#define NGON_POLYLINE_DATA_H
+
+#include <string>
+
+#include "NgonGeneralData.hxx"
+
+extern "C" {
+#include "BOOL.h"
+
+#include <stdio.h>
+}
+
+/**
+ * A class for polyline data
+ */
+
+class NgonPolylineData : public NgonGeneralData
+{
+private :
+
+    /** Specifies whether zCoordinates have been set */
+    int zCoordinatesSet;
+
+    /** The x-shift coordinates array */
+    double* xShift;
+
+    /** The y-shift coordinates array */
+    double* yShift;
+
+    /** The z-shift coordinates array */
+    double* zShift;
+
+    /** Specifies whether xShift coordinates have been set */
+    int xShiftSet;
+
+    /** Specifies whether yShift coordinates have been set */
+    int yShiftSet;
+
+    /** Specifies whether zShift coordinates have been set */
+    int zShiftSet;
+
+    /** The coordinates shift array */
+    double* coordinatesShift;
+
+public :
+    NgonPolylineData(void);
+
+    virtual ~NgonPolylineData(void);
+
+    int getPropertyFromName(char* propertyName);
+
+    int setDataProperty(int property, void* value, int numElements);
+
+    void* getDataProperty(int property);
+
+    /**
+     * Returns the number of elements (number of vertices making up the polyline)
+     */
+    int getNumElements(void);
+
+    /**
+     * Returns the z coordinates flag
+     */
+    int getZCoordinatesSet(void);
+
+    /**
+     * Sets the z coordinates flag
+     */
+    void setZCoordinatesSet(int zCoordinatesSet);
+
+    /**
+     * Returns the x coordinates shift array
+     */
+    double* getXCoordinatesShift(void);
+
+    /**
+     * Sets the x coordinates shift array
+     * Resizes it if required.
+     * @param data the x shift array (numElements values)
+     * @param numElements the number of elements in the array
+     */
+    int setXCoordinatesShift(double* data, int numElements);
+
+    /**
+     * Returns the y coordinates shift array
+     */
+    double* getYCoordinatesShift();
+
+    /**
+     * Sets the y coordinates shift array
+     * Resizes it if required.
+     * @param data the y shift array (numElements values)
+     * @param numElements the number of elements in the array
+     */
+    int setYCoordinatesShift(double* data, int numElements);
+
+    /**
+     * Returns the z coordinates shift array
+     */
+    double* getZCoordinatesShift();
+
+    /**
+     * Sets the z coordinates shift array
+     * Resizes it if required.
+     * @param data the z shift array (numElements values)
+     * @param numElements the number of elements in the array
+     */
+    int setZCoordinatesShift(double* data, int numElements);
+
+    /**
+     * Returns the x coordinates shift array flag
+     */
+    int getXCoordinatesShiftSet(void);
+
+    /**
+     * Sets the x coordinates shift array flag
+     * Deletes it if xShiftSet equal to 0
+     */
+    void setXCoordinatesShiftSet(int xShiftSet);
+
+    /**
+     * Returns the y coordinates shift array flag
+     */
+    int getYCoordinatesShiftSet(void);
+
+    /**
+     * Sets the y coordinates shift array flag
+     * Deletes it if yShiftSet equal to 0
+     */
+    void setYCoordinatesShiftSet(int yShiftSet);
+
+    /**
+     * Returns the z coordinates shift array flag
+     */
+    int getZCoordinatesShiftSet(void);
+
+    /**
+     * Sets the z coordinates shift array flag
+     * Deletes it if zShiftSet equal to 0
+     */
+    void setZCoordinatesShiftSet(int zShiftSet);
+
+    /**
+     * Sets the number of elements composing the polyline
+     * (i.e. the number of vertices per gon)
+     * Updates the coordinates shift arrays if required.
+     * The latter probably ought to be done in one of the
+     * Data set methods.
+     * @param numElementsArray a 2-element array (always 1, #vertices)
+     */
+    int setNumElementsArray(int* numElementsArray);
+
+    /**
+     * Copies the former shift coordinates array into the new one
+     * and pads with zeroes if the new number of elements exceeds
+     * the former one.
+     * @param newShift the new shift coordinates array
+     * @param oldShift the former shift coordinates array
+     */
+    void copyShiftCoordinatesArray(double* newShift, double* oldShift, int numElementsNew);
+
+    /**
+     * Deletes the coordinates and shift arrays
+     */
+    void deleteCoordinatesArrays(void);
+};
+
+#endif
diff --git a/scilab/modules/graphic_objects/includes/TriangleMeshData.hxx b/scilab/modules/graphic_objects/includes/TriangleMeshData.hxx
new file mode 100644 (file)
index 0000000..e70a8da
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifndef TRIANGLE_MESH_DATA_H
+#define TRIANGLE_MESH_DATA_H
+
+#include <string>
+
+#include "Data3D.hxx"
+
+extern "C" {
+#include "BOOL.h"
+
+#include <stdio.h>
+}
+
+/**
+ * Triangle mesh data stub class
+ * To be fully implemented
+ */
+
+class TriangleMeshData : public Data3D
+{
+
+private :
+
+    /** Vertex coordinates array */
+    double* vertices;
+
+    /** Triangle indices array */
+    unsigned int* indices;
+
+    /** Number of vertices */
+    unsigned int numberVertices;
+
+    /** Number of triangles */
+    unsigned int numberTriangles;
+
+public :
+    TriangleMeshData(void)
+    {
+        vertices = NULL;
+        indices = NULL;
+
+        numberVertices = 0;
+        numberTriangles = 0;
+    }
+
+    /* To be implemented */
+    TriangleMeshData(unsigned int numberVertices, unsigned int numberTriangles)
+    {
+       vertices = new double[3*numberVertices];
+
+        indices = new unsigned int[3*numberTriangles];
+
+        this->numberVertices = numberVertices;
+        this->numberTriangles = numberTriangles;
+    }
+
+    double* getData(void)
+    {
+        return vertices;
+    }
+
+    unsigned int* getIndices(void)
+    {
+        return indices;
+    }
+
+    /* To be implemented */
+    void setData(double* data)
+    {
+
+    }
+
+    /* To be implemented */
+    void setIndices(unsigned int* indices)
+    {
+
+    }
+
+};
+
+#endif
index 94c4e4f..9842162 100644 (file)
 #define __GO_USER_DATA_SIZE__              "UserDataSize"
 #define __GO_VISIBLE__                     "Visible"
 #define __GO_TYPE__                        "Type"
-#define __GO_DATA__                        "Data"
+#define __GO_DATA_MODEL__                  "DataModel"
+
+#define __GO_DATA_MODEL_COORDINATES__                 "DataModelCoordinates"
+#define __GO_DATA_MODEL_X__                               "DataModelX"
+#define __GO_DATA_MODEL_Y__                           "DataModelY"
+#define __GO_DATA_MODEL_Z__                           "DataModelZ"
+
+#define __GO_DATA_MODEL_X_COORDINATES_SHIFT__          "DataModelXCoordinatesShift"
+#define __GO_DATA_MODEL_Y_COORDINATES_SHIFT__          "DataModelYCoordinatesShift"
+#define __GO_DATA_MODEL_Z_COORDINATES_SHIFT__          "DataModelZCoordinatesShift"
+
+#define __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__      "DataModelXCoordinatesShiftSet"
+#define __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__      "DataModelYCoordinatesShiftSet"
+#define __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__      "DataModelZCoordinatesShiftSet"
+
+#define __GO_DATA_MODEL_NUM_ELEMENTS__             "DataModelNumElements"
+#define __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__           "DataModelNumElementsArray"
+#define __GO_DATA_MODEL_NUM_VERTICES_PER_GON__         "DataModelNumVerticesPerGon"
+#define __GO_DATA_MODEL_NUM_GONS__                     "DataModelNumGons"
+
+#define __GO_DATA_MODEL_Z_COORDINATES_SET__            "DataModelZCoordinatesSet"
+
+#define __GO_DATA_MODEL_COLORS__                       "DataModelColors"
+
+#define __GO_DATA_MODEL_INDICES__                      "DataModelIndices"
+
 #define __GO_REFERENCED__                  "Referenced"
 #define __GO_VALID__                       "Valid"
 
 #define __GO_ARROW_SIZE_FACTOR__           "ArrowSizeFactor"
 #define __GO_POLYLINE_STYLE__              "PolylineStyle"
 #define __GO_INTERP_COLOR_VECTOR__         "InterpColorVector"
+#define __GO_INTERP_COLOR_VECTOR_SET__         "InterpColorVectorSet"
 #define __GO_INTERP_COLOR_MODE__           "InterpColorMode"
 #define __GO_X_SHIFT__                     "XShift"
 #define __GO_Y_SHIFT__                     "YShift"
index 0e82e23..d1f663d 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath="..\cpp\Data3D.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\cpp\dataModel.cpp"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath="..\cpp\NgonData.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\cpp\NgonGeneralData.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\cpp\NgonPolylineData.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\..\sci_gateway\cpp\sci_graphicfunction.cpp"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath="..\..\includes\Data3D.hxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\includes\DataProperties.hxx"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\..\includes\dynlib_graphic_objects.h"
                                >
                        </File>
                                RelativePath="..\..\includes\gw_graphic_objects.h"
                                >
                        </File>
+                       <File
+                               RelativePath="..\..\includes\NgonData.hxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\includes\NgonGeneralData.hxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\includes\NgonGridData.hxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\includes\NgonPolylineData.hxx"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\includes\TriangleMeshData.hxx"
+                               >
+                       </File>
                </Filter>
                <Filter
                        Name="localization"
diff --git a/scilab/modules/graphic_objects/src/cpp/Data3D.cpp b/scilab/modules/graphic_objects/src/cpp/Data3D.cpp
new file mode 100644 (file)
index 0000000..8333ca2
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#include "Data3D.hxx"
+
+extern "C" {
+#include "BOOL.h"
+
+#include "graphicObjectProperties.h"
+}
+
+Data3D::Data3D(void)
+{
+
+}
+
+Data3D::~Data3D(void)
+{
+
+}
+
+int Data3D::setDataProperty(int property, void* value, int numElements)
+{
+    return 0;
+}
+
+void* Data3D::getDataProperty(int property)
+{
+    if (property == UNKNOWN_DATA_PROPERTY)
+    {
+        return NULL;
+    }
+    else
+    {
+        return NULL;
+    }
+}
+
diff --git a/scilab/modules/graphic_objects/src/cpp/NgonData.cpp b/scilab/modules/graphic_objects/src/cpp/NgonData.cpp
new file mode 100644 (file)
index 0000000..f208727
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#include "NgonData.hxx"
+#include "DataProperties.hxx"
+
+extern "C" {
+#include "BOOL.h"
+
+#include <string.h>
+
+#include "graphicObjectProperties.h"
+
+}
+
+NgonData::NgonData(void)
+{
+    numGons = 0;
+    numVerticesPerGon = 0;
+}
+
+/* To be implemented */
+NgonData::~NgonData(void)
+{
+
+}
+
+int NgonData::getPropertyFromName(char* propertyName)
+{
+
+    if (strcmp(propertyName, __GO_DATA_MODEL_NUM_GONS__) == 0)
+    {
+        return NUM_GONS;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_NUM_VERTICES_PER_GON__) == 0)
+    {
+        return NUM_VERTICES_PER_GON;
+    }
+    else
+    {
+         return Data3D::getPropertyFromName(propertyName);
+    }
+
+}
+
+int NgonData::setDataProperty(int property, void* value, int numElements)
+{
+
+    if (property == NUM_GONS)
+    {
+        setNumGons(*((int*) value));
+    }
+    else if (property == NUM_VERTICES_PER_GON)
+    {
+        setNumVerticesPerGon(*((int*) value));
+    }
+    else
+    {
+        return Data3D::setDataProperty(property, value, numElements);
+    }
+
+    return 1;
+}
+
+void* NgonData::getDataProperty(int property)
+{
+    /* Used for now to return the address of a single integer */
+    static int localIntResult;
+
+
+    if (property == NUM_GONS)
+    {
+        localIntResult = getNumGons();
+        return &localIntResult;
+    }
+    else if (property == NUM_VERTICES_PER_GON)
+    {
+        localIntResult = getNumVerticesPerGon();
+        return &localIntResult;
+    }
+    else
+    {
+        return Data3D::getDataProperty(property);
+    }
+
+}
+
+void NgonData::setNumGons(int numGons)
+{
+    this->numGons = numGons;
+}
+
+int NgonData::getNumGons(void)
+{
+    return numGons;
+}
+
+void NgonData::setNumVerticesPerGon(int numVerticesPerGon)
+{
+    this->numVerticesPerGon = numVerticesPerGon;
+}
+
+int NgonData::getNumVerticesPerGon(void)
+{
+    return numVerticesPerGon;
+}
+
diff --git a/scilab/modules/graphic_objects/src/cpp/NgonGeneralData.cpp b/scilab/modules/graphic_objects/src/cpp/NgonGeneralData.cpp
new file mode 100644 (file)
index 0000000..eb4127d
--- /dev/null
@@ -0,0 +1,284 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#include "NgonGeneralData.hxx"
+#include "DataProperties.hxx"
+
+extern "C" {
+#include "BOOL.h"
+
+#include <string.h>
+
+#include "graphicObjectProperties.h"
+}
+
+NgonGeneralData::NgonGeneralData(void)
+{
+    numGons = 0;
+    numVerticesPerGon = 0;
+
+    coordinates = NULL;
+
+    xCoordinates = NULL;
+    yCoordinates = NULL;
+    zCoordinates = NULL;
+
+    colorValues = NULL;
+}
+
+NgonGeneralData::~NgonGeneralData(void)
+{
+    /* To be fully implemented */
+
+    if (numGons*numVerticesPerGon > 0)
+    {
+        delete [] coordinates;
+    }
+}
+
+int NgonGeneralData::getPropertyFromName(char* propertyName)
+{
+
+    if (strcmp(propertyName, __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__) == 0)
+    {
+        return NUM_ELEMENTS_ARRAY;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_COORDINATES__) == 0)
+    {
+        return COORDINATES;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_X__) == 0)
+    {
+        return X_COORDINATES;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_Y__) == 0)
+    {
+        return Y_COORDINATES;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_Z__) == 0)
+    {
+        return Z_COORDINATES;
+    }
+    else
+    {
+        NgonData::getPropertyFromName(propertyName);
+    }
+
+}
+
+int NgonGeneralData::setDataProperty(int property, void* value, int numElements)
+{
+
+    if (property == NUM_ELEMENTS_ARRAY)
+    {
+        return setNumElementsArray((int*) value);
+    }
+    else if (property == COORDINATES)
+    {
+        setData((double*) value, numElements); 
+    }
+    else if (property == X_COORDINATES)
+    {
+        setDataX((double*) value, numElements);
+    }
+    else if (property == Y_COORDINATES)
+    {
+        setDataY((double*) value, numElements);
+    }
+    else if (property == Z_COORDINATES)
+    {
+        setDataZ((double*) value, numElements);
+    }
+    else
+    {
+        return NgonData::setDataProperty(property, value, numElements);
+    }
+
+    return 1;
+}
+
+void* NgonGeneralData::getDataProperty(int property)
+{
+    /* Used for now to return the address of a single integer */
+    static int localIntResult;
+
+    if (property == NUM_ELEMENTS_ARRAY)
+    {
+          /* Not implemented yet */
+    //    getNumElementsArray();
+    }
+    else if (property == COORDINATES)
+    {
+        return getData();
+    }
+    else if (property == X_COORDINATES)
+    {
+        return getDataX();
+    }
+    else if (property == Y_COORDINATES)
+    {
+        return getDataY();
+    }
+    else if (property == Z_COORDINATES)
+    {
+        return getDataZ();
+    }
+    else
+    {
+        return NgonData::getDataProperty(property);
+    }
+
+}
+
+double* NgonGeneralData::getData()
+{
+    return coordinates;
+}
+
+double* NgonGeneralData::getDataX(void)
+{
+
+    return coordinates;
+}
+
+double* NgonGeneralData::getDataY(void)
+{
+    return &coordinates[numGons*numVerticesPerGon];
+}
+
+double* NgonGeneralData::getDataZ(void)
+{
+    return &coordinates[2*numGons*numVerticesPerGon];
+}
+
+/*
+ * Only partially implemented
+ * Must be made consistent with setNumElementsArray
+ */
+void NgonGeneralData::setData(double* data, int numElements)
+{
+    if (numElements != numGons*numVerticesPerGon)
+    {
+        delete [] coordinates;
+
+        coordinates = new double[3*numElements];
+    }
+
+    for (int i = 0; i < 3*numElements; i++)
+    {
+        coordinates[i] = data[i];
+    }
+}
+
+void NgonGeneralData::setDataX(double* data, int numElements)
+{
+    double* xCoordinates;
+
+    xCoordinates = coordinates;
+
+    for (int i = 0; i < numElements; i++)
+    {
+        xCoordinates[i] = data[i];
+    } 
+
+}
+
+void NgonGeneralData::setDataY(double* data, int numElements)
+{
+    double* yCoordinates;
+
+    yCoordinates = &coordinates[numGons*numVerticesPerGon];
+
+    for (int i = 0; i < numElements; i++)
+    {
+        yCoordinates[i] = data[i];
+    } 
+
+}
+
+void NgonGeneralData::setDataZ(double* data, int numElements)
+{
+    double* zCoordinates;
+
+
+    zCoordinates = &coordinates[2*numGons*numVerticesPerGon];
+
+    for (int i = 0; i < numElements; i++)
+    {
+        zCoordinates[i] = data[i];
+    }
+
+}
+
+int NgonGeneralData::getNumElements(void)
+{
+    return numGons;
+}
+
+void NgonGeneralData::setNumElements(int numElements)
+{
+    if (numElements !=  numGons * numVerticesPerGon)
+    {
+
+        delete [] xCoordinates;
+        delete [] yCoordinates;
+        delete [] zCoordinates;
+
+        xCoordinates = new double[numElements];
+        yCoordinates = new double[numElements];
+        zCoordinates = new double[numElements];
+    }
+}
+
+int NgonGeneralData::setNumElementsArray(int* numElementsArray)
+{
+
+    if (numGons*numVerticesPerGon != numElementsArray[0]*numElementsArray[1])
+    {
+        double* newCoordinates;
+
+
+        try {
+            newCoordinates = new double[3*numElementsArray[0]*numElementsArray[1]];
+        }
+        catch (const std::exception& e)
+        {
+            return 0;
+        }
+
+        if (numGons*numVerticesPerGon > 0)
+        {
+            delete [] coordinates;
+        }
+
+        coordinates = newCoordinates;
+
+    }
+
+    numGons = numElementsArray[0];
+    numVerticesPerGon = numElementsArray[1];
+
+    return 1;
+}
+
+/* To be implemented */
+double* NgonGeneralData::getColors(void)
+{
+    return NULL;
+}
+
+/* To be implemented */
+void NgonGeneralData::setColors(double* colors, int numElements)
+{
+
+}
+
diff --git a/scilab/modules/graphic_objects/src/cpp/NgonPolylineData.cpp b/scilab/modules/graphic_objects/src/cpp/NgonPolylineData.cpp
new file mode 100644 (file)
index 0000000..ae69555
--- /dev/null
@@ -0,0 +1,544 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2010 - DIGITEO - Manuel Juliachs
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#include "NgonPolylineData.hxx"
+#include "DataProperties.hxx"
+
+extern "C" {
+#include "BOOL.h"
+
+#include <string.h>
+
+#include "graphicObjectProperties.h"
+}
+
+NgonPolylineData::NgonPolylineData(void)
+{
+    xShift = NULL;
+    yShift = NULL;
+    zShift = NULL;
+
+    xShiftSet = 0;
+    yShiftSet = 0;
+    zShiftSet = 0;
+
+    coordinatesShift = NULL;
+
+    zCoordinatesSet = 0;
+}
+
+NgonPolylineData::~NgonPolylineData(void)
+{
+    if (xShiftSet)
+    {
+        delete [] xShift;
+    }
+
+    if (yShiftSet)
+    {
+        delete [] yShift;
+    }
+
+    if (zShiftSet)
+    {
+        delete [] zShift;
+    }
+}
+
+int NgonPolylineData::getPropertyFromName(char* propertyName)
+{
+
+    if (strcmp(propertyName, __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__) == 0)
+    {
+        return NUM_ELEMENTS_ARRAY;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_X_COORDINATES_SHIFT__) == 0)
+    {
+        return X_COORDINATES_SHIFT;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_Y_COORDINATES_SHIFT__) == 0)
+    {
+        return Y_COORDINATES_SHIFT;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_Z_COORDINATES_SHIFT__) == 0)
+    {
+        return Z_COORDINATES_SHIFT;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_NUM_ELEMENTS__) == 0)
+    {
+        return NUM_ELEMENTS;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__) == 0)
+    {
+        return X_COORDINATES_SHIFT_SET;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__) == 0)
+    {
+        return Y_COORDINATES_SHIFT_SET;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__) == 0)
+    {
+        return Z_COORDINATES_SHIFT_SET;
+    }
+    else if (strcmp(propertyName, __GO_DATA_MODEL_Z_COORDINATES_SET__) == 0)
+    {
+        return Z_COORDINATES_SET;
+    }
+    else
+    {
+        NgonGeneralData::getPropertyFromName(propertyName);
+    }
+
+}
+
+
+int NgonPolylineData::setDataProperty(int property, void* value, int numElements)
+{
+
+    if (property == NUM_ELEMENTS_ARRAY)
+    {
+        return setNumElementsArray((int*) value);
+    }
+    else if (property == X_COORDINATES_SHIFT)
+    {
+        return setXCoordinatesShift((double*) value, numElements);
+    }
+    else if (property == Y_COORDINATES_SHIFT)
+    {
+        return setYCoordinatesShift((double*) value, numElements);
+    }
+    else if (property == Z_COORDINATES_SHIFT)
+    {
+        return setZCoordinatesShift((double*) value, numElements);
+    }
+    else if (property == X_COORDINATES_SHIFT_SET)
+    {
+        setXCoordinatesShiftSet(*((int*) value));
+    }
+    else if (property == Y_COORDINATES_SHIFT_SET)
+    {
+        setYCoordinatesShiftSet(*((int*) value));
+    }
+    else if (property == Z_COORDINATES_SHIFT_SET)
+    {
+        setZCoordinatesShiftSet(*((int*) value));
+    }
+    else if (property == Z_COORDINATES_SET)
+    {
+        setZCoordinatesSet(*((int*) value));
+    }
+    else
+    {
+        return NgonGeneralData::setDataProperty(property, value, numElements);
+    }
+
+    return 1;
+}
+
+void* NgonPolylineData::getDataProperty(int property)
+{
+    /* Used for now to return the address of a single integer */
+    static int localIntResult;
+
+    if (property == X_COORDINATES_SHIFT)
+    {
+        return getXCoordinatesShift();
+    }
+    else if (property == Y_COORDINATES_SHIFT)
+    {
+        return getYCoordinatesShift();
+    }
+    else if (property == Z_COORDINATES_SHIFT)
+    {
+        return getZCoordinatesShift();
+    }
+    else if (property == NUM_ELEMENTS)
+    {
+        localIntResult = getNumElements();
+        return &localIntResult;
+    }
+    else if (property == X_COORDINATES_SHIFT_SET)
+    {
+        localIntResult = getXCoordinatesShiftSet();
+        return &localIntResult;
+    }
+    else if (property == Y_COORDINATES_SHIFT_SET)
+    {
+        localIntResult = getYCoordinatesShiftSet();
+        return &localIntResult;
+    }
+    else if (property == Z_COORDINATES_SHIFT_SET)
+    {
+        localIntResult = getZCoordinatesShiftSet();
+        return &localIntResult;
+    }
+    else if (property == Z_COORDINATES_SET)
+    {
+        localIntResult = getZCoordinatesSet();
+        return &localIntResult;
+    }
+    else
+    {
+        return NgonGeneralData::getDataProperty(property);
+    }
+
+}
+
+int NgonPolylineData::getNumElements(void)
+{
+    return numVerticesPerGon;
+}
+
+void NgonPolylineData::setZCoordinatesSet(int zCoordinatesSet)
+{
+    this->zCoordinatesSet = zCoordinatesSet;
+}
+
+int NgonPolylineData::getZCoordinatesSet(void)
+{
+    return this->zCoordinatesSet;
+}
+
+double* NgonPolylineData::getXCoordinatesShift(void)
+{
+    return xShift;
+}
+
+int NgonPolylineData::setXCoordinatesShift(double* data, int numElements)
+{
+    if (xShiftSet == 0)
+    {
+
+        try
+        {
+            xShift = new double[numVerticesPerGon];
+        }
+        catch (const std::exception& e)
+        {
+            return 0;
+        }
+
+        xShiftSet = 1;
+    }
+
+    for (int i = 0; i < numVerticesPerGon; i++)
+    {
+        xShift[i] = data[i];
+    }
+
+    return 1;
+}
+
+double* NgonPolylineData::getYCoordinatesShift()
+{
+    return yShift;
+}
+
+int NgonPolylineData::setYCoordinatesShift(double* data, int numElements)
+{
+    if (yShiftSet == 0)
+    {
+
+        try
+        {
+            yShift = new double[numVerticesPerGon];
+        }
+        catch (const std::exception& e)
+        {
+            return 0;
+        }
+
+        yShiftSet = 1;
+    }
+
+    for (int i = 0; i < numVerticesPerGon; i++)
+    {
+        yShift[i] = data[i];
+    }
+
+    return 1;
+}
+
+double* NgonPolylineData::getZCoordinatesShift()
+{
+    return zShift;
+}
+
+int NgonPolylineData::getXCoordinatesShiftSet(void)
+{
+    return xShiftSet;
+}
+
+void NgonPolylineData::setXCoordinatesShiftSet(int xShiftSet)
+{
+    if (xShiftSet == 0 && this->xShiftSet == 1)
+    {
+        delete [] xShift;
+        xShift = NULL;
+    }
+
+    this->xShiftSet = xShiftSet;
+}
+
+int NgonPolylineData::getYCoordinatesShiftSet(void)
+{
+    return yShiftSet;
+}
+
+void NgonPolylineData::setYCoordinatesShiftSet(int yShiftSet)
+{
+    if (yShiftSet == 0 && this->yShiftSet == 1)
+    {
+        delete [] yShift;
+        yShift = NULL;
+    }
+
+    this->yShiftSet = yShiftSet;
+}
+
+int NgonPolylineData::getZCoordinatesShiftSet(void)
+{
+    return zShiftSet;
+}
+
+void NgonPolylineData::setZCoordinatesShiftSet(int zShiftSet)
+{
+    if (zShiftSet == 0 && this->zShiftSet == 1)
+    {
+        delete [] zShift;
+        zShift = NULL;
+    }
+
+    this->zShiftSet = zShiftSet;
+}
+
+int NgonPolylineData::setZCoordinatesShift(double* data, int numElements)
+{
+    if (zShiftSet == 0)
+    {
+
+        try
+        {
+            zShift = new double[numVerticesPerGon];
+        }
+        catch (const std::exception& e)
+        {
+            return 0;
+        }
+
+        zShiftSet = 1;
+    }
+
+    for (int i = 0; i < numVerticesPerGon; i++)
+    {
+        zShift[i] = data[i];
+    }
+
+    return 1;
+}
+
+int NgonPolylineData::setNumElementsArray(int* numElementsArray)
+{
+    int newNumElements;
+    int previousNumElements;
+    int result;
+
+    result = 1;
+
+    if (numElementsArray[0] != 1)
+    {
+        return 0;
+    }
+
+    newNumElements = numElementsArray[0]*numElementsArray[1];
+    previousNumElements = numGons*numVerticesPerGon;
+
+    if (newNumElements == 0 && previousNumElements > 0)
+    {
+        numVerticesPerGon = 0;
+
+        deleteCoordinatesArrays();
+
+        return 1;
+    }
+
+    if (numGons*numVerticesPerGon != newNumElements)
+    {
+        double* newCoordinates = NULL;
+        double* xShiftNew = NULL;
+        double* yShiftNew = NULL;
+        double* zShiftNew = NULL;
+
+        result = 1;
+
+        try {
+            newCoordinates = new double[3*newNumElements];
+        }
+        catch (const std::exception& e)
+        {
+            return 0;
+        }
+
+        if (xShiftSet)
+        {
+            try
+            {
+                xShiftNew = new double[newNumElements];
+            }
+            catch (const std::exception& e)
+            {
+                result = 0;
+            }
+        }
+
+        if (yShiftSet)
+        {
+            try
+            {
+                yShiftNew = new double[newNumElements];
+            }
+            catch (const std::exception& e)
+            {
+                result = 0;
+            }
+        }
+
+        if (zShiftSet)
+        {
+            try
+            {
+                zShiftNew = new double[newNumElements];
+            }
+            catch (const std::exception& e)
+            {
+                result = 0;
+            }
+        }
+
+        if (result)
+        {
+            if (numGons*numVerticesPerGon > 0)
+            {
+                delete [] coordinates;
+            }
+
+            coordinates = newCoordinates;
+
+            if (xShiftSet)
+            {
+                copyShiftCoordinatesArray(xShiftNew, xShift, newNumElements);
+                delete [] xShift;
+                xShift = xShiftNew;
+            }
+
+            if (yShiftSet)
+            {
+                copyShiftCoordinatesArray(yShiftNew, yShift, newNumElements);
+                delete [] yShift;
+                yShift = yShiftNew;
+            }
+
+            if (zShiftSet)
+            {
+                copyShiftCoordinatesArray(zShiftNew, zShift, newNumElements);
+                delete [] zShift;
+                zShift = zShiftNew;
+            }
+
+            numGons = numElementsArray[0];
+            numVerticesPerGon = numElementsArray[1];
+        }
+        else
+        {
+            /* Delete the temporary arrays and don't set anything */
+            if (newCoordinates != NULL)
+            {
+                delete [] newCoordinates;
+            }
+
+            if (xShiftNew != NULL)
+            {
+                delete [] xShiftNew;
+            }
+
+            if (yShiftNew != NULL)
+            {
+                delete [] yShiftNew;
+            }
+
+            if (zShiftNew != NULL)
+            {
+                delete [] zShiftNew;
+            }
+
+        }
+
+    }
+
+    return result;
+}
+
+void NgonPolylineData::copyShiftCoordinatesArray(double* newShift, double* oldShift, int numElementsNew)
+{
+    int i;
+    int numElementsCopied;
+
+    if (numElementsNew < numVerticesPerGon)
+    {
+        numElementsCopied = numElementsNew;
+    }
+    else
+    {
+        numElementsCopied = numVerticesPerGon;
+    }
+
+    for (i = 0; i < numElementsCopied; i++)
+    {
+        newShift[i] = oldShift[i];
+    }
+
+    for (i = numElementsCopied; i < numElementsNew; i++)
+    {
+        newShift[i] = 0.0;
+    }
+}
+
+void NgonPolylineData::deleteCoordinatesArrays(void)
+{
+    if (coordinates != NULL)
+    {
+        delete [] coordinates;
+        coordinates = NULL;
+    }
+
+    if (xShiftSet)
+    {
+        delete [] xShift;
+        xShift = NULL;
+        xShiftSet = 0;
+    }
+
+    if (yShiftSet)
+    {
+        delete [] yShift;
+        yShift = NULL;
+        yShiftSet = 0;
+    }
+
+    if (zShiftSet)
+    {
+        delete [] zShift;
+        zShift = NULL;
+        zShiftSet = 0;
+    }
+}
+
index 4164fc2..4ad591d 100644 (file)
@@ -18,6 +18,8 @@ extern "C"
 
 #include "CallGraphicController.hxx"
 
+#include "DataController.hxx"
+
 using namespace org_scilab_modules_graphic_objects;
 
 char *createGraphicObject(char *_sType)
@@ -29,3 +31,9 @@ char *cloneGraphicObject(char *_sId)
 {
     return CallGraphicController::cloneGraphicObject(getScilabJavaVM(), _sId);
 }
+
+char* createDataObject(char* _sId, char* _sType)
+{
+    return DataController::createDataObject(_sId, _sType);
+}
+
index 88d011a..0a85f40 100644 (file)
 
 #include "DataModel.hxx"
 
+extern "C" {
+#include "BOOL.h"
+
+#include <string.h>
+}
+
 DataModel *DataModel::m_me = NULL;
+
+BOOL DataModel::setGraphicObjectProperty(char *_pstID, char* _pstName, void* _dblValue, int numElements)
+{
+    Data3D* dataObject;
+    int property;
+    int returnValue;
+
+    dataObject = (*m_dataMap)[std::string(_pstID)];
+
+    property = dataObject->getPropertyFromName(_pstName);
+
+    returnValue = dataObject->setDataProperty(property, _dblValue, numElements);
+
+    return returnValue;
+}
+
+void* DataModel::getGraphicObjectProperty(char *_pstID, char* _pstName)
+{
+    Data3D* dataObject;
+    int property;
+
+    dataObject = (*m_dataMap)[std::string(_pstID)];
+
+    property = dataObject->getPropertyFromName(_pstName);
+
+    return dataObject->getDataProperty(property);
+}
+
+int DataModel::getGraphicObjectIntProperty(char *_pstID, char* _pstName)
+{
+    int* tmpValue;
+
+    Data3D* dataObject;
+    int property;
+
+    property = (*m_dataMap)[std::string(_pstID)]->getPropertyFromName(_pstName);
+
+    dataObject = (*m_dataMap)[std::string(_pstID)];
+
+    property = dataObject->getPropertyFromName(_pstName);
+
+    tmpValue = (int*) dataObject->getDataProperty(property);
+
+    return *tmpValue;
+}
+
+char* DataModel::createDataObject(char* _pstID, char* _sType)
+{
+    Data3D* newObject;
+
+    /*
+     * To be implemented as the Java graphicObject class' similar function
+     * (getTypeFromName) in order to avoid strcmp calls.
+     */
+    if (strcmp(_sType, __GO_MATPLOT__) == 0)
+    {
+       newObject = new NgonGridData();
+    }
+    else if (strcmp(_sType, __GO_FAC3D__) == 0)
+    {
+        newObject = new NgonGeneralData();
+    }
+    else if (strcmp(_sType, __GO_PLOT3D__) == 0)
+    {
+        newObject = new NgonGridData();
+    }
+    else if (strcmp(_sType, __GO_POLYLINE__) == 0)
+    {
+        newObject = new NgonPolylineData();
+    }
+    else if (strcmp(_sType, __GO_FEC__) == 0)
+    {
+        newObject = new TriangleMeshData();
+    }
+    else
+    {
+        return NULL; 
+    }
+
+    (*m_dataMap)[std::string(_pstID)] = newObject;
+
+}
+
+/* To be implemented */
+void DataModel::deleteDataObject(char* _pstID)
+{
+
+}
+
+
+
index ae52533..d0ceaf4 100644 (file)
 extern "C"
 {
 #include <stdlib.h>
+#include <string.h>
 #include "getGraphicObjectProperty.h"
 #include "graphicObjectProperties.h"
 #include "getScilabJavaVM.h"
+
+#include <stdio.h>
 }
 
 #include "CallGraphicController.hxx"
@@ -31,10 +34,24 @@ void *getGraphicObjectProperty(char *_pstID, char *_pstName, _ReturnType_ _retur
     static int localBoolResult;
     static double localDoubleResult;
 
-    if (strcmp(_pstName, __GO_DATA__) == 0)
+    /* All the Data model properties have the DATA_MODEL prefix */
+    if (strncmp(_pstName, __GO_DATA_MODEL__, strlen(__GO_DATA_MODEL__)) == 0)
     {
-        localDoubleResult = DataController::getGraphicObjectProperty(_pstID);
-        return &localDoubleResult;
+       double* mydata;
+
+        switch(_returnType)
+        {
+        case jni_double_vector:
+            return DataController::getGraphicObjectProperty(_pstID, _pstName);
+        case jni_int:
+        {
+            localIntResult = (int) DataController::getGraphicObjectIntProperty(_pstID, _pstName);
+
+            return &localIntResult;
+        }
+        default:
+            return NULL;
+        }
     }
 
     switch(_returnType)
index 8a17d32..aca67b0 100644 (file)
@@ -15,6 +15,9 @@ extern "C"
 #include "setGraphicObjectProperty.h"
 #include "graphicObjectProperties.h"
 #include "getScilabJavaVM.h"
+
+#include <stdio.h>
+#include <string.h>
 }
 
 #include "CallGraphicController.hxx"
@@ -31,11 +34,11 @@ BOOL setGraphicObjectProperty(char *_pstID, char *_pstName, void *_pvValue, _Ret
     BOOL boolValue;
 
     // Special Case for data, no need to go through Java.
-    if (strcmp(_pstName, __GO_DATA__) == 0)
+    if (strncmp(_pstName, __GO_DATA_MODEL__, strlen(__GO_DATA_MODEL__)) == 0)
     {
-        doubleValue = *(double*)_pvValue;
-        result = DataController::setGraphicObjectProperty(_pstID, doubleValue);
-        return result;
+        result = DataController::setGraphicObjectProperty(_pstID, _pstName, _pvValue, numElements);
+
+        return booltoBOOL(result);
     }
 
     switch(_valueType)
index 92de520..e134641 100644 (file)
@@ -45,7 +45,32 @@ public static final String __GO_USER_DATA__ =              "UserData";
 public static final String __GO_USER_DATA_SIZE__ =         "UserDataSize";
 public static final String __GO_VISIBLE__ =                "Visible";
 public static final String __GO_TYPE__ =                   "Type";
-public static final String __GO_DATA__ =                   "Data";
+public static final String __GO_DATA_MODEL__ =             "DataModel";
+
+public static final String __GO_DATA_MODEL_COORDINATES__ =            "DataModelCoordinates";
+public static final String __GO_DATA_MODEL_X__ =                          "DataModelX";
+public static final String __GO_DATA_MODEL_Y__ =                      "DataModelY";
+public static final String __GO_DATA_MODEL_Z__ =                      "DataModelZ";
+
+public static final String __GO_DATA_MODEL_X_COORDINATES_SHIFT__ =     "DataModelXCoordinatesShift";
+public static final String __GO_DATA_MODEL_Y_COORDINATES_SHIFT__ =     "DataModelYCoordinatesShift";
+public static final String __GO_DATA_MODEL_Z_COORDINATES_SHIFT__ =     "DataModelZCoordinatesShift";
+
+public static final String __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__ = "DataModelXCoordinatesShiftSet";
+public static final String __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__ = "DataModelYCoordinatesShiftSet";
+public static final String __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__ = "DataModelZCoordinatesShiftSet";
+
+public static final String __GO_DATA_MODEL_NUM_ELEMENTS__ =        "DataModelNumElements";
+public static final String __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__ =      "DataModelNumElementsArray";
+public static final String __GO_DATA_MODEL_NUM_VERTICES_PER_GON__ =    "DataModelNumVerticesPerGon";
+public static final String __GO_DATA_MODEL_NUM_GONS__ =                "DataModelNumGons";
+
+public static final String __GO_DATA_MODEL_Z_COORDINATES_SET__ =       "DataModelZCoordinatesSet";
+
+public static final String __GO_DATA_MODEL_COLORS__ =                  "DataModelColors";
+
+public static final String __GO_DATA_MODEL_INDICES__ =                 "DataModelIndices";
+
 public static final String __GO_REFERENCED__ =             "Referenced";
 public static final String __GO_VALID__ =                  "Valid";
 
@@ -194,6 +219,7 @@ public static final String __GO_CLOSED__ =                 "Closed";
 public static final String __GO_ARROW_SIZE_FACTOR__ =      "ArrowSizeFactor";
 public static final String __GO_POLYLINE_STYLE__ =         "PolylineStyle";
 public static final String __GO_INTERP_COLOR_VECTOR__ =    "InterpColorVector";
+public static final String __GO_INTERP_COLOR_VECTOR_SET__ =    "InterpColorVectorSet";
 public static final String __GO_INTERP_COLOR_MODE__ =      "InterpColorMode";
 public static final String __GO_X_SHIFT__ =                "XShift";
 public static final String __GO_Y_SHIFT__ =                "YShift";
index 4bc4dc9..531ab35 100644 (file)
 @DECLARE@ __GO_USER_DATA_SIZE__ @EQUAL@         "UserDataSize" @END@
 @DECLARE@ __GO_VISIBLE__ @EQUAL@                "Visible" @END@
 @DECLARE@ __GO_TYPE__ @EQUAL@                   "Type" @END@
-@DECLARE@ __GO_DATA__ @EQUAL@                   "Data" @END@
+@DECLARE@ __GO_DATA_MODEL__ @EQUAL@             "DataModel" @END@
+
+@DECLARE@ __GO_DATA_MODEL_COORDINATES__ @EQUAL@            "DataModelCoordinates" @END@
+@DECLARE@ __GO_DATA_MODEL_X__ @EQUAL@                     "DataModelX" @END@
+@DECLARE@ __GO_DATA_MODEL_Y__ @EQUAL@                      "DataModelY" @END@
+@DECLARE@ __GO_DATA_MODEL_Z__ @EQUAL@                      "DataModelZ" @END@
+
+@DECLARE@ __GO_DATA_MODEL_X_COORDINATES_SHIFT__ @EQUAL@     "DataModelXCoordinatesShift" @END@
+@DECLARE@ __GO_DATA_MODEL_Y_COORDINATES_SHIFT__ @EQUAL@     "DataModelYCoordinatesShift" @END@
+@DECLARE@ __GO_DATA_MODEL_Z_COORDINATES_SHIFT__ @EQUAL@     "DataModelZCoordinatesShift" @END@
+
+@DECLARE@ __GO_DATA_MODEL_X_COORDINATES_SHIFT_SET__ @EQUAL@ "DataModelXCoordinatesShiftSet" @END@
+@DECLARE@ __GO_DATA_MODEL_Y_COORDINATES_SHIFT_SET__ @EQUAL@ "DataModelYCoordinatesShiftSet" @END@
+@DECLARE@ __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__ @EQUAL@ "DataModelZCoordinatesShiftSet" @END@
+
+@DECLARE@ __GO_DATA_MODEL_NUM_ELEMENTS__ @EQUAL@           "DataModelNumElements" @END@
+@DECLARE@ __GO_DATA_MODEL_NUM_ELEMENTS_ARRAY__ @EQUAL@      "DataModelNumElementsArray" @END@
+@DECLARE@ __GO_DATA_MODEL_NUM_VERTICES_PER_GON__ @EQUAL@    "DataModelNumVerticesPerGon" @END@
+@DECLARE@ __GO_DATA_MODEL_NUM_GONS__ @EQUAL@                "DataModelNumGons" @END@
+
+@DECLARE@ __GO_DATA_MODEL_Z_COORDINATES_SET__ @EQUAL@       "DataModelZCoordinatesSet" @END@
+
+@DECLARE@ __GO_DATA_MODEL_COLORS__ @EQUAL@                  "DataModelColors" @END@
+
+@DECLARE@ __GO_DATA_MODEL_INDICES__ @EQUAL@                 "DataModelIndices" @END@
+
 @DECLARE@ __GO_REFERENCED__ @EQUAL@             "Referenced" @END@
 @DECLARE@ __GO_VALID__ @EQUAL@                  "Valid" @END@
 
 @DECLARE@ __GO_ARROW_SIZE_FACTOR__ @EQUAL@      "ArrowSizeFactor" @END@
 @DECLARE@ __GO_POLYLINE_STYLE__ @EQUAL@         "PolylineStyle" @END@
 @DECLARE@ __GO_INTERP_COLOR_VECTOR__ @EQUAL@    "InterpColorVector" @END@
+@DECLARE@ __GO_INTERP_COLOR_VECTOR_SET__ @EQUAL@    "InterpColorVectorSet" @END@
 @DECLARE@ __GO_INTERP_COLOR_MODE__ @EQUAL@      "InterpColorMode" @END@
 @DECLARE@ __GO_X_SHIFT__ @EQUAL@                "XShift" @END@
 @DECLARE@ __GO_Y_SHIFT__ @EQUAL@                "YShift" @END@
index f9b19aa..77ea363 100644 (file)
@@ -156,7 +156,7 @@ int get3ddata(sciPointObj *pobj)
 /*------------------------------------------------------------------------*/
 int get_data_property( sciPointObj * pobj )
 {
-    double *pdblData = getGraphicObjectProperty(pobj->UID, __GO_DATA__, jni_double);
+    double *pdblData = getGraphicObjectProperty(pobj->UID, __GO_DATA_MODEL_COORDINATES__, jni_double);
 
     if (pdblData == NULL)
     {
index f1f3e82..475fca1 100644 (file)
@@ -636,7 +636,7 @@ int CheckAndUpdate_z_shift(sciPointObj * pobj, int numrow)
 int set_data_property( sciPointObj * pobj, size_t stackPointer, int valueType, int nbRow, int nbCol )
 {
     double *pdblValue = getDoubleMatrixFromStack(stackPointer);
-    BOOL bResult = setGraphicObjectProperty(pobj->UID, __GO_DATA__, pdblValue, jni_double, 1);
+    BOOL bResult = setGraphicObjectProperty(pobj->UID, __GO_DATA_MODEL_COORDINATES__, pdblValue, jni_double, 1);
 
     if (bResult == FALSE)
     {