Skip to content

Commit

Permalink
+ remove feature classes to import/export points
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Dec 30, 2015
1 parent ad2c4c2 commit 4e3856a
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 261 deletions.
3 changes: 0 additions & 3 deletions src/Mod/Points/App/AppPoints.cpp
Expand Up @@ -33,7 +33,6 @@
#include "PointsPy.h"
#include "Properties.h"
#include "PropertyPointKernel.h"
#include "FeaturePointsImportAscii.h"


/* registration table */
Expand Down Expand Up @@ -62,8 +61,6 @@ void PointsExport initPoints()
// add data types
Points::Feature ::init();
Points::FeaturePython ::init();
Points::Export ::init();
Points::ImportAscii ::init();
}

} // extern "C"
2 changes: 1 addition & 1 deletion src/Mod/Points/App/AppPointsPy.cpp
Expand Up @@ -44,7 +44,7 @@
#include "Points.h"
#include "PointsPy.h"
#include "PointsAlgos.h"
#include "FeaturePointsImportAscii.h"
#include "PointsFeature.h"

using namespace Points;

Expand Down
2 changes: 0 additions & 2 deletions src/Mod/Points/App/CMakeLists.txt
Expand Up @@ -31,8 +31,6 @@ generate_from_xml(PointsPy)
SET(Points_SRCS
AppPoints.cpp
AppPointsPy.cpp
FeaturePointsImportAscii.cpp
FeaturePointsImportAscii.h
Points.cpp
Points.h
PointsPy.xml
Expand Down
69 changes: 0 additions & 69 deletions src/Mod/Points/App/FeaturePointsImportAscii.cpp

This file was deleted.

59 changes: 0 additions & 59 deletions src/Mod/Points/App/FeaturePointsImportAscii.h

This file was deleted.

44 changes: 0 additions & 44 deletions src/Mod/Points/App/PointsFeature.cpp
Expand Up @@ -89,50 +89,6 @@ void Feature::onChanged(const App::Property* prop)
GeoFeature::onChanged(prop);
}

// ------------------------------------------------------------------

PROPERTY_SOURCE(Points::Export, Points::Feature)

Export::Export(void)
{
ADD_PROPERTY(Sources ,(0));
ADD_PROPERTY(FileName,(""));
ADD_PROPERTY(Format ,(""));
}

App::DocumentObjectExecReturn *Export::execute(void)
{
// ask for write permission
Base::FileInfo fi(FileName.getValue());
Base::FileInfo di(fi.dirPath().c_str());
if ((fi.exists() && !fi.isWritable()) || !di.exists() || !di.isWritable())
{
return new App::DocumentObjectExecReturn("No write permission for file");
}

Base::ofstream str(fi, std::ios::out | std::ios::binary);

if (fi.hasExtension("asc"))
{
const std::vector<App::DocumentObject*>& features = Sources.getValues();
for ( std::vector<App::DocumentObject*>::const_iterator it = features.begin(); it != features.end(); ++it )
{
Feature *pcFeat = dynamic_cast<Feature*>(*it);
const PointKernel& kernel = pcFeat->Points.getValue();

str << "# " << pcFeat->getNameInDocument() << " Number of points: " << kernel.size() << std::endl;
for ( PointKernel::const_iterator it = kernel.begin(); it != kernel.end(); ++it )
str << it->x << " " << it->y << " " << it->z << std::endl;
}
}
else
{
return new App::DocumentObjectExecReturn("File format not supported");
}

return App::DocumentObject::StdReturn;
}

// ---------------------------------------------------------

namespace App {
Expand Down
22 changes: 0 additions & 22 deletions src/Mod/Points/App/PointsFeature.h
Expand Up @@ -75,28 +75,6 @@ class PointsExport Feature : public App::GeoFeature
PropertyPointKernel Points; /**< The point kernel property. */
};

/**
* The Export class writes a point cloud to a file.
* @author Werner Mayer
*/
class Export : public Feature
{
PROPERTY_HEADER(Points::Export);

public:
Export();

App::PropertyLinkList Sources;
App::PropertyString FileName;
App::PropertyString Format;

/** @name methods override Feature */
//@{
/// recalculate the Feature
virtual App::DocumentObjectExecReturn *execute(void);
//@}
};

typedef App::FeaturePythonT<Feature> FeaturePython;

} //namespace Points
Expand Down
11 changes: 11 additions & 0 deletions src/Mod/Points/App/PropertyPointKernel.cpp
Expand Up @@ -161,6 +161,17 @@ unsigned int PropertyPointKernel::getMemSize (void) const
return sizeof(Base::Vector3f) * this->_cPoints->size();
}

PointKernel* PropertyPointKernel::startEditing()
{
aboutToSetValue();
return static_cast<PointKernel*>(_cPoints);
}

void PropertyPointKernel::finishEditing()
{
hasSetValue();
}

void PropertyPointKernel::removeIndices( const std::vector<unsigned long>& uIndices )
{
// We need a sorted array
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Points/App/PropertyPointKernel.h
Expand Up @@ -83,6 +83,8 @@ class PointsExport PropertyPointKernel : public App::PropertyComplexGeoData

/** @name Modification */
//@{
PointKernel* startEditing();
void finishEditing();
/// Transform the real 3d point kernel
void transformGeometry(const Base::Matrix4D &rclMat);
void removeIndices( const std::vector<unsigned long>& );
Expand Down

0 comments on commit 4e3856a

Please sign in to comment.