diff --git a/FileIO/RapidXmlIO/BoostVtuInterface.cpp b/FileIO/RapidXmlIO/BoostVtuInterface.cpp index 9524add4d9a895656d666e7a811aaf603f6eca5d..e007502ef49acf1a52c192cce6e73c17b70f7035 100644 --- a/FileIO/RapidXmlIO/BoostVtuInterface.cpp +++ b/FileIO/RapidXmlIO/BoostVtuInterface.cpp @@ -368,7 +368,7 @@ unsigned char* BoostVtuInterface::uncompressData(property_tree::ptree const& com { const unsigned char* compressed_data = reinterpret_cast<const unsigned char*>(compressed_data_node.data().c_str()); unsigned long compressed_size = strlen(compressed_data_node.data().c_str()); - unsigned char* uncompressed_data; + unsigned char* uncompressed_data = NULL; unsigned long uncompressed_size = 0; unsigned long result = zLibDataCompressor::UncompressBuffer(compressed_data, compressed_size, uncompressed_data, uncompressed_size); return uncompressed_data; diff --git a/GeoLib/Station.h b/GeoLib/Station.h index 1d424fccd86b70bbaf804691f842eff32fb2b3c8..e85c6180e8463ab4fb029d40f5f591149cab9531 100644 --- a/GeoLib/Station.h +++ b/GeoLib/Station.h @@ -74,8 +74,9 @@ public: /// Signals if the object is a "simple" Station or a Borehole (i.e. containing borehole-specific information). enum StationType { - STATION = 1, - BOREHOLE = 2 + INVALID = 0, + STATION, + BOREHOLE }; /** @@ -136,7 +137,7 @@ public: std::string const& getName() const { return _name; } /// Returns the GeoSys-station-type for the station. - int type() const { return _type; } + StationType type() const { return _type; } /// Creates a Station-object from information contained in a string (assuming the string has the right format) static Station* createStation(const std::string &line); diff --git a/Gui/DataView/GeoTreeView.cpp b/Gui/DataView/GeoTreeView.cpp index b52996dc2c37d35f56d008cd7e3925c5053ae129..7741aa1669cb4166f1c2860672aa2a232b2f297f 100644 --- a/Gui/DataView/GeoTreeView.cpp +++ b/Gui/DataView/GeoTreeView.cpp @@ -104,8 +104,8 @@ void GeoTreeView::contextMenuEvent( QContextMenuEvent* event ) SLOT(connectPolylines())); } menu.addSeparator(); - QAction* removeAction = menu.addAction("Remove " + item->data(0).toString()); - connect(removeAction, SIGNAL(triggered()), this, SLOT(removeList())); + //QAction* removeAction = menu.addAction("Remove " + item->data(0).toString()); + //connect(removeAction, SIGNAL(triggered()), this, SLOT(removeList())); } else { @@ -180,6 +180,8 @@ void GeoTreeView::removeGeometry() 0).toString()).toStdString(), list->getType()); else emit listRemoved((item->data(0).toString()).toStdString(), GeoLib::INVALID); + emit enableSaveButton(false); + emit enableRemoveButton(false); } } diff --git a/Gui/DataView/LineEditDialog.h b/Gui/DataView/LineEditDialog.h index 7c8729bb2322445e2f5700d7e3bfac7668968d3f..e9f94dd651928bd3d04bdccec6b78ed614b380bb 100644 --- a/Gui/DataView/LineEditDialog.h +++ b/Gui/DataView/LineEditDialog.h @@ -66,3 +66,4 @@ signals: }; #endif //LINEEDITDIALOG_H + \ No newline at end of file diff --git a/Gui/DataView/MshView.cpp b/Gui/DataView/MshView.cpp index 1f8b86b73c80cad020cb66b9b04bea93801bba24..5f3c981faf99fa18bcff206ad4f03a70ae44397c 100644 --- a/Gui/DataView/MshView.cpp +++ b/Gui/DataView/MshView.cpp @@ -90,7 +90,11 @@ void MshView::removeMesh() if (!index.isValid()) OGSError::box("No mesh selected."); else + { emit requestMeshRemoval(index); + emit enableSaveButton(false); + emit enableRemoveButton(false); + } } void MshView::contextMenuEvent( QContextMenuEvent* event ) diff --git a/Gui/DataView/StationTreeView.cpp b/Gui/DataView/StationTreeView.cpp index 5d1038d69eff7b704f2a3cf150c972424df63f58..738173b850747bacf434b4c54ddf94ab70078816 100644 --- a/Gui/DataView/StationTreeView.cpp +++ b/Gui/DataView/StationTreeView.cpp @@ -222,6 +222,8 @@ void StationTreeView::removeStationList() { TreeItem* item = static_cast<StationTreeModel*>(model())->getItem(index); emit stationListRemoved((item->data(0).toString()).toStdString()); + emit enableSaveButton(false); + emit enableRemoveButton(false); } } diff --git a/Gui/VtkVis/VtkCompositeGeoObjectFilter.cpp b/Gui/VtkVis/VtkCompositeGeoObjectFilter.cpp index 97fad2d66aca4cfd7f3a0e3be21bad6733d2c9f8..31822e3059071a2f15e3c7f27bbacd7f246b82f3 100644 --- a/Gui/VtkVis/VtkCompositeGeoObjectFilter.cpp +++ b/Gui/VtkVis/VtkCompositeGeoObjectFilter.cpp @@ -22,6 +22,7 @@ #include "VtkPolylinesSource.h" #include "VtkSurfacesSource.h" +#include "VtkStationSource.h" #include "VtkCompositePointToGlyphFilter.h" #include "VtkCompositeLineToTubeFilter.h" @@ -42,6 +43,13 @@ VtkCompositeGeoObjectFilter::VtkCompositeGeoObjectFilter( vtkAlgorithm* inputAlg _type = GeoLib::POLYLINE; else if (dynamic_cast<VtkSurfacesSource*>(parentAlg) != NULL) _type = GeoLib::SURFACE; + else if (dynamic_cast<VtkStationSource*>(parentAlg) != NULL) + { + /* TODO + if (dynamic_cast<VtkStationSource*>(parentAlg)->getType() == GeoLib::Station::BOREHOLE) + _type = GeoLib::POLYLINE; + */ + } } } @@ -71,21 +79,15 @@ void VtkCompositeGeoObjectFilter::init() composite = new VtkCompositePointToGlyphFilter(surface); composite->SetUserProperty("Radius", this->GetInitialRadius()); _outputAlgorithm = composite->GetOutputAlgorithm(); - _outputAlgorithm->Update(); - vtkPolyData* pd = static_cast<vtkPolyData*>(_outputAlgorithm->GetOutputDataObject(0)); - //int a = pd->GetPoints()->GetNumberOfPoints(); - //std::cout << a << std::endl; } else if (_type == GeoLib::POLYLINE) { composite = new VtkCompositeLineToTubeFilter(surface); composite->SetUserProperty("Radius", this->GetInitialRadius()); _outputAlgorithm = composite->GetOutputAlgorithm(); - } else _outputAlgorithm = surface; - } void VtkCompositeGeoObjectFilter::SetIndex(size_t idx) @@ -104,5 +106,5 @@ float VtkCompositeGeoObjectFilter::GetInitialRadius() const double max = (x_diff > y_diff) ? x_diff : y_diff; max = (max > z_diff) ? max : z_diff; - return max/200.0; + return max/100.0; } diff --git a/Gui/VtkVis/VtkStationSource.cpp b/Gui/VtkVis/VtkStationSource.cpp index 995def7fe240618b26a38d1dc911319541394f96..715008aa6732e18ae0e804b0550cca1acacbd5e1 100644 --- a/Gui/VtkVis/VtkStationSource.cpp +++ b/Gui/VtkVis/VtkStationSource.cpp @@ -12,9 +12,6 @@ * */ -#include "Color.h" -#include "Station.h" - // ** VTK INCLUDES ** #include "VtkStationSource.h" @@ -157,11 +154,9 @@ int VtkStationSource::RequestData( vtkInformation* request, double loc[3] = { pCoords[0], pCoords[1], pCoords[2] }; newStations->InsertNextPoint(loc); station_ids->InsertNextValue(site_count); - newLines->InsertNextCell(2); newLines->InsertCellPoint(lastMaxIndex); // start of borehole-layer - newLines->InsertCellPoint(lastMaxIndex + 1); //end of boreholelayer - lastMaxIndex++; + newLines->InsertCellPoint(++lastMaxIndex); //end of boreholelayer strat_ids->InsertNextValue(this->GetIndexByName(soilNames[i])); if (useStationValues) station_values->InsertNextValue(static_cast<GeoLib::Station*>(*it)->getStationValue()); @@ -182,9 +177,9 @@ int VtkStationSource::RequestData( vtkInformation* request, else { output->SetLines(newLines); + //output->GetCellData()->AddArray(station_ids); output->GetCellData()->AddArray(strat_ids); - output->GetCellData()->SetActiveAttribute("Stratigraphies", - vtkDataSetAttributes::SCALARS); + output->GetCellData()->SetActiveAttribute("Stratigraphies", vtkDataSetAttributes::SCALARS); } if (useStationValues) output->GetPointData()->AddArray(station_values); @@ -224,7 +219,8 @@ size_t VtkStationSource::GetIndexByName( std::string name ) } vtkIdType new_index = (_id_map.empty()) ? 0 : (max_key+1); - std::cout << "Key \"" << name << "\" (Index " << new_index << ") not found in color lookup table..." << std::endl; + std::cout << "Key \"" << name << "\" has been assigned index " << new_index << std::endl; _id_map.insert(std::pair<std::string, vtkIdType>(name, new_index)); return new_index; } + diff --git a/Gui/VtkVis/VtkStationSource.h b/Gui/VtkVis/VtkStationSource.h index e5dd07f9470ebedc9240421af0f398a741222ee2..bbe7031c451ade1c76fdc47f94ce8c9e555c6b64 100644 --- a/Gui/VtkVis/VtkStationSource.h +++ b/Gui/VtkVis/VtkStationSource.h @@ -21,6 +21,7 @@ // GeoLib #include "Color.h" +#include "Station.h" /** * \brief VTK source object for the visualisation of station data (including boreholes) @@ -35,13 +36,16 @@ public: /// Returns the colour lookup table generated for boreholes. /// This method should only be called after the colour lookup table has actually been build (via RequestData() or setColorLookupTable()). - const std::map<std::string, - GeoLib::Color*>& getColorLookupTable() const { return _colorLookupTable; } + const std::map<std::string, GeoLib::Color*>& getColorLookupTable() const + { return _colorLookupTable; } + /// Returns the type of observation site represented in this source object + GeoLib::Station::StationType getType() const + { return static_cast<GeoLib::Station*>((*_stations)[0])->type(); }; + /// Sets a predefined color lookup table for the colouring of borehole stratigraphies - int setColorLookupTable(const std::string &filename) { return readColorLookupTable( - _colorLookupTable, - filename); } + int setColorLookupTable(const std::string &filename) + { return readColorLookupTable(_colorLookupTable, filename); } /// Sets the stations as a vector void setStations(const std::vector<GeoLib::Point*>* stations) { _stations = stations; } diff --git a/Gui/VtkVis/VtkVisPointSetItem.cpp b/Gui/VtkVis/VtkVisPointSetItem.cpp index c6122f0c75ef34c028c2c170298d10b0f7c898d6..7c5c7c4abb5880c9ade988bc7bc5f860babf0f91 100644 --- a/Gui/VtkVis/VtkVisPointSetItem.cpp +++ b/Gui/VtkVis/VtkVisPointSetItem.cpp @@ -272,7 +272,6 @@ void VtkVisPointSetItem::SetActiveAttribute( const QString& name ) { _algorithm->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, charName); _mapper->SetScalarModeToUsePointData(); - pointData->GetArray(_activeArrayName.c_str())->GetRange(range); pointData->GetArray(charName)->GetRange(range); } else @@ -293,7 +292,6 @@ void VtkVisPointSetItem::SetActiveAttribute( const QString& name ) { _algorithm->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, charName); _mapper->SetScalarModeToUseCellData(); - cellData->GetArray(_activeArrayName.c_str())->GetRange(range); cellData->GetArray(charName)->GetRange(range); } else diff --git a/Gui/mainwindow.cpp b/Gui/mainwindow.cpp index dd7105b8fcd33bbf43b0925d0cfcb80ca6c211f1..b43a5dfb82796addf66afe13326b2d69eb35547b 100644 --- a/Gui/mainwindow.cpp +++ b/Gui/mainwindow.cpp @@ -185,8 +185,8 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) _vtkVisPipeline, SLOT(removeHighlightedGeoObject())); connect(stationTabWidget->treeView, SIGNAL(geoItemSelected(const vtkPolyDataAlgorithm*, int)), _vtkVisPipeline, SLOT(highlightGeoObject(const vtkPolyDataAlgorithm*, int))); - connect(stationTabWidget->treeView, SIGNAL(geoItemSelected(const vtkPolyDataAlgorithm*, int)), - _vtkVisPipeline, SLOT(highlightGeoObject(const vtkPolyDataAlgorithm*, int))); + connect(stationTabWidget->treeView, SIGNAL(removeGeoItemSelection()), + _vtkVisPipeline, SLOT(removeHighlightedGeoObject())); @@ -447,7 +447,8 @@ void MainWindow::save() this, "Save data as", dir_str, - "GeoSys project (*.gsp);;GeoSys4 geometry files (*.gli);;GMSH geometry files (*.geo)"); + //"GeoSys project (*.gsp);;GeoSys4 geometry files (*.gli);;GMSH geometry files (*.geo)"); + "GeoSys project (*.gsp);;GMSH geometry files (*.geo)"); //Saving gli files is no longer possible if (!fileName.isEmpty()) { @@ -1120,8 +1121,8 @@ void MainWindow::showNewProcessDialog() void MainWindow::showLineEditDialog(const std::string &geoName) { LineEditDialog lineEdit(*(_geoModels->getPolylineVecObj(geoName))); - connect(&lineEdit, SIGNAL(connectPolylines(const std::string &, std::vector<size_t>, double, std::string, bool, bool)), - _geoModels, SLOT(connectPolylineSegments(const std::string &, std::vector<size_t>, double, std::string, bool, bool))); + connect(&lineEdit, SIGNAL(connectPolylines(const std::string&, std::vector<std::size_t>, double, std::string, bool, bool)), + _geoModels, SLOT(connectPolylineSegments(const std::string &, std::vector<std::size_t>, double, std::string, bool, bool))); lineEdit.exec(); }