Commit 15deb769 authored by Andreas Schwarzkopf's avatar Andreas Schwarzkopf

[STYLE #42] Added empty lines between methods in code and header files

 * Added some empty lines between methods in code and header files.
 *
 * Bugfix: Solved problem in point data saving that the coordinate precision was about 5
 * signs.
 *
 * Sebastian Eichelbaum wrote (18.09.2014, 11:46):
 * >> Hi Andreas
 * >>
 * >> Ich würde dich gern bitten darauf zu achten, dass du zwischen Funktionen
 * >> eine Leerzeile lässt. Das betrifft sowohl die CPP als auch die Header
 * >> files. Als Beispiel: WBmpImage.cpp. Dort hast du nach dem Konstruktor
 * >> eine Leerzeile gemacht, nach dem Destruktor und den folgenden Funktionen
 * >> jedoch nicht.
 * >>
 * >> Ansonsten ist dein Stil sehr sauber. Auch die Doxygen Doku ist sehr
 * >> ordentlich. Super.
 * >>
 * >> Gruß
 * >> Sebastian
parent e5431dda
......@@ -66,6 +66,7 @@ void WBuildingDetector::detectBuildings( boost::shared_ptr< WDataSetPoints > poi
//targetShowables->setExportElevationImageSettings( -16.0, 8.0 );
//targetShowables->exportElevationImage( "/home/renegade/Dokumente/Projekte/OpenWalnut@Eclipse/elevation images/targetShowables.bmp", 1 );
}
void WBuildingDetector::setDetectionParams( int detailDepth, int minSearchDetailDepth,
double minSearchCutUntilAbove )
{
......@@ -73,10 +74,12 @@ void WBuildingDetector::setDetectionParams( int detailDepth, int minSearchDetail
m_minSearchDetailDepth = pow( 2.0, minSearchDetailDepth );
m_minSearchCutUntilAbove = minSearchCutUntilAbove;
}
WOctree* WBuildingDetector::getBuildingGroups()
{
return m_targetGrouped3d;
}
void WBuildingDetector::initMinimalMaxima( WQuadNode* sourceNode, WQuadTree* targetTree )
{
if ( sourceNode->getRadius() <= m_detailDepth )
......@@ -97,6 +100,7 @@ void WBuildingDetector::initMinimalMaxima( WQuadNode* sourceNode, WQuadTree* tar
initMinimalMaxima( sourceNode->getChild( child ), targetTree );
}
}
void WBuildingDetector::projectDrawableAreas( WQuadNode* sourceNode,
WQuadTree* minimalMaxima, WQuadTree* targetTree )
{
......
......@@ -43,10 +43,12 @@ public:
* Constructor of the building detector instance.
*/
explicit WBuildingDetector();
/**
* Destructor of the building detector instance.
*/
virtual ~WBuildingDetector();
/**
* Starts the routine detecting buildings using the point data.
* After executing you can extract the building number from each node
......@@ -54,6 +56,7 @@ public:
* \param points Point data to extract buildings from
*/
void detectBuildings( boost::shared_ptr< WDataSetPoints > points );
/**
* Sets setting params for building recognition
* \param m_detailDepth Data grid resolution of cube group data. The number must
......@@ -68,6 +71,7 @@ public:
*/
void setDetectionParams( int m_detailDepth, int minSearchDetailDepth,
double minSearchCutUntilAbove );
/**
* Returns the 3D node tree. Each leaf node has a group ID number. Many nodes can pe
* pointed by an equal parameter to a single building area.
......@@ -87,6 +91,7 @@ private:
* compare whether points are above threshold.
*/
void initMinimalMaxima( WQuadNode* sourceNode, WQuadTree* targetTree );
/**
* Calculates 2D-areas which cover buildings. Building areas will be outlined in targetTree.
* \param sourceImage Input image. Maximal point values are taken.
......@@ -96,6 +101,7 @@ private:
*/
void projectDrawableAreas( WQuadNode* sourceImage, WQuadTree* minimalMaxima,
WQuadTree* targetTree );
/**
* It generates a voxel structure. Leaf nodes should appear where building points exist.
* \param sourceNode Source octree contatining data that represents any
......@@ -107,26 +113,31 @@ private:
void fetchBuildingVoxels( WOctNode* sourceNode, WQuadTree* buildingPixels,
WOctree* targetTree );
/**
* Resolution of input/output data in meters. Use only numbers depictable by 2^n
* where n can also be 0 or below.
*/
double m_detailDepth;
/**
* Resolution of the relative minimum search image. Use only numbers depictable by 2^n
* where n can also be 0 or below. The bigger the pixels the greater are the areas
* searched from an examined X/Y area. Their radius equals that parameter.
*/
double m_minSearchDetailDepth;
/**
* Height that must exceed above an relative minimum to recognize it as a building pixel.
*/
double m_minSearchCutUntilAbove;
/**
* The same as m_minSearchDetailDepth. But it's used to still be able tu use smaller
* m_minSearchDetailDepth values not having big proglems with larger buildings.
*/
double m_detailDepthBigHeights;
/**
* The corresponding threshold height setting for m_detailDepthBigHeights.
*/
......
......@@ -67,6 +67,7 @@ const char** WMBuildingsDetection::getXPMIcon() const
{
return WMBuildingsDetection_xpm;
}
const std::string WMBuildingsDetection::getName() const
{
return "Buildings Detection";
......@@ -238,6 +239,7 @@ void WMBuildingsDetection::moduleMain()
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->remove( m_rootNode );
}
void WMBuildingsDetection::setProgressSettings( size_t steps )
{
m_progress->removeSubProgress( m_progressStatus );
......
......@@ -169,26 +169,32 @@ private:
* Info tab property: Input points count.
*/
WPropInt m_nbPoints;
/**
* Info tab property: Minimal x value of input x coordunates.
*/
WPropDouble m_xMin;
/**
* Info tab property: Maximal x value of input x coordunates.
*/
WPropDouble m_xMax;
/**
* Info tab property: Minimal y value of input x coordunates.
*/
WPropDouble m_yMin;
/**
* Info tab property: Maximal y value of input x coordunates.
*/
WPropDouble m_yMax;
/**
* Info tab property: Minimal z value of input x coordunates.
*/
WPropDouble m_zMin;
/**
* Info tab property: Maximal z value of input x coordunates.
*/
......@@ -199,11 +205,13 @@ private:
* radius equals to its result.
*/
WPropInt m_detailDepth;
/**
* Determines the resolution of smallest octree nodes. Their radius equal that value.
*/
WPropDouble m_detailDepthLabel;
WPropTrigger m_reloadData; //!< This property triggers the actual reading,
......@@ -216,6 +224,7 @@ private:
* four is below of the height threshold of the examinable point.
*/
WPropInt m_minSearchDetailDepth;
/**
* Main building detection setting.
* Height that must exceed above an relative minimum to recognize it as a building pixel.
......
......@@ -38,14 +38,17 @@ WBmpImage::~WBmpImage()
{
resizeImage( 0, 0 );
}
size_t WBmpImage::getSizeX()
{
return m_sizeX;
}
size_t WBmpImage::getSizeY()
{
return m_sizeY;
}
void WBmpImage::resizeImage( size_t sizeX, size_t sizeY )
{
m_sizeX = sizeX;
......@@ -64,30 +67,36 @@ void WBmpImage::resizeImage( size_t sizeX, size_t sizeY )
m_dataB[index] = 0;
}
}
size_t WBmpImage::getR( size_t x, size_t y )
{
if( x >= m_sizeX || y >= m_sizeY ) return 0;
return m_dataR[getIndex( x, y )];
}
size_t WBmpImage::getG( size_t x, size_t y )
{
if( x >= m_sizeX || y >= m_sizeY ) return 0;
return m_dataG[getIndex( x, y )];
}
size_t WBmpImage::getB( size_t x, size_t y )
{
if( x >= m_sizeX || y >= m_sizeY ) return 0;
return m_dataB[getIndex( x, y )];
}
size_t WBmpImage::getA( size_t x, size_t y )
{
if( x >= m_sizeX || y >= m_sizeY ) return 0;
return 255;
}
void WBmpImage::setPixel( size_t x, size_t y, size_t intensity )
{
setPixel( x, y, intensity, intensity, intensity );
}
void WBmpImage::setPixel( size_t x, size_t y, size_t r, size_t g, size_t b )
{
if( x >= m_sizeX || y >= m_sizeY ) return;
......@@ -96,6 +105,7 @@ void WBmpImage::setPixel( size_t x, size_t y, size_t r, size_t g, size_t b )
m_dataG[index] = g < 256 ?g :255;
m_dataB[index] = b < 256 ?b :255;
}
size_t WBmpImage::getIndex( size_t x, size_t y )
{
return x + m_sizeX * y;
......@@ -137,6 +147,7 @@ void WBmpImage::importElevationImageDrawNode( WQuadNode* node, WQuadTree* quadTr
importElevationImageDrawNode( node->getChild( child ), quadTree, elevImageMode );
}
}
void WBmpImage::setExportElevationImageSettings( double minElevImageZ, double intensityIncreasesPerMeter )
{
m_minElevImageZ = minElevImageZ;
......
......@@ -45,26 +45,31 @@ public:
* \param sizeY Image height.
*/
WBmpImage( size_t sizeX, size_t sizeY );
/**
* Image container destructor.
*/
virtual ~WBmpImage();
/**
* Returns the image width.
* \return The image width.
*/
size_t getSizeX();
/**
* Returns the image height.
* \return The image height.
*/
size_t getSizeY();
/**
* Resizes and clears the image.
* \param sizeX Image width.
* \param sizeY Image height.
*/
void resizeImage( size_t sizeX, size_t sizeY );
/**
* Returns the red color value of a pixel.
* \param x Pixel index on X axis (0 to width-1).
......@@ -72,6 +77,7 @@ public:
* \return The red color value (0 to 255).
*/
size_t getR( size_t x, size_t y );
/**
* Returns the green color value of a pixel.
* \param x Pixel index on X axis (0 to width-1).
......@@ -79,6 +85,7 @@ public:
* \return The green color value (0 to 255).
*/
size_t getG( size_t x, size_t y );
/**
* Returns the blue color value of a pixel.
* \param x Pixel index on X axis (0 to width-1).
......@@ -86,6 +93,7 @@ public:
* \return The blue color value (0 to 255).
*/
size_t getB( size_t x, size_t y );
/**
* Returns the opacity value of a pixel.
* \param x Pixel index on X axis (0 to width-1).
......@@ -93,6 +101,7 @@ public:
* \return The opacity value (0 to 255).
*/
size_t getA( size_t x, size_t y );
/**
* Sets a color within a pixel using just an intensity.
* \param x Pixel index on X axis (0 to width-1).
......@@ -100,6 +109,7 @@ public:
* \param intensity Value that will be put to all color values equally (0 to 255).
*/
void setPixel( size_t x, size_t y, size_t intensity );
/**
* Sets a color within a pixel.
* \param x Pixel index on X axis (0 to width-1).
......@@ -121,6 +131,7 @@ public:
* 2: Point count each X/Y bin coordinate.
*/
void importElevationImage( WQuadTree* quadTree, size_t elevImageMode );
/**
* Sets the elevation image export settings.
* \param minElevImageZ The elevation height that is mapped to the black color.
......@@ -150,20 +161,24 @@ private:
* Image width.
*/
size_t m_sizeX;
/**
* Image height.
*/
size_t m_sizeY;
/**
* Image red color intensity data. The order corresponds to the following pixel traversing.
* It traverses linewise each starting at Y=0 from first to last X value.
*/
std::vector<size_t> m_dataR;
/**
* Image green color intensity data. The order corresponds to the following pixel traversing.
* It traverses linewise each starting at Y=0 from first to last X value.
*/
std::vector<size_t> m_dataG;
/**
* Image blue color intensity data. The order corresponds to the following pixel traversing.
* It traverses linewise each starting at Y=0 from first to last X value.
......@@ -175,11 +190,13 @@ private:
* The elevation height that is mapped to the black color.
*/
double m_minElevImageZ;
/**
* Elevation image export setting.
* Intensity increase count per meter.
*/
double m_intensityIncreasesPerMeter;
/**
* Draws a quadtree leaf node to the bmp file. All subchildren will also be drawn.
* \param node Quadtree node to draw
......
......@@ -42,10 +42,12 @@ public:
* Bmp image saver constructor
*/
WBmpSaver();
/**
* Bmp image saver destructor
*/
virtual ~WBmpSaver();
/**
* Static method to save an image as a bmp file.
* \param image The image to store.
......
......@@ -34,6 +34,7 @@ WGroupEdit::WGroupEdit()
WGroupEdit::~WGroupEdit()
{
}
void WGroupEdit::initProocessBegin()
{
m_groupSizes.resize( 0 );
......@@ -50,14 +51,17 @@ void WGroupEdit::initProocessBegin()
new WDataSetPointsGrouped::GroupArray::element_type() );
m_groups = newGroups;
}
void WGroupEdit::setMergeGroups( bool mergeGroups )
{
m_mergeGroups = mergeGroups;
}
void WGroupEdit::setGroupSizeThreshold( size_t groupSizeThreshold )
{
m_groupSizeThreshold = groupSizeThreshold;
}
void WGroupEdit::mergeGroupSet( boost::shared_ptr< WDataSetPointsGrouped > points )
{
size_t groupIDOffset = m_lastGroupID == 0 ?0 :m_lastGroupID + 1;
......@@ -94,18 +98,22 @@ void WGroupEdit::mergeGroupSet( boost::shared_ptr< WDataSetPointsGrouped > point
}
}
}
double WGroupEdit::getVertex( size_t pointIndex, size_t dimension )
{
return m_vertices->at( pointIndex * 3 + dimension );
}
double WGroupEdit::getColor( size_t pointIndex, size_t colorChannel )
{
return m_colors->at( pointIndex * 3 + colorChannel );
}
size_t WGroupEdit::getOldGroupID( size_t pointIndex )
{
return m_groups->at( pointIndex );
}
size_t WGroupEdit::getNewGroupID( size_t pointIndex )
{
size_t originalGroupID = getOldGroupID( pointIndex );
......@@ -113,6 +121,7 @@ size_t WGroupEdit::getNewGroupID( size_t pointIndex )
return originalGroupID;
return m_groupIDMap[originalGroupID];
}
bool WGroupEdit::isPointCollected( size_t pointIndex )
{
size_t originalGroupID = getOldGroupID( pointIndex );
......@@ -120,6 +129,7 @@ bool WGroupEdit::isPointCollected( size_t pointIndex )
return false;
return m_groupSizes[originalGroupID] >= m_groupSizeThreshold;
}
size_t WGroupEdit::getInputPointCount()
{
return m_vertices->size() / 3;
......@@ -131,6 +141,7 @@ size_t WGroupEdit::getLastGroupID()
{
return m_lastGroupID;
}
size_t WGroupEdit::getGroupSize( size_t origGroupID )
{
return m_groupSizes[origGroupID];
......@@ -147,6 +158,7 @@ void WGroupEdit::modifyGroupIDs()
m_groupIDMap[index] = currentID++;
m_lastGroupID = currentID - 1;
}
bool WGroupEdit::isValidGroupID( size_t groupID )
{
return groupID < 1000 * 1000 * 100;
......
......@@ -59,6 +59,7 @@ public:
* Creates the group edit instance
*/
explicit WGroupEdit();
/**
* Destroys the group edit instance
*/
......@@ -68,6 +69,7 @@ public:
* Initializes the group edit process.
*/
void initProocessBegin();
/**
* Sets whether group IDs should be kept or continuously counted up when a new
* grouped point set is added.
......@@ -76,6 +78,7 @@ public:
* same if the group size threshold is 0.
*/
void setMergeGroups( bool mergeGroups );
/**
* Sets the minimal group size. Groups below that point count are signaled not to be
* added. Further group IDs are changed changed that way so that no group until the
......@@ -84,6 +87,7 @@ public:
* final dataset.
*/
void setGroupSizeThreshold( size_t groupSizeThreshold );
/**
* Merges points to previously added points. This method is also used tu add grouped
* points for the first time.
......@@ -99,6 +103,7 @@ public:
* \return Last group ID of the new merged point dataset.
*/
size_t getLastGroupID();
/**
* Returns the point count of a group.
* \param origGroupID Point group ID of the original dataset to get the point count
......@@ -107,6 +112,7 @@ public:
* \return Point count of a group.
*/
size_t getGroupSize( size_t origGroupID );
/**
* Returns a vertex of a corresponding point within the merged dataset.
* Points with a group sizw below a threshold still remain using that function. Use
......@@ -116,6 +122,7 @@ public:
* \return Value that belongs to a coordinate value X, Y or Z of a point.
*/
double getVertex( size_t pointIndex, size_t dimension );
/**
* Returns a color of a corresponding point within the merged dataset.
* Points with a group sizw below a threshold still remain using that function. Use
......@@ -126,6 +133,7 @@ public:
* \return Value that belongs to color channel of a point.
*/
double getColor( size_t pointIndex, size_t colorChannel );
/**
* Returns an original group ID of a point. Group IDs are changed after the first
* merged dataset if setMergeGroups( false ) was applied.
......@@ -135,6 +143,7 @@ public:
* \return Group ID of the original dataset.
*/
size_t getOldGroupID( size_t pointIndex );
/**
* Returns a new group ID. It is further changed if the group size threshold is
* above 0. Further no ID remains without points.
......@@ -144,6 +153,7 @@ public:
* \return New group ID.
*/
size_t getNewGroupID( size_t pointIndex );
/**
* Tells whether a point is collected by means if the point group size threshold.
* \param pointIndex Point index of the merged dataset.
......@@ -158,6 +168,7 @@ public:
* \return Point count without means of group point count threshold.
*/
size_t getInputPointCount();
/**
* Creates an array which shows a map from old to new group IDs. Array index is the
* old group ID. The map has finally no groups without point using a group size
......@@ -183,6 +194,7 @@ private:
* too many unused IDs.
*/
vector<size_t> m_groupSizes;
/**
* Map that links an old group ID with a new one. Old group ID is the array index.
* The new group ID is its value.
......@@ -190,6 +202,7 @@ private:
* too many unused IDs.
*/
vector<size_t> m_groupIDMap;
/**
* Last new group ID.
*/
......@@ -199,20 +212,24 @@ private:
* Input point coordinates.
*/
WDataSetPointsGrouped::VertexArray m_vertices;
/**
* Colors of the input point data set that are also passed through.
*/
WDataSetPointsGrouped::ColorArray m_colors;
/**
* Input point groups.
*/
WDataSetPointsGrouped::GroupArray m_groups;
/**
* Determines whether group IDs should be bigger than those of previous datasets or
* remain. before applying the group size threshold.
*/
bool m_mergeGroups;
/**
* Group point count threshold that is applied. Groups with a point count below that
* value are proposed to be removed. Having a threshold above 0 group IDs are
......
......@@ -41,28 +41,34 @@ WPointSaver::WPointSaver()
WPointSaver::~WPointSaver()
{
}
WDataSetPointsGrouped::VertexArray WPointSaver::getVertices()
{
return m_verts;
}
WDataSetPointsGrouped::VertexArray WPointSaver::getColors()
{
return m_colors;
}
WDataSetPointsGrouped::GroupArray WPointSaver::getGroups()
{
return m_groups;
}
bool WPointSaver::loadWDataSetPoints()
{
m_hasGroupInfo = false;
return load();
}
bool WPointSaver::loadWDataSetPointsGrouped()
{
m_hasGroupInfo = true;
return load();
}
void WPointSaver::saveWDataSetPoints( WDataSetPointsGrouped::VertexArray vertices, WDataSetPointsGrouped::ColorArray colors )
{