27 #include "../../datatype/SimpleProperty.h"
28 #include "../../graph/core/AbstractGraph.h"
29 #include "../../graph/core/GraphMetadata.h"
30 #include "../../graph/core/Vertex.h"
31 #include "../../graph/iterator/MemoryIterator.h"
32 #include "../../memory/DataSet.h"
33 #include "../../memory/DataSetItem.h"
51 m_dataSetName = dataSetName;
61 m_attributeName = attrName;
66 return m_attributeName;
81 assert(m_graph.get());
85 std::auto_ptr<te::da::DataSetType> dsType = createDataSetType(dataSetName);
88 std::auto_ptr<te::mem::DataSet> dataSet = createDataSet(dsType.get());
91 if(dsType.get() && dataSet.get())
93 dataSet->moveBeforeFirst();
95 std::map<std::string, std::string> options;
97 ds->createDataSet(dsType.get(), options);
99 ds->add(dataSetName, dataSet.get(), options);
109 dataSetType->add(idxProperty);
113 pkName+=
"_" + dataSetName;
115 pk->
add(idxProperty);
118 for(
int i = 0; i < m_graph->getMetadata()->getVertexPropertySize(); ++i)
129 dataSetType->add(newProp);
140 std::map<int, std::string> propMap = getGPMPropertyMap();
147 while(!it->isVertexIteratorAfterEnd())
153 int idx = v->
getId();
156 outDSetItem->
setInt32(
"index", idx);
159 std::vector<te::dt::AbstractData*> adVec = v->
getAttributes();
161 std::map<int, std::string>::iterator itMap = propMap.begin();
163 while(itMap != propMap.end())
167 outDSetItem->
setValue(itMap->second, adClone);
173 outDataset->add(outDSetItem);
175 v = it->getNextVertex();
183 std::map<int, std::string> propMap;
185 for(
int i = 0; i < m_graph->getMetadata()->getVertexPropertySize(); ++i)
192 propMap.insert(std::map<int, std::string>::value_type(i, prop->
getName()));
#define TE_SA_GEOMETRY_ATTR_NAME
void add(te::dt::Property *p)
It adds a property to the list of properties of the primary key.
std::auto_ptr< te::mem::DataSet > createDataSet(te::da::DataSetType *dsType)
An atomic property like an integer or double.
#define TE_SA_GPM_ATTR_PK_NAME
boost::shared_ptr< DataSource > DataSourcePtr
A class that models the description of a dataset.
virtual Property * clone() const =0
It returns a clone of the object.
void setValue(std::size_t i, te::dt::AbstractData *value)
It sets the value of the i-th property.
std::vector< te::dt::AbstractData * > & getAttributes()
It returns the vector of attributes associated with this element.
It models a property definition.
std::map< int, std::string > getGPMPropertyMap()
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
void setId(unsigned int id)
It sets the property identifier.
void setInt32(std::size_t i, boost::int32_t value)
It sets the value of the i-th property.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
void setDataSetName(const std::string &dataSetName)
std::auto_ptr< te::da::DataSetType > createDataSetType(std::string dataSetName)
GeneralizedProximityMatrix()
Default constructor.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
A base class for values that can be retrieved from the data access module.
virtual ~GeneralizedProximityMatrix()
Virtual destructor.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
std::string getDataSetName()
std::string getAttributeName()
It describes a primary key (pk) constraint.
void toDataSource(te::da::DataSourcePtr ds, std::string dataSetName)
Function used to export the all vertex attributes from gpm graph to a datasource. ...
int getId()
It returns the vertex id.
virtual AbstractData * clone() const =0
It returns a clone of this object.
void setAttributeName(const std::string &attrName)
void setGraph(te::graph::AbstractGraph *graph)
te::graph::AbstractGraph * getGraph()
const std::string & getName() const
It returns the property name.
This class defines the GPM class.
void setParent(Property *p)
It associate this property to the informed parent.