ccBBox ccGBLSensor::getOwnBB(bool withGLFeatures/*=false*/) { if (!withGLFeatures) { return ccBBox(); } //get sensor position ccIndexedTransformation sensorPos; if (!getAbsoluteTransformation(sensorPos,m_activeIndex)) { return ccBBox(); } ccPointCloud cloud; if (!cloud.reserve(8)) { //not enough memory?! return ccBBox(); } cloud.addPoint(CCVector3(-m_scale,-m_scale,-m_scale)); cloud.addPoint(CCVector3(-m_scale,-m_scale, m_scale)); cloud.addPoint(CCVector3(-m_scale, m_scale,-m_scale)); cloud.addPoint(CCVector3(-m_scale, m_scale, m_scale)); cloud.addPoint(CCVector3( m_scale,-m_scale,-m_scale)); cloud.addPoint(CCVector3( m_scale,-m_scale, m_scale)); cloud.addPoint(CCVector3( m_scale, m_scale,-m_scale)); cloud.addPoint(CCVector3( m_scale, m_scale, m_scale)); cloud.applyRigidTransformation(sensorPos); return cloud.getOwnBB(false); }
void ccBoundingBoxEditorDlg::updateCurrentBBox(double dummy) { CCVector3 A(static_cast<PointCoordinateType>(xDoubleSpinBox->value()), static_cast<PointCoordinateType>(yDoubleSpinBox->value()), static_cast<PointCoordinateType>(zDoubleSpinBox->value())); CCVector3 W(static_cast<PointCoordinateType>(dxDoubleSpinBox->value()), static_cast<PointCoordinateType>(dyDoubleSpinBox->value()), static_cast<PointCoordinateType>(dzDoubleSpinBox->value())); switch (pointTypeComboBox->currentIndex()) { case 0: //A = min corner m_currentBBox = ccBBox(A,A+W); break; case 1: //A = center m_currentBBox = ccBBox(A-W/2.0,A+W/2.0); break; case 2: //A = max corner m_currentBBox = ccBBox(A-W,A); break; default: assert(false); return; } //base box (if valid) should always be included! if (m_baseBBox.isValid()) checkBaseInclusion(); }
ccBBox ccOctree::getOwnBB(bool withGLFeatures/*=false*/) { if (withGLFeatures) { return ccBBox(m_dimMin,m_dimMax); } else { return ccBBox(m_pointsMin,m_pointsMax); } }
ccBBox ccGBLSensor::getOwnFitBB(ccGLMatrix& trans) { //get sensor position ccIndexedTransformation sensorPos; if (!getAbsoluteTransformation(sensorPos,m_activeIndex)) return ccBBox(); trans = sensorPos; return ccBBox( CCVector3(-m_scale,-m_scale,-m_scale), CCVector3( m_scale, m_scale, m_scale) ); }
ccBBox ccKdTree::getCellBBox(BaseNode* node) const { if (!node || !m_associatedCloud) return ccBBox(); GetCellBBoxVisitor helper; helper.visit(node); //finish the job ccBBox& box = helper.m_UpdatedBox; { CCVector3 bbMin,bbMax; m_associatedCloud->getBoundingBox(bbMin.u,bbMax.u); for (int i=0;i<3;++i) { if (box.minCorner().u[i] != box.minCorner().u[i]) //still NaN value? box.minCorner().u[i] = bbMin.u[i]; //we use the main bb limit if (box.maxCorner().u[i] != box.maxCorner().u[i]) //still NaN value? box.maxCorner().u[i] = bbMax.u[i]; //we use the main bb limit } box.setValidity(true); } return box; }
//Helper void MakeSquare(ccBBox& box, int pivotType, int defaultDim = -1) { assert(defaultDim<3); assert(pivotType>=0 && pivotType<3); CCVector3 W = box.getDiagVec(); if (W.x != W.y || W.x != W.z) { if (defaultDim < 0) { //we take the largest one! defaultDim = 0; if (W.u[1] > W.u[defaultDim]) defaultDim = 1; if (W.u[2] > W.u[defaultDim]) defaultDim = 2; } CCVector3 newW(W.u[defaultDim], W.u[defaultDim], W.u[defaultDim]); switch(pivotType) { case 0: //min corner { CCVector3 A = box.minCorner(); box = ccBBox(A, A + newW); } break; case 1: //center { CCVector3 C = box.getCenter(); box = ccBBox(C - newW / 2.0, C + newW / 2.0); } break; case 2: //max corner { CCVector3 B = box.maxCorner(); box = ccBBox(B-newW,B); } break; } } }
ccBBox ccHObject::getMyOwnBB() { return ccBBox(); }
ccBBox ccPlane::getFitBB(ccGLMatrix& trans) { trans = m_transformation; return ccBBox(CCVector3(-m_xWidth*0.5f,-m_yWidth*0.5f, 0),CCVector3(m_xWidth*0.5f,m_yWidth*0.5f, 0)); }
ccBBox ccQuadric::getFitBB(ccGLMatrix& trans) { trans = m_transformation; return ccBBox( CCVector3(m_minCorner.x,m_minCorner.y,m_minZ), CCVector3(m_maxCorner.x,m_maxCorner.y,m_maxZ) ); }
ccBBox ccOctree::getDisplayBB() { return ccBBox(m_dimMin,m_dimMax); }
ccBBox ccOctree::getMyOwnBB() { return ccBBox(m_pointsMin,m_pointsMax); }
ccBBox ccOctree::getDisplayBB() { CCVector3 bbMin(m_dimMin[0],m_dimMin[1],m_dimMin[2]); CCVector3 bbMax(m_dimMax[0],m_dimMax[1],m_dimMax[2]); return ccBBox(bbMin,bbMax); }
ccBBox ccOctree::getMyOwnBB() { CCVector3 bbMin(m_pointsMin[0],m_pointsMin[1],m_pointsMin[2]); CCVector3 bbMax(m_pointsMax[0],m_pointsMax[1],m_pointsMax[2]); return ccBBox(bbMin,bbMax); }
ccRasterizeTool::ccRasterizeTool(ccGenericPointCloud* cloud, QWidget* parent/*=0*/) : QDialog(parent, Qt::WindowMaximizeButtonHint) , cc2Point5DimEditor() , Ui::RasterizeToolDialog() , m_cloud(cloud) { setupUi(this); #ifndef CC_GDAL_SUPPORT generateRasterPushButton->setDisabled(true); generateRasterPushButton->setChecked(false); #endif connect(buttonBox, SIGNAL(accepted()), this, SLOT(testAndAccept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(testAndReject())); connect(gridStepDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(updateGridInfo())); connect(gridStepDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(gridOptionChanged())); connect(emptyValueDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(gridOptionChanged())); connect(resampleCloudCheckBox, SIGNAL(toggled(bool)), this, SLOT(gridOptionChanged())); connect(dimensionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(projectionDirChanged(int))); connect(heightProjectionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(projectionTypeChanged(int))); connect(scalarFieldProjection, SIGNAL(currentIndexChanged(int)), this, SLOT(sfProjectionTypeChanged(int))); connect(fillEmptyCellsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(fillEmptyCellStrategyChanged(int))); connect(updateGridPushButton, SIGNAL(clicked()), this, SLOT(updateGridAndDisplay())); connect(generateCloudPushButton, SIGNAL(clicked()), this, SLOT(generateCloud())); connect(generateImagePushButton, SIGNAL(clicked()), this, SLOT(generateImage())); connect(generateRasterPushButton, SIGNAL(clicked()), this, SLOT(generateRaster())); connect(generateASCIIPushButton, SIGNAL(clicked()), this, SLOT(generateASCIIMatrix())); connect(generateMeshPushButton, SIGNAL(clicked()), this, SLOT(generateMesh())); connect(generateContoursPushButton, SIGNAL(clicked()), this, SLOT(generateContours())); connect(exportContoursPushButton, SIGNAL(clicked()), this, SLOT(exportContourLines())); connect(clearContoursPushButton, SIGNAL(clicked()), this, SLOT(removeContourLines())); connect(activeLayerComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(activeLayerChanged(int))); //custom bbox editor ccBBox gridBBox = m_cloud ? m_cloud->getOwnBB() : ccBBox(); if (gridBBox.isValid()) { createBoundingBoxEditor(gridBBox, this); connect(editGridToolButton, SIGNAL(clicked()), this, SLOT(showGridBoxEditor())); } else { editGridToolButton->setEnabled(false); } if (m_cloud) { cloudNameLabel->setText(m_cloud->getName()); pointCountLabel->setText(QString::number(m_cloud->size())); interpolateSFFrame->setEnabled(cloud->hasScalarFields()); //populate layer box activeLayerComboBox->addItem(GetDefaultFieldName(PER_CELL_HEIGHT)); if (cloud->isA(CC_TYPES::POINT_CLOUD) && cloud->hasScalarFields()) { ccPointCloud* pc = static_cast<ccPointCloud*>(cloud); for (unsigned i=0; i<pc->getNumberOfScalarFields(); ++i) activeLayerComboBox->addItem(pc->getScalarField(i)->getName()); } else { activeLayerComboBox->setEnabled(false); } //add window create2DView(mapFrame); } loadSettings(); updateGridInfo(); gridIsUpToDate(false); }
ccBBox cc2Point5DimEditor::getCustomBBox() const { return (m_bbEditorDlg ? m_bbEditorDlg->getBox() : ccBBox()); }
ccVolumeCalcTool::ccVolumeCalcTool(ccGenericPointCloud* cloud1, ccGenericPointCloud* cloud2, QWidget* parent/*=0*/) : QDialog(parent, Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint) , cc2Point5DimEditor() , Ui::VolumeCalcDialog() , m_cloud1(cloud1) , m_cloud2(cloud2) { setupUi(this); connect(buttonBox, SIGNAL(accepted()), this, SLOT(saveSettingsAndAccept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(gridStepDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(updateGridInfo())); connect(gridStepDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(gridOptionChanged())); connect(groundEmptyValueDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(gridOptionChanged())); connect(ceilEmptyValueDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(gridOptionChanged())); connect(projDimComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(projectionDirChanged(int))); connect(updatePushButton, SIGNAL(clicked()), this, SLOT(updateGridAndDisplay())); connect(heightProjectionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(gridOptionChanged())); connect(fillGroundEmptyCellsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(groundFillEmptyCellStrategyChanged(int))); connect(fillCeilEmptyCellsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(ceilFillEmptyCellStrategyChanged(int))); connect(swapToolButton, SIGNAL(clicked()), this, SLOT(swapRoles())); connect(groundComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(groundSourceChanged(int))); connect(ceilComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(ceilSourceChanged(int))); connect(clipboardPushButton, SIGNAL(clicked()), this, SLOT(exportToClipboard())); connect(exportGridPushButton, SIGNAL(clicked()), this, SLOT(exportGridAsCloud())); connect(precisionSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setDisplayedNumberPrecision(int))); if (m_cloud1 && !m_cloud2) { //the existing cloud is always the second by default std::swap(m_cloud1, m_cloud2); } assert(m_cloud2); //custom bbox editor ccBBox gridBBox = m_cloud1 ? m_cloud1->getOwnBB() : ccBBox(); if (m_cloud2) { gridBBox += m_cloud2->getOwnBB(); } if (gridBBox.isValid()) { createBoundingBoxEditor(gridBBox, this); connect(editGridToolButton, SIGNAL(clicked()), this, SLOT(showGridBoxEditor())); } else { editGridToolButton->setEnabled(false); } groundComboBox->addItem("Constant"); ceilComboBox->addItem("Constant"); if (m_cloud1) { groundComboBox->addItem(m_cloud1->getName()); ceilComboBox->addItem(m_cloud1->getName()); } if (m_cloud2) { groundComboBox->addItem(m_cloud2->getName()); ceilComboBox->addItem(m_cloud2->getName()); } assert(groundComboBox->count() >= 2); groundComboBox->setCurrentIndex(groundComboBox->count()-2); ceilComboBox->setCurrentIndex(ceilComboBox->count()-1); //add window create2DView(mapFrame); if (m_glWindow) { ccGui::ParamStruct params = m_glWindow->getDisplayParameters(); params.colorScaleShowHistogram = false; params.displayedNumPrecision = precisionSpinBox->value(); m_glWindow->setDisplayParameters(params, true); } loadSettings(); updateGridInfo(); gridIsUpToDate(false); }
ccBBox ccComputeOctreeDlg::getCustomBBox() const { return (m_bbEditorDlg ? m_bbEditorDlg->getBox() : ccBBox()); }
ccBBox ccKdTree::getDisplayBB() { return (m_associatedGenericCloud ? m_associatedGenericCloud->getDisplayBB() : ccBBox()); }
ccBBox ccHObject::getOwnBB(bool withGLFeatures/*=false*/) { return ccBBox(); }
ccBBox ccHeightGridGenerationDlg::getCustomBBox() const { return (m_bbEditorDlg ? m_bbEditorDlg->getBox() : ccBBox()); }