Example #1
0
void StationTreeView::writeStratigraphiesAsImages(QString listName)
{
    std::map<std::string, GeoLib::Color> colorLookupTable =
        static_cast<VtkStationSource*>(static_cast<StationTreeModel*>
            (model())->vtkSource(listName.toStdString()))->getColorLookupTable();
    std::vector<ModelTreeItem*> lists = static_cast<StationTreeModel*>(model())->getLists();
    std::size_t nLists = lists.size();
    for (std::size_t i = 0; i < nLists; i++)
    {
        if ( listName.compare( lists[i]->data(0).toString() ) != 0 )
            continue;

        std::vector<GeoLib::Point*> const& stations =
            *dynamic_cast<BaseItem*>(lists[i]->getItem())->getStations();

        for (std::size_t i = 0; i < stations.size(); i++)
        {
            StratWindow* stratView = new StratWindow(
                static_cast<GeoLib::StationBorehole*>(stations[i]), &colorLookupTable);
            stratView->setAttribute(Qt::WA_DeleteOnClose);
            stratView->show();
            stratView->stationView->saveAsImage(QString::fromStdString(
                static_cast<GeoLib::StationBorehole*>(stations[i])->getName()) + ".jpg");
            stratView->close();
        }
    }
}
Example #2
0
void StationTreeView::displayStratigraphy()
{
    QModelIndex index = this->selectionModel()->currentIndex();

    QString temp_name;
    // get list name
    static_cast<StationTreeModel*>(model())->stationFromIndex(
            this->selectionModel()->currentIndex(), temp_name);
    // get color table (horrible way to do it but there you go ...)
    std::map<std::string, GeoLib::Color> colorLookupTable =
        static_cast<VtkStationSource*>(static_cast<StationTreeModel*>
            (model())->vtkSource(temp_name.toStdString()))->getColorLookupTable();
    StratWindow* stratView = new StratWindow(static_cast<GeoLib::StationBorehole*>
        (static_cast<StationTreeModel*>(model())->stationFromIndex(index,temp_name)), &colorLookupTable);
    stratView->setAttribute(Qt::WA_DeleteOnClose); // this fixes the memory leak shown by cppcheck
    stratView->show();
}
Example #3
0
void StationTreeView::writeStratigraphiesAsImages(QString listName)
{
	std::map<std::string,
	         GeoLib::Color*> colorLookupTable =
	        static_cast<VtkStationSource*>(static_cast<StationTreeModel*>(model())->vtkSource(
	                                               listName.
	                                               toStdString()))
	        ->getColorLookupTable();
	std::vector<ModelTreeItem*> lists = static_cast<StationTreeModel*>(model())->getLists();
	size_t nLists = lists.size();
	for (size_t i = 0; i < nLists; i++)
		if ( listName.toStdString().compare( lists[i]->data(0).toString().toStdString() )
		     == 0 )
		{
			const std::vector<GeoLib::Point*>* stations =
			        dynamic_cast<BaseItem*>(lists[i]->getItem())->getStations();

			for (size_t i = 0; i < stations->size(); i++)
			{
				StratWindow* stratView =
				        new StratWindow(static_cast<GeoLib::StationBorehole*>((*
				                                                               stations)
				                                                              [i]),
				                        &colorLookupTable);
				stratView->setAttribute(Qt::WA_DeleteOnClose); // this fixes the memory leak shown by cppcheck
				stratView->show();
				stratView->stationView->saveAsImage(
				        "c:/project/" +
				        QString::fromStdString(static_cast<GeoLib::StationBorehole*>((
				                                                                             *
				                                                                             stations)
				                                                                     [
				                                                                             i])->getName()) + ".jpg");
				stratView->close();
			}
		}
}