From b4f0eeb7fd6c307ff62d6d1769d39211e698bb5f Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Wed, 14 Dec 2011 16:50:45 +0000 Subject: [PATCH] This is version 5.2.07 by LB / TF / KR. Squashed commit of the following: commit 7960f958e9029699e48062a95be93d0c237c5254 Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Dec 14 15:26:56 2011 +0100 Some missing FiniteElement:: namespace prefixes. commit 39328362da0cf6b4bf0994364371c6d52375b83a Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Dec 14 15:04:06 2011 +0100 Fixed merge. commit b20f95a7a371615cc6da6271951a6349382a9163 Merge: 8c62f05 9423fb0 Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Dec 14 14:16:20 2011 +0100 Merge branch 'master' into ff * master: bugfix of the bugfix for GEMS coupling bugfixes for GEMS coupling (mainly Richards flow related)...this should not interfere with any other parts of the codes changed the last commit for PVD output - It's not necessary to change variable names in OUT according to coordinate systems. Variable names in VTU files will be automatically changed. updated PVD stuff - fixed a bug creating VTU files in a wrong directory. - added a feature automatically switching variable names for XZ problems. fixed minor issues - changed to output error messages if geometric dimension in MMP is not consistent with element dimension. - fixed OpenMP link error on Linux fixed critical bugs. let's see benchmark results... fixed a bug in reloading initial stress Add a feature to read asci element stresses, and remove the unused files of MSH from the CMakelist for non-GUI option fixed a bug while generating GMSH mesh; fixed a bug loading GMSH mesh enabled JOD-benchmarks in scripts/run_benchmarks.sh script GROUNDWATER_FLOW: Bugfix for 1D Elements in 2D (Coord_Trans) Squashed commit of the following: Conflicts: FEM/fem_ele_std.cpp FEM/rf_REACT_GEM.cpp FEM/vtk.cpp FileIO/MeshIO/GMSHInterface.cpp scripts/run_benchmarks.sh commit 8c62f052a145340e4f0a010597f4f31698fe3f8c Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Dec 14 12:49:09 2011 +0100 Bump version to 5.2.07 commit 40ac6736cf8a4acd2fb933a78d663f9a2677cbd9 Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Dec 14 11:17:25 2011 +0100 Point selection is working, A scalar field had to be generated inside VtkPointsSource because there was none that could be used by the threshold filter in VtkCompositeGeoObjectFilter. TODO: View gets reset when selecting a point. This is du to VisualizationWidget::updateViewOnLoad(). commit c7a5c1f90e4d2c97af84c20fbaed9a211b4e8f36 Merge: ba270e6 fba5bd3 Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Dec 13 16:40:13 2011 +0100 Merge branch 'ff' of vismac02.intranet.ufz.de:ogs5/sources into ff commit ba270e631e2283f38179e523feb897a4bfd0a826 Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Dec 13 16:39:48 2011 +0100 fixed a bug with displaying names for geo-objects commit fba5bd379e0ba449f22a242d7c929ad3e6a987b9 Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Dec 13 16:22:14 2011 +0100 setfill must be set, otherwise white space is used. commit f1b7aadf4cd6ee40a927d8c5648c3ccadecd6aa8 Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Dec 13 15:50:02 2011 +0100 It should work with the include. commit d0f32b7c3cd9266df5eb8f8d1ead6f73cae96dab Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Dec 13 15:42:53 2011 +0100 Forgot namespace. commit 9bfe3f00bcd725520b7f02915580e8806eb407d7 Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Dec 13 15:37:36 2011 +0100 Time steps in vtk output filenames have leading zeros now. commit ef2049b74276cd28a9f900512759e9293559f4ef Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Dec 13 15:08:12 2011 +0100 Test commit 5a61569311238db4525c41ae56c2128cefac5811 Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Dec 13 14:38:28 2011 +0100 Push test. commit 216c3fbbfb541662d35f82d229dbc9b0e7bb7b76 Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Dec 13 14:19:38 2011 +0100 Push test. commit 4d6f8310432fb4e836532c5c2e892c6cac3833ad Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Dec 13 14:10:17 2011 +0100 Push test. commit 4f2828a90f289b249371112803457271c6d560c7 Merge: f70cf0e a416aa8 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue Dec 13 14:00:33 2011 +0100 Merge branch 'ff' of vismac02.intranet.ufz.de:ogs5/sources into ff commit f70cf0e0a47d3d3ae4555af0682482337a440f06 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue Dec 13 13:59:49 2011 +0100 added TetGen interface to GUI commit a416aa82968938b828bee6aaafb130b462fa127a Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Dec 13 12:38:43 2011 +0100 Use isodate in About dialog. commit bd4b30a48ae4910fad7792d3f991317d8a52b5fe Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Dec 13 12:31:11 2011 +0100 radius is now correctly calculated upon highlighting a single polyline commit fcd1f745743ffa00ef695300afe357f70b61a85d Merge: cb8fc9b 8646aad Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue Dec 13 12:08:42 2011 +0100 Merge branch 'ff' of vismac02.intranet.ufz.de:ogs5/sources into ff commit cb8fc9b963a305fbdbd66720ab4d081c4d1ba1f4 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue Dec 13 12:07:36 2011 +0100 added a file converter (working in terminal) from GMSH mesh file into OGS mesh format commit 8df1cca1f1b03f2bdeb26515e9407fca8dd94c7e Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Dec 13 12:06:25 2011 +0100 moved about-menuitem to help-menu commit d7ba6b7935be34311de66b32f99c8d0f25e495ca Merge: 341e5c0 fcd1f74 Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Dec 13 11:53:22 2011 +0100 Merge branch 'ff' of vismac02.intranet.ufz.de:ogs5/sources into ff commit 341e5c0e69c3cd3684a644deae523e01f0757d32 Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Dec 13 11:52:38 2011 +0100 glyph and tube filter now calculate initial radius as double; fixed bug in geotreeview commit 8646aad9d652b1e863fe3644b7c175d9f23bb286 Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Dec 13 10:35:29 2011 +0100 Fixed compile error. commit 1499119b4bd2514d1b41ba0edb2a45ade67eace5 Merge: ba79eba c9190e4 Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Dec 13 10:13:51 2011 +0100 Merge branch 'ff' of vismac02.intranet.ufz.de:ogs5/sources into ff * 'ff' of vismac02.intranet.ufz.de:ogs5/sources: added tetgen-import to gui geo-objects can now be highlighted in render window (does not work for points); radius for glyph- and tube-filter is now calculated based on size of dataset Ups again... minor changes Conflicts: Qt/VtkVis/VtkCompositePointToGlyphFilter.cpp commit c9190e463fb71eeccad61f63cee16204dad0a63a Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Dec 13 09:33:07 2011 +0100 added tetgen-import to gui commit 5580cecd95430faf8bfa54d6e42d737b6d50854c Merge: c967b49 39c290a Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Dec 9 15:18:35 2011 +0100 Merge branch 'ff' of vismac02.intranet.ufz.de:ogs5/sources into ff commit c967b497a69f03f2e36ec6c3f0ec21b8d6cf6426 Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Dec 9 15:08:36 2011 +0100 geo-objects can now be highlighted in render window (does not work for points); radius for glyph- and tube-filter is now calculated based on size of dataset commit 39c290a2e4389bd6dea793916af27f70f7df9441 Author: Lars Bilke <lars.bilke@ufz.de> Date: Fri Dec 9 13:07:57 2011 +0100 Ups again... commit ba79ebacd1e024cba472dc2bc0cf2707e00dd442 Author: Lars Bilke <lars.bilke@ufz.de> Date: Thu Dec 8 15:19:45 2011 +0100 Added about dialog and additional informations when OGS_BUILD_INFO is enabled. commit 1fbca36849e38bdf5dc94b5775e9a0c3d8b143f2 Author: Lars Bilke <lars.bilke@ufz.de> Date: Thu Dec 8 12:55:12 2011 +0100 Point radius can now be a float. commit 54c9746e887071ec3d0dd556662212942288bb77 Merge: 9d407a4 85238cf Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Dec 6 08:46:05 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 9d407a42b787d7da36409ed01356fea9342f53a8 Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Dec 6 08:45:34 2011 +0100 minor changes commit 85238cfe464e88aa9095a3ef8f87c7ff674154d1 Merge: efcc836 28dbd2f Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Fri Dec 2 12:08:14 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit efcc836687734ed0a916a708416768d514198d7d Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Fri Dec 2 12:05:33 2011 +0100 - fixed a small bug in class GEOObjects - implemented an algorithm which allows to find nodes of a mesh belonging to a specific layer (damn - this is a hack :-( ) commit 28dbd2febb534c8cb9164b00b724d77f0ecb9b55 Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Dec 2 10:51:26 2011 +0100 compiler is now ignoring warning C4267 (int to size_t conversion), thus removing 600 warnings under win64; removed some (real) warnings commit 7617eaea8c8bef902173a774358b7fb40f8a2bdf Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Dec 2 10:01:16 2011 +0100 fixed a few details in femconditionsetup commit 0e9dfb71ebdc6871bfa03292def7d9e07998e9d5 Merge: dc178f5 046275e Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Dec 2 09:32:27 2011 +0100 adding and removing conditions from gui should work correctly now commit dc178f563e1371d50a661c5833c2930b65f48531 Author: Karsten Rink <karsten.rink@ufz.de> Date: Thu Dec 1 09:29:25 2011 +0100 xml cond files can be exported now, fixed a few warnings commit 90d77d6e85b9f889bf684c0ab7910566e19d9e5d Merge: c217d4b 68f2a74 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Wed Nov 30 13:29:24 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 046275e618be222238766b40240728a7afb4ce5b Merge: 8685164 90d77d6 Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Nov 30 13:21:29 2011 +0100 Merge branch 'ff' of 141.65.6.106:~/ogs_sources into ff * 'ff' of 141.65.6.106:~/ogs_sources: - added two new constructors to class CElem (you can directly create a triangle or quad element now) - switch attributes of class template vec to ensure memory will be allocated properly - made attribute CElem::tranform_tensor private and changed the name a little bit - made CElem::nodes_index private and wrote some getter and setter - fixed some warnings commit 8685164156a97ee47e2c77edf9cb77acd2d8229d Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Nov 30 13:20:10 2011 +0100 Ups... commit c217d4b0fe108f72a48c48cbc489a279044b3d49 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Wed Nov 30 13:19:56 2011 +0100 - added two new constructors to class CElem (you can directly create a triangle or quad element now) - switch attributes of class template vec to ensure memory will be allocated properly - made attribute CElem::tranform_tensor private and changed the name a little bit - made CElem::nodes_index private and wrote some getter and setter - fixed some warnings commit 68f2a74554ee0a97959f590e04f7970040964f9d Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Nov 30 12:06:29 2011 +0100 Fixed benchmark script. commit aaa37f368a982902934953eac1e5b6bd2318175d Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Nov 30 11:24:53 2011 +0100 Updated benchmark script. commit c5630578655a1cd848b8471f427b9f5dffeebcd9 Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Nov 30 11:09:18 2011 +0100 Deleted old scripts commit 836637821d83fef43dabb10b009eee51a5292d1f Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Nov 30 11:07:42 2011 +0100 Updated README commit bf44a136a73d63c00cbba0f27d302af28d56c9f0 Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Nov 30 10:10:13 2011 +0100 Forgot the build command. commit b4a8e10a80556132faef64f5ba6025fe9023cd5e Author: Lars Bilke <lars.bilke@ufz.de> Date: Wed Nov 30 09:56:44 2011 +0100 Unified config build script. commit 04b79f53894ce61bab5cb5b5a4475d214c73caed Author: Karsten Rink <karsten.rink@ufz.de> Date: Mon Nov 28 11:23:40 2011 +0100 changed const-iterator issue in projectdata commit da342bed5faf790ebda08b465ad86a91c10ea1fd Merge: 7c72d14 4614af0 Author: Karsten Rink <karsten.rink@ufz.de> Date: Mon Nov 28 11:11:01 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 7c72d144be1a12af665b5b301af44794c695426f Author: Karsten Rink <karsten.rink@ufz.de> Date: Mon Nov 28 11:09:27 2011 +0100 re-implemented raster to mesh conversion, also removed some bugs connected to that method commit 4614af07e0ad5ad17848865e9c57f62bed9aea3f Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Thu Nov 24 13:08:26 2011 +0100 fixed a bug in the geometric test commit de155f727ddbafe18830861c9270aa11ff674096 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Thu Nov 24 12:48:41 2011 +0100 added third parameter to function readGLIFileV4() that takes the unique geometric name commit d1b680ca9dd601c4625fc1e7a269a7352f8aebbe Author: Karsten Rink <karsten.rink@ufz.de> Date: Thu Nov 24 12:35:38 2011 +0100 some more small changes, loading FEM Conds from geometry added again commit bc73ba3621843f8b3a14f6d02172b93b2614f2c3 Merge: cf20e7d 4863eab Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Thu Nov 24 12:22:09 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit cf20e7d47006591155b6118f65ac6d0ed39cabef Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Thu Nov 24 12:19:24 2011 +0100 implemented operator== for polylines and polygons GMSHInterface: check if polygons are contained more the one time in geometry ModifyMeshProperties: modify material of mesh element if and only if the center of the element is in the polygon commit dd2fab3e9b4b14baa0cdd99981493ba68e0c5d9b Merge: 012c35b de155f7 Author: Karsten Rink <karsten.rink@ufz.de> Date: Thu Nov 24 12:00:46 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 012c35bcf371bd6c48483ee93ffc2a9f8e22b8d5 Merge: 2a5e527 bc73ba3 Author: Karsten Rink <karsten.rink@ufz.de> Date: Thu Nov 24 11:49:48 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 2a5e527205be48448e5496fb56d96c98070ca0c5 Author: Karsten Rink <karsten.rink@ufz.de> Date: Thu Nov 24 11:49:14 2011 +0100 some small changes (xml includes, etc.) commit 16ca7c29f7e35e0fb5f0afa79a61900c929fdc88 Author: Karsten Rink <karsten.rink@ufz.de> Date: Wed Nov 23 10:12:30 2011 +0100 split up xmlinterface into a class hierarchy; changed fem condition management toward an process oriented approach; visualisation of fem conditons is currently disabled commit a6630c6f069f888a496eb3a315efecfc5da53fba Merge: 23f0c2f 4863eab Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Nov 22 12:27:44 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 4863eab6658085288ab0bb34b0b6cdf5dd47c12b Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Nov 22 12:16:22 2011 +0100 Fixed script on Windows. Old bash version on Windows has not the =~ operator. commit 2692ba3ee7beac12c7ee0cba515a99ceee71d63a Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Nov 22 11:16:03 2011 +0100 Build scripts will use cmake to actually build the project. More work on separating common script parts. commit 9c837e558c25a689a642a926ec58e9f1cdec5611 Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Nov 22 11:14:51 2011 +0100 Fixed typo commit 3d527ea2f8726ebdd0fb08b6e77a2a2a6a089767 Merge: 4a20a09 7510d39 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue Nov 22 08:58:58 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 4a20a096699115ccff976c35cbe6d597482f7b09 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue Nov 22 08:58:42 2011 +0100 did some formating commit 683a4dc6397e3c3307737a2640a2929b2df64a36 Author: Lars Bilke <lars.bilke@ufz.de> Date: Tue Nov 22 08:57:20 2011 +0100 VCRedist should be found on VC++ 2010. commit 7510d39ce07db8bfca11f5ce9cc59026015baf02 Author: Lars Bilke <lars.bilke@ufz.de> Date: Mon Nov 21 12:50:17 2011 +0100 Last tweak commit 9f362225b27b15fd6ba4314a5e0df4191401abe8 Merge: b31ea1e 3a87b7c Author: Lars Bilke <lars.bilke@ufz.de> Date: Mon Nov 21 12:29:43 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff * 'ff' of 141.65.6.106:ogs_sources: initialiazed attributes of class CElem n CFEMesh::ConstructGrid() commit b31ea1e6b92630d12396e6717a5c09a54efd1427 Author: Lars Bilke <lars.bilke@ufz.de> Date: Mon Nov 21 12:29:39 2011 +0100 Windows build working. commit 3a87b7cf8c403b662e39cf1da3f2b510045894cc Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Mon Nov 21 12:26:32 2011 +0100 initialiazed attributes of class CElem n CFEMesh::ConstructGrid() commit 9f7cbb43b27ca1ea89a9d5a9a5566ea985eecfb0 Author: Lars Bilke <lars.bilke@ufz.de> Date: Fri Nov 18 16:51:46 2011 +0100 Fixed mac gui build. Modified win gui build script. commit 2a4a6cebc4473cf06ceeebe4dbd32d13c0a4b5f0 Author: Lars Bilke <lars.bilke@ufz.de> Date: Fri Nov 18 15:48:13 2011 +0100 Build script working locally. commit 23f0c2fa40128442e423de6f50a9276b401b6d99 Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Nov 18 14:37:32 2011 +0100 raster to mesh dialog should now work correctly commit 2acd8bd30c488f95f9060af004d02ee25e23154c Author: Lars Bilke <lars.bilke@ufz.de> Date: Fri Nov 18 14:26:44 2011 +0100 Fix commit 1c3cea8e9f73d452acdaba12abbf9b3e51342bb2 Merge: 93e2020 727ef6c Author: Lars Bilke <lars.bilke@ufz.de> Date: Fri Nov 18 12:13:53 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff * 'ff' of 141.65.6.106:ogs_sources: Debug builds must be built. removed changes again testing filename requirements for benchmarks commit 93e20201faade761f37bb42190813e488ef84c72 Author: Lars Bilke <lars.bilke@ufz.de> Date: Fri Nov 18 12:13:45 2011 +0100 Added README for build scripts. Added base dir with common scripts. commit 6acc4d595ec5d07c5daba66b8a2af6b85d414c1d Author: Lars Bilke <lars.bilke@ufz.de> Date: Fri Nov 18 12:12:21 2011 +0100 Refactoring build_gui.sh. commit 727ef6cb3d26ab0debcf53aee4b0e4cd35ce677d Merge: a111e60 4e4b98d Author: Lars Bilke <lars.bilke@ufz.de> Date: Fri Nov 18 11:26:03 2011 +0100 Merge branch 'ff' of 141.65.6.106:~/ogs_sources into ff commit a111e60d74174b2cad92393d432b1a109a304adf Author: Lars Bilke <lars.bilke@ufz.de> Date: Fri Nov 18 11:25:41 2011 +0100 Debug builds must be built. commit 4e4b98daf9a9656241f1b830a4abd3924bd81891 Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Nov 18 11:21:00 2011 +0100 removed changes again commit 5e3c3bae2a4fe48bba86bde19463b817beead8e9 Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Nov 18 11:06:51 2011 +0100 testing filename requirements for benchmarks commit 898985ab22ecd4b5558d91834c15d31acb410ebc Merge: a3e7eb7 6fc27fc Author: Lars Bilke <lars.bilke@ufz.de> Date: Thu Nov 17 16:40:44 2011 +0100 Merge branch 'ff' of 141.65.6.106:~/ogs_sources into ff commit 6fc27fc074a5d31955de104de16982e67e20f3c7 Author: Karsten Rink <karsten.rink@ufz.de> Date: Thu Nov 17 16:34:04 2011 +0100 fixed linux bug commit a3e7eb7a9e0917a5f9aaff3d4f57864ccbfb0a7f Author: Lars Bilke <lars.bilke@ufz.de> Date: Thu Nov 17 16:26:25 2011 +0100 New scripts working. commit 8914b6b38dd961b5d63cfd8518815a903ab94fe3 Author: Karsten Rink <karsten.rink@ufz.de> Date: Thu Nov 17 16:06:46 2011 +0100 Process specifiers can now be added/removed in GUI, raster to mesh conversion can now be parameterised via a special dialog commit 31873e96073ee639a6eceafd401089c80b2962d2 Author: Lars Bilke <lars.bilke@ufz.de> Date: Thu Nov 17 14:14:16 2011 +0100 New setup scripts from ogs6 added. commit a308af8d4467d2371ec03859403477579dd1dc8e Author: Lars Bilke <lars.bilke@ufz.de> Date: Thu Nov 17 10:18:10 2011 +0100 New build script wip. commit a7e39078b35bb0cd62f13d0a84d171c4a04617ea Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Nov 15 18:10:00 2011 +0100 problem finally fixed ... reintroducing some of the previous changes commit a173c97ed3861e9953595ba2878684c84dcba669 Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Nov 15 17:47:21 2011 +0100 i am running out of ideas commit 3b9d4db7021d46317bf06872b3ff3817d8f0acbf Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Nov 15 17:40:34 2011 +0100 removed some more changes commit 3f0a19f26b7942e97a5690d49489c4063c769763 Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Nov 15 17:29:54 2011 +0100 (hopefully) removed problem that causes unit tests to crash commit a8be05a0d9aea4c4b7c083c1a770c13a541e50fa Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Nov 15 17:06:17 2011 +0100 error in xmlinterface resolved commit eedb5afe48dbedf76a8541ed880509ec97854dd0 Merge: c9c20c4 ecaa84b Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Nov 15 16:46:15 2011 +0100 resolved conflict in XMLInterface commit c9c20c49daaabe13b8b1ed2913a424025e9f5892 Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Nov 15 16:43:25 2011 +0100 redesigned xml cond-fileformat and started adapting sourcesfor a different process-oriented model for data handling in GUI commit ecaa84bd68d3499a2b71622b43b0f7f7cc57e06b Merge: 3eeb7de ac2f440 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Fri Nov 11 13:07:26 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 3eeb7dea3236fc575e89487a1f70c74a7458f968 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Fri Nov 11 13:03:31 2011 +0100 fixed some compile errors since a the namespace FiniteElement was expanded for some enums and functions commit 05be9464e6a07a81f4adceeda4468d23ed048a8b Merge: cda4e9f be7b598 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Fri Nov 11 12:59:29 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff Conflicts: FEM/FEMCondition.cpp FEM/FEMCondition.h FEM/FEMEnums.cpp FEM/FEMEnums.h FileIO/XMLInterface.cpp commit ac2f44066cc3f1a5bd27f29cd11abeb25b412c24 Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Nov 11 11:46:56 2011 +0100 fixed a few (regular) warning commit a0a1a50ab32ff41eeb5d574b34d530615dcaecf2 Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Nov 11 11:12:14 2011 +0100 removed several conversion warnings commit be7b5987158c100a358d936b3d962ed0c40868f7 Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Nov 11 10:39:16 2011 +0100 (hopefully) finished renaming process commit a6dab3c80dcf3f9981d09106ee0fc4b9aeb34b06 Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Nov 11 10:23:14 2011 +0100 second part of renaming process commit 1b6eb93ab07e4c31e65fc19c2315af3004f13df0 Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Nov 11 09:52:33 2011 +0100 Renamed condition model related files to process model commit f0836b7a615765ca71d253e0fdfa2bba33060c9d Author: Karsten Rink <karsten.rink@ufz.de> Date: Thu Nov 10 11:54:36 2011 +0100 Added functionality to create FEMConditions in GUI commit cda4e9f5677a22952e3274848ace921497986aba Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Thu Nov 10 10:48:43 2011 +0100 moved enums ProcessType and PrimaryVariable into namespace FiniteElement commit fb73e16d6d1c3208e6d09c65b9f14d111cdef6b3 Author: Karsten Rink <karsten.rink@ufz.de> Date: Mon Nov 7 10:46:10 2011 +0100 transformfilters are now used correctly in the vtkvispipelineitem class-hierarchy commit 6672a1ede0c9c032c9dbc1be272815af871b2c25 Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Nov 4 12:45:28 2011 +0100 fixed some warnings commit 9c103b8b27cbdda49e177058aa5c871a90a372e2 Author: Karsten Rink <karsten.rink@ufz.de> Date: Fri Nov 4 11:34:07 2011 +0100 added image/raster translation; added volume-support to geometry-xml-format commit 973539e076b9b8e3b513a6de9904be74ea013f7d Author: Karsten Rink <karsten.rink@ufz.de> Date: Thu Nov 3 12:47:24 2011 +0100 optimized GeoTreeModel data insertion routines commit 4d8a7748823c5294126c330f57766f4cd5f32d67 Author: Karsten Rink <karsten.rink@ufz.de> Date: Wed Nov 2 17:08:54 2011 +0100 fixed linux-only syntax error ... the things i have to put up with ... commit e2a96da7e859d07f65d53012fbfaff957c1135ee Merge: 39f0f8c 77a98cc Author: Karsten Rink <karsten.rink@ufz.de> Date: Wed Nov 2 15:51:03 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 77a98cca10a16ff46d4a721a1bdc31c1d5716ec9 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Wed Nov 2 16:47:40 2011 +0100 made MFPRead a friend of class CFluidProperties commit b10b2498dd65bfa9ed324cc5bb63213f0bc0f16e Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Wed Nov 2 16:44:10 2011 +0100 cleaned class CFluidProperties a little bit (removed some attributes, wrote some getters, ...) commit 39f0f8c29d59395a712021b0a9108411894a4409 Author: Karsten Rink <karsten.rink@ufz.de> Date: Wed Nov 2 15:50:30 2011 +0100 fixed bug in geotreeview context menu commit 377c1146416a483866b35fe924bff340d83b7148 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Wed Nov 2 10:20:14 2011 +0100 removed some code that was uncommented commit 5bda38066ca06163aa8835627a77ee9a9f7d3772 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Wed Nov 2 10:14:20 2011 +0100 - fixed warnings in FEM/rf_kinreact.cpp, Qt/DataView/GEOModels.cpp and Qt/DataView/GeoTreeModel.cpp - derived PointVec from TemplateVec<Point> commit 646fec6bddc45b1a80f87013d0ab5c3bbf6953cc Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue Nov 1 16:34:24 2011 +0100 added another case for reading geometric type DOMAIN in GeoType.cpp in function convertGeoType() commit 094fcd8c1fb22a0f58995f4bb2326359b1224e00 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue Nov 1 14:00:38 2011 +0100 fixed small bugs commit e46fd128c53bda8b3b1e9ea7b2ea3d3eb6a1af61 Merge: d0088db 0cf4f3d Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue Nov 1 13:27:08 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit d0088db8bae228501881ce728afe6d5f4d3c2d24 Merge: 2880e48 a6660e6 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue Nov 1 13:25:14 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 2880e48c74ee05cd6767a76a599454abfc51d99e Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue Nov 1 13:24:54 2011 +0100 removed a warning in problem commit 829be8b05a749d06211572fc8aef9b5623ac4d16 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue Nov 1 12:58:10 2011 +0100 class CMediumProperties - changed the name and the type of attribute geo_name_type (string) to _geo_type (GEOLIB::GEOTYPE enum) and made the attribute private tools - uncommented an unused function msh_lib - changed access to the former public attribute geo_name_type of class CMediumProperties commit 0cf4f3d7853dde00265e1d6c0082fdb1b3522cdb Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Nov 1 12:27:01 2011 +0100 added missing files commit a6660e626bd417f24fc51dd140e959dcd6463883 Merge: 01dc021 829be8b Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Nov 1 12:09:25 2011 +0100 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 01dc02181b3b26f9139f8491e4f90fa58fb151f3 Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Nov 1 12:08:09 2011 +0100 names for geo-objects can new be changed from gui commit a9d3a95bad55dbedfb71164fd8f9eb79eb742188 Author: Karsten Rink <karsten.rink@ufz.de> Date: Mon Oct 24 15:40:44 2011 +0200 fixed missing std-specifier in problem.cpp commit 7398baaf82c2c915d2af2f52f876125b1458a800 Author: Karsten Rink <karsten.rink@ufz.de> Date: Mon Oct 24 15:18:28 2011 +0200 some more changes to properties commit 7eb9651be45dce4f2febc8fbc6af8a0125a771a7 Merge: 1dc27ab 40f1f49 Author: Karsten Rink <karsten.rink@ufz.de> Date: Mon Oct 24 14:40:51 2011 +0200 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 1dc27ab773d0ab2fe8e74a5c3f0df0363d3b560c Author: Karsten Rink <karsten.rink@ufz.de> Date: Mon Oct 24 14:40:12 2011 +0200 small changes to property-classes commit 40f1f491aa1ed62001be7ee0b504fbd771f6f3db Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Mon Oct 24 13:27:25 2011 +0200 - fixed a bug in binarySearch for double values - together with NB: changed algorithm for searching and interpolating in GetMatrixValue commit 7e6437a77f5b77e16b38c9b85e39f1bf5269a807 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Mon Oct 24 12:36:23 2011 +0200 - moved some functions out of file rf_pcs.cpp to eos.cpp - made attibute m_msh of class CMediumProperties private - remove a temporary variable of class CMediumProperties - made attribute geo_dimension of class CMediumProperties private commit db1abe1a54f04280778ed7c1686666fc3c6fc111 Merge: ab93755 da295c7 Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Oct 18 12:28:55 2011 +0200 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit ab93755870d5c4d5495f16d9775634e1071302a6 Author: Karsten Rink <karsten.rink@ufz.de> Date: Tue Oct 18 12:28:23 2011 +0200 some documentation commit da295c735d174374543368483bdf98ccc48f70ef Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Fri Oct 14 13:49:20 2011 +0200 - fixed issue concerning mesh generation - fixed a bug while loading a gmsh mesh commit c1fd11bd33b8603f052f52dbbe7b7cb360fbd7eb Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Fri Oct 14 10:14:58 2011 +0200 enabled benchmarks from JOD (former YW) commit 763039ac6c4098547c2fc5fcbd14fb67d1167da7 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Thu Oct 13 11:12:04 2011 +0200 removed all code enclosed in #ifdef RFW_FRACTURE ... #endif in files rf_mmp_new.{h,cpp} commit 5bc6ee9eb9e2f766c6a694188df27d49faeb2ee5 Merge: 04b7932 1ae3c19 Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Thu Oct 13 08:13:35 2011 +0200 Merge branch 'ff' of 141.65.6.106:ogs_sources into ff commit 04b793208c9504b2a7e020f9c0ef697777281a6d Author: Thomas Fischer <thomas.fischer@ufz.de> Date: Thu Oct 13 08:10:09 2011 +0200 removed 3 unused attributes (m_pcs, mfp_pcs, file_base_name) from class CFluidProperties commit 1ae3c1971c0a52c8a80cb69331a83eb60d599355 Author: Karsten Rink <karsten.rink@ufz.de> Date: Wed Oct 12 12:08:15 2011 +0200 added some comments git-svn-id: https://svn.ufz.de/svn/ogs/trunk/sources@9926 3895a583-e809-0410-9bb6-aa9463026377 --- Base/OGSError.cpp | 4 +- Base/OGSError.h | 4 +- Base/TreeItem.cpp | 3 +- CMakeLists.txt | 4 +- DataView/CMakeLists.txt | 37 +- DataView/CondObjectListItem.h | 19 +- DataView/ConditionModel.cpp | 266 ------- DataView/ConditionModel.h | 78 -- DataView/ConditionTabWidget.cpp | 17 - DataView/ConditionTabWidget.h | 24 - DataView/ConditionTabWidgetBase.ui | 34 - DataView/ConditionView.cpp | 79 -- DataView/DBConnectionDialog.h | 2 +- DataView/DataView.cpp | 6 +- DataView/DataView.h | 2 +- DataView/DiagramView/DetailWindow.cpp | 19 + DataView/DiagramView/DetailWindow.h | 3 + DataView/DiagramView/DiagramList.cpp | 6 +- DataView/DiagramView/DiagramScene.cpp | 26 +- DataView/FEMConditionSetup.ui | 170 ++++ DataView/FEMConditionSetupDialog.cpp | 170 ++++ DataView/FEMConditionSetupDialog.h | 65 ++ DataView/GEOModels.cpp | 27 + DataView/GEOModels.h | 2 + DataView/GMSHPrefsDialog.cpp | 2 +- DataView/GMSHPrefsDialog.h | 2 +- DataView/GeoObjectListItem.h | 6 + DataView/GeoTreeModel.cpp | 175 +++-- DataView/GeoTreeModel.h | 2 + DataView/GeoTreeView.cpp | 159 ++-- DataView/GeoTreeView.h | 20 +- DataView/LineEditDialog.h | 2 +- DataView/ListPropertiesDialog.h | 1 - DataView/ModellingTabWidget.cpp | 26 + DataView/ModellingTabWidget.h | 31 + DataView/ModellingTabWidgetBase.ui | 52 ++ DataView/MshEditDialog.h | 2 +- DataView/MshLayerMapper.cpp | 46 +- DataView/MshQualitySelectionDialog.h | 1 + DataView/MshTabWidget.cpp | 48 -- DataView/NewProcess.ui | 87 +++ DataView/NewProcessDialog.cpp | 42 + DataView/NewProcessDialog.h | 43 ++ DataView/OGSRaster.cpp | 40 +- DataView/ProcessItem.h | 34 + DataView/ProcessModel.cpp | 267 +++++++ DataView/ProcessModel.h | 87 +++ DataView/ProcessView.cpp | 88 +++ DataView/{ConditionView.h => ProcessView.h} | 20 +- DataView/QueryResultsDialog.h | 2 +- DataView/SHPImportDialog.h | 1 - DataView/SetNameDialog.cpp | 57 ++ DataView/SetNameDialog.h | 59 ++ Gui/CMakeLists.txt | 14 +- Gui/mainwindow.cpp | 724 ++++++------------ Gui/mainwindow.h | 16 +- Gui/mainwindow.ui | 45 +- VtkVis/CMakeLists.txt | 5 + VtkVis/MeshFromRaster.ui | 156 ++++ VtkVis/MeshFromRasterDialog.cpp | 43 ++ VtkVis/MeshFromRasterDialog.h | 40 + VtkVis/VtkCompositeContourFilter.cpp | 2 +- VtkVis/VtkCompositeGeoObjectFilter.cpp | 97 +++ VtkVis/VtkCompositeGeoObjectFilter.h | 39 + VtkVis/VtkCompositeLineToTubeFilter.cpp | 24 +- VtkVis/VtkCompositeLineToTubeFilter.h | 1 + VtkVis/VtkCompositePointToGlyphFilter.cpp | 16 +- VtkVis/VtkCompositePointToGlyphFilter.h | 2 + VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp | 3 +- VtkVis/VtkConditionSource.cpp | 41 +- VtkVis/VtkConditionSource.h | 1 + VtkVis/VtkFilterFactory.cpp | 3 + VtkVis/VtkGeoImageSource.cpp | 9 +- VtkVis/VtkGeoImageSource.h | 2 +- VtkVis/VtkMeshConverter.cpp | 139 +++- VtkVis/VtkMeshConverter.h | 24 +- VtkVis/VtkPointsSource.cpp | 11 + VtkVis/VtkStationSource.cpp | 2 +- VtkVis/VtkVisImageItem.cpp | 35 +- VtkVis/VtkVisImageItem.h | 19 +- VtkVis/VtkVisPipeline.cpp | 62 +- VtkVis/VtkVisPipeline.h | 21 +- VtkVis/VtkVisPipelineItem.cpp | 15 +- VtkVis/VtkVisPipelineItem.h | 38 +- VtkVis/VtkVisPipelineView.cpp | 53 +- VtkVis/VtkVisPipelineView.h | 6 +- VtkVis/VtkVisPointSetItem.cpp | 63 +- VtkVis/VtkVisPointSetItem.h | 34 +- VtkVis/VtkVisTabWidget.cpp | 28 +- 89 files changed, 2782 insertions(+), 1520 deletions(-) delete mode 100644 DataView/ConditionModel.cpp delete mode 100644 DataView/ConditionModel.h delete mode 100644 DataView/ConditionTabWidget.cpp delete mode 100644 DataView/ConditionTabWidget.h delete mode 100644 DataView/ConditionTabWidgetBase.ui delete mode 100644 DataView/ConditionView.cpp create mode 100644 DataView/FEMConditionSetup.ui create mode 100644 DataView/FEMConditionSetupDialog.cpp create mode 100644 DataView/FEMConditionSetupDialog.h create mode 100644 DataView/ModellingTabWidget.cpp create mode 100644 DataView/ModellingTabWidget.h create mode 100644 DataView/ModellingTabWidgetBase.ui create mode 100644 DataView/NewProcess.ui create mode 100644 DataView/NewProcessDialog.cpp create mode 100644 DataView/NewProcessDialog.h create mode 100644 DataView/ProcessItem.h create mode 100644 DataView/ProcessModel.cpp create mode 100644 DataView/ProcessModel.h create mode 100644 DataView/ProcessView.cpp rename DataView/{ConditionView.h => ProcessView.h} (66%) create mode 100644 DataView/SetNameDialog.cpp create mode 100644 DataView/SetNameDialog.h create mode 100644 VtkVis/MeshFromRaster.ui create mode 100644 VtkVis/MeshFromRasterDialog.cpp create mode 100644 VtkVis/MeshFromRasterDialog.h create mode 100644 VtkVis/VtkCompositeGeoObjectFilter.cpp create mode 100644 VtkVis/VtkCompositeGeoObjectFilter.h diff --git a/Base/OGSError.cpp b/Base/OGSError.cpp index 434f578d11d..5620ee67210 100644 --- a/Base/OGSError.cpp +++ b/Base/OGSError.cpp @@ -17,7 +17,7 @@ OGSError::~OGSError() * Displays an error in a QMessageBox * \param e The error message. */ -void OGSError::box(QString e) +void OGSError::box(const QString &e) { box(e, "OpenGeoSys"); } @@ -28,7 +28,7 @@ void OGSError::box(QString e) * \param t The title of the message box * \sa QMessageBox */ -void OGSError::box(QString e, QString t) +void OGSError::box(const QString &e, const QString &t) { QMessageBox msgBox; msgBox.setWindowTitle(t); diff --git a/Base/OGSError.h b/Base/OGSError.h index fd6ce0839cc..99de59763fb 100644 --- a/Base/OGSError.h +++ b/Base/OGSError.h @@ -14,8 +14,8 @@ class QString; class OGSError { public: - static void box(QString e); - static void box(QString e, QString t); + static void box(const QString &e); + static void box(const QString &e, const QString &t); protected: OGSError(); diff --git a/Base/TreeItem.cpp b/Base/TreeItem.cpp index bbb4147690f..0182de58ae5 100644 --- a/Base/TreeItem.cpp +++ b/Base/TreeItem.cpp @@ -10,9 +10,8 @@ * and the data associated with each column. */ TreeItem::TreeItem(const QList<QVariant> &data, TreeItem* parent) +: _itemData(data), _parentItem(parent) { - _parentItem = parent; - _itemData = data; } /** diff --git a/CMakeLists.txt b/CMakeLists.txt index 782ced848cf..8b826640341 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,11 +4,13 @@ ENDIF (NOT VTK_FOUND) INCLUDE( ${VTK_USE_FILE} ) # Find libgeotiff -FIND_PACKAGE( LibTiff ) FIND_PACKAGE( LibGeoTiff ) IF(libgeotiff_FOUND) ADD_DEFINITIONS(-Dlibgeotiff_FOUND) ENDIF() # libgeotiff_FOUND +IF(NOT MSVC) + FIND_PACKAGE( LibTiff ) +ENDIF() # NOT MSVC SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /ZI /Od /Ob0") diff --git a/DataView/CMakeLists.txt b/DataView/CMakeLists.txt index 5ce494aed43..4d4bbf31177 100644 --- a/DataView/CMakeLists.txt +++ b/DataView/CMakeLists.txt @@ -2,13 +2,11 @@ set( SOURCES ColorTableModel.cpp ColorTableView.cpp - ConditionModel.cpp - ConditionTabWidget.cpp - ConditionView.cpp DatabaseConnection.cpp DataView.cpp DBConnectionDialog.cpp ElementTreeModel.cpp + FEMConditionSetupDialog.cpp GEOModels.cpp GeoTabWidget.cpp GeoTreeModel.cpp @@ -16,6 +14,7 @@ set( SOURCES GMSHPrefsDialog.cpp LineEditDialog.cpp ListPropertiesDialog.cpp + ModellingTabWidget.cpp ModelTreeItem.cpp MshEditDialog.cpp MshItem.cpp @@ -23,8 +22,12 @@ set( SOURCES MshModel.cpp MshQualitySelectionDialog.cpp MshTabWidget.cpp + NewProcessDialog.cpp OGSRaster.cpp + ProcessModel.cpp + ProcessView.cpp QueryResultsDialog.cpp + SetNameDialog.cpp StationTabWidget.cpp StationTreeModel.cpp StationTreeView.cpp @@ -34,13 +37,12 @@ set( SOURCES set( MOC_HEADERS ColorTableModel.h ColorTableView.h - ConditionModel.h - ConditionTabWidget.h - ConditionView.h + CondItem.h DatabaseConnection.h DataView.h DBConnectionDialog.h ElementTreeModel.h + FEMConditionSetupDialog.h GEOModels.h GeoTabWidget.h GeoTreeModel.h @@ -48,11 +50,16 @@ set( MOC_HEADERS GMSHPrefsDialog.h LineEditDialog.h ListPropertiesDialog.h + ModellingTabWidget.h MshEditDialog.h MshModel.h MshQualitySelectionDialog.h MshTabWidget.h + NewProcessDialog.h + ProcessModel.h + ProcessView.h QueryResultsDialog.h + SetNameDialog.h StationTabWidget.h StationTreeModel.h StationTreeView.h @@ -61,7 +68,7 @@ set( MOC_HEADERS # Header files set( HEADERS BaseItem.h - CondItem.h + ProcessItem.h CondObjectListItem.h GeoObjectListItem.h GeoTreeItem.h @@ -73,15 +80,17 @@ set( HEADERS # UI files set( UIS - ConditionTabWidgetBase.ui DatabaseResultView.ui DBConnection.ui + FEMConditionSetup.ui GeoTabWidgetBase.ui GMSHPrefs.ui LineEdit.ui + ModellingTabWidgetBase.ui MshEdit.ui MshQualitySelection.ui MshTabWidgetBase.ui + NewProcess.ui StationTabWidgetBase.ui ) @@ -137,9 +146,9 @@ IF (OGS_USE_OPENSG) INCLUDE_DIRECTORIES( ${OpenSG_INCLUDE_DIRS} ) ENDIF (OGS_USE_OPENSG) -IF (libtiff_FOUND AND libgeotiff_FOUND) - INCLUDE_DIRECTORIES( ${libtiff_INCLUDE_DIR} ${libgeotiff_INCLUDE_DIR} ) -ENDIF () # libtiff_FOUND AND libgeotiff_FOUND +IF (libgeotiff_FOUND) + INCLUDE_DIRECTORIES( ${libgeotiff_INCLUDE_DIR} ${libgeotiff_INCLUDE_DIR}/libxtiff ${VTK_DIR}/../Utilities/vtktiff ) +ENDIF () # libgeotiff_FOUND # Put moc files in a project folder source_group("UI Files" REGULAR_EXPRESSION "\\w*\\.ui") @@ -171,6 +180,6 @@ target_link_libraries( QtDataView IF (Shapelib_FOUND) TARGET_LINK_LIBRARIES( QtDataView ${Shapelib_LIBRARIES} ) ENDIF () # Shapelib_FOUND -IF (libtiff_FOUND AND libgeotiff_FOUND) - TARGET_LINK_LIBRARIES( QtDataView ${libtiff_LIBRARIES} ${libgeotiff_LIBRARIES} ) -ENDIF () # libtiff_FOUND AND libgeotiff_FOUND +IF (libgeotiff_FOUND) + TARGET_LINK_LIBRARIES( QtDataView ${libgeotiff_LIBRARIES} ) +ENDIF () # libgeotiff_FOUND diff --git a/DataView/CondObjectListItem.h b/DataView/CondObjectListItem.h index 873398fb323..7f4934de393 100644 --- a/DataView/CondObjectListItem.h +++ b/DataView/CondObjectListItem.h @@ -28,10 +28,9 @@ public: /// Constructor for the TreeItem specifying FEM Conditions. CondObjectListItem(const QList<QVariant> &data, TreeItem* parent, - FEMCondition::CondType type, + const FEMCondition::CondType type, const std::vector<GEOLIB::Point*>* points) - : TreeItem(data, - parent), _vtkSource(VtkConditionSource::New()), _type(type), + : TreeItem(data, parent), _vtkSource(VtkConditionSource::New()), _type(type), _cond_vec(new std::vector<FEMCondition*>) { QString display_name = parent->data(0).toString().append(" - ").append( @@ -54,20 +53,10 @@ public: } /// Returns the type of geo-objects contained in the subtree of this item. - FEMCondition::CondType getType() { return _type; } + FEMCondition::CondType getType() const { return _type; }; /// Returns the Vtk polydata source object - vtkPolyDataAlgorithm* vtkSource() const - { - return _vtkSource; - /* - vtkThresholdPoints* threshold = vtkThresholdPoints::New(); - threshold->SetInputConnection(_vtkSource->GetOutputPort()); - threshold->ThresholdByUpper(-9998); - threshold->Update(); - return threshold; - */ - } + vtkPolyDataAlgorithm* vtkSource() const { return _vtkSource; }; private: /// The Vtk data source object. This is the starting point for a Vtk data visualization pipeline. diff --git a/DataView/ConditionModel.cpp b/DataView/ConditionModel.cpp deleted file mode 100644 index 3192f3b2be4..00000000000 --- a/DataView/ConditionModel.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/** - * \file ConditionModel.cpp - * 18/10/2010 KR Initial implementation - */ - -// ** INCLUDES ** -#include "CondItem.h" -#include "CondObjectListItem.h" -#include "ConditionModel.h" -#include "FEMCondition.h" -#include "GEOObjects.h" -#include "GeoObject.h" -#include "GeoType.h" - -#include <QFileInfo> -#include <vtkPolyDataAlgorithm.h> - -ConditionModel::ConditionModel( ProjectData &project, QObject* parent /*= 0*/ ) - : TreeModel(parent), _project(project) -{ - QList<QVariant> rootData; - delete _rootItem; - rootData << "Name" << "Value" << "" << "" << ""; - _rootItem = new TreeItem(rootData, NULL); -} - -ConditionModel::~ConditionModel() -{ -} - -int ConditionModel::columnCount( const QModelIndex &parent /*= QModelIndex()*/ ) const -{ - Q_UNUSED(parent) - - return 2; -} - -void ConditionModel::addConditionItem(FEMCondition* c) -{ - TreeItem* geoParent = - this->getGEOParent(QString::fromStdString(c->getAssociatedGeometryName()), true); - CondObjectListItem* condParent = this->getCondParent(geoParent, c->getCondType()); - if (condParent == NULL) - condParent = this->createCondParent(geoParent, c->getCondType()); - - if (condParent) - { - QList<QVariant> condData; - condData << QString::fromStdString(c->getGeoName()) << QString::fromStdString( - c->getGeoTypeAsString()); - CondItem* condItem = new CondItem(condData, condParent, c); - condParent->appendChild(condItem); - // add process information - QList<QVariant> pcsData; - pcsData << QString::fromStdString(convertProcessTypeToString(c->getProcessType())); - TreeItem* pcsInfo = new TreeItem(pcsData, condItem); - // add information on primary variable - QList<QVariant> pvData; - pvData << - QString::fromStdString(convertPrimaryVariableToString(c->getProcessPrimaryVariable())); - TreeItem* pvInfo = new TreeItem(pvData, condItem); - // add distribution information - QList<QVariant> disData; - disData << - QString::fromStdString(convertDisTypeToString(c->getProcessDistributionType())); - std::vector<double> dis_value = c->getDisValue(); - TreeItem* disInfo; - if (!(c->getProcessDistributionType() == FiniteElement::LINEAR || - c->getProcessDistributionType() == FiniteElement::LINEAR_NEUMANN)) - { - for (size_t i = 0; i < dis_value.size(); i++) - disData << dis_value[i]; - disInfo = new TreeItem(disData, condItem); - } - else - { - size_t nVals = dis_value.size() / 2; - disData << static_cast<int>(nVals); - disInfo = new TreeItem(disData, condItem); - for (size_t i = 0; i < nVals; i++) - { - QList<QVariant> linData; - linData << dis_value[2 * i] << dis_value[2 * i + 1]; - TreeItem* linInfo = new TreeItem(linData, disInfo); - disInfo->appendChild(linInfo); - } - } - - condItem->appendChild(pcsInfo); - condItem->appendChild(pvInfo); - condItem->appendChild(disInfo); - - condParent->addCondition(c); - reset(); - } - else - std::cout << - "Error in ConditionModel::addConditionItem() - Parent object not found..." << - std::endl; -} - -void ConditionModel::addConditions(std::vector<FEMCondition*> &conditions) -{ - for (size_t i = 0; i < conditions.size(); i++) - { - bool is_domain = (conditions[i]->getGeoType() == GEOLIB::GEODOMAIN) ? true : false; - const GEOLIB::GeoObject* object = this->getGEOObject( - conditions[i]->getAssociatedGeometryName(), - conditions[i]->getGeoType(), - conditions[i]->getGeoName()); - if (object || is_domain) - { - conditions[i]->setGeoObj(object); - _project.addCondition(conditions[i]); - this->addConditionItem(conditions[i]); - } - else - std::cout << - "Error in ConditionModel::addConditions() - Specified geometrical object " - << conditions[i]->getGeoName() << - " not found in associated geometry..." << - std::endl; - } -} -/* - bool ConditionModel::removeConditionItem(const QModelIndex &idx) - { - if (idx.isValid()) - { - CondItem* item = dynamic_cast<CondItem*>(this->getItem(idx)); - if (item) - { - emit conditionRemoved(this, idx); - TreeItem* parent = item->parentItem(); - if (parent->childCount() <=1) - this->removeFEMConditions(QString::fromStdString(item->getItem()->getAssociatedGeometryName()), item->getItem()->getCondType()); - else - parent->removeChildren(item->row(),1); - reset(); - return true; - } - } - - std::cout << "ConditionModel::removeCondition() - Specified index does not exist." << std::endl; - return false; - } - */ - -void ConditionModel::removeFEMConditions(const QString &geometry_name, FEMCondition::CondType type) -{ - TreeItem* geoParent = this->getGEOParent(geometry_name); - emit conditionsRemoved(this, geometry_name.toStdString(), type); - - if ((type == FEMCondition::UNSPECIFIED) || (geoParent->childCount() <= 1)) //remove all conditions for the given geometry - removeRows(geoParent->row(), 1, QModelIndex()); - else - { - TreeItem* condParent = getCondParent(geoParent, type); - removeRows(condParent->row(), 1, index(geoParent->row(), 0)); - } - _project.removeConditions(geometry_name.toStdString(), type); -} - -const GEOLIB::GeoObject* ConditionModel::getGEOObject(const std::string &geo_name, - GEOLIB::GEOTYPE type, - const std::string &obj_name) const -{ - if (type == GEOLIB::POINT) - return this->_project.getGEOObjects()->getPointVecObj(geo_name)->getElementByName( - obj_name); - else if (type == GEOLIB::POLYLINE) - return this->_project.getGEOObjects()->getPolylineVecObj(geo_name)-> - getElementByName(obj_name); - else if (type == GEOLIB::SURFACE) - return this->_project.getGEOObjects()->getSurfaceVecObj(geo_name)->getElementByName( - obj_name); - return NULL; -} - -int ConditionModel::getGEOIndex(const std::string &geo_name, - GEOLIB::GEOTYPE type, - const std::string &obj_name) const -{ - bool exists(false); - size_t idx(0); - if (type == GEOLIB::POINT) - exists = - this->_project.getGEOObjects()->getPointVecObj(geo_name)-> - getElementIDByName( - obj_name, - idx); - else if (type == GEOLIB::POLYLINE) - exists = - this->_project.getGEOObjects()->getPolylineVecObj(geo_name)-> - getElementIDByName( - obj_name, - idx); - else if (type == GEOLIB::SURFACE) - exists = - this->_project.getGEOObjects()->getSurfaceVecObj(geo_name)-> - getElementIDByName( - obj_name, - idx); - - if (exists) - return idx; - return -1; -} - -TreeItem* ConditionModel::getGEOParent(const QString &geoName, bool create_item) -{ - int nLists = _rootItem->childCount(); - for (int i = 0; i < nLists; i++) - if (_rootItem->child(i)->data(0).toString().compare(geoName) == 0) - return _rootItem->child(i); - - if (create_item) - { - QList<QVariant> geoData; - geoData << QVariant(geoName) << ""; - TreeItem* geo = new TreeItem(geoData, _rootItem); - _rootItem->appendChild(geo); - return geo; - } - return NULL; -} - -CondObjectListItem* ConditionModel::getCondParent(TreeItem* parent, FEMCondition::CondType type) -{ - int nLists = parent->childCount(); - for (int i = 0; i < nLists; i++) - if (dynamic_cast<CondObjectListItem*>(parent->child(i))->getType() == type) - return dynamic_cast<CondObjectListItem*>(parent->child(i)); - return NULL; -} - -CondObjectListItem* ConditionModel::createCondParent(TreeItem* parent, FEMCondition::CondType type) -{ - QString condType(QString::fromStdString(FEMCondition::condTypeToString(type))); - QList<QVariant> condData; - condData << condType << ""; - - std::string geo_name = parent->data(0).toString().toStdString(); - const std::vector<GEOLIB::Point*>* pnts = _project.getGEOObjects()->getPointVec(geo_name); - if (pnts) - { - CondObjectListItem* cond = new CondObjectListItem(condData, parent, type, pnts); - parent->appendChild(cond); - emit conditionAdded(this, parent->data(0).toString().toStdString(), type); - return cond; - } - return NULL; -} - -vtkPolyDataAlgorithm* ConditionModel::vtkSource(const std::string &name, - FEMCondition::CondType type) -{ - TreeItem* geoParent = this->getGEOParent(QString::fromStdString(name)); - if (geoParent) - { - CondObjectListItem* condParent = this->getCondParent(geoParent, type); - if (condParent) - return condParent->vtkSource(); - } - return NULL; -} diff --git a/DataView/ConditionModel.h b/DataView/ConditionModel.h deleted file mode 100644 index c77ebdba0c3..00000000000 --- a/DataView/ConditionModel.h +++ /dev/null @@ -1,78 +0,0 @@ -/** - * \file ConditionModel.h - * 18/10/2010 KR Initial implementation - */ - -#ifndef CONDITIONMODEL_H -#define CONDITIONMODEL_H - -// ** INCLUDES ** -#include "ProjectData.h" -#include "TreeModel.h" - -class FEMCondition; -class CondObjectListItem; -class vtkPolyDataAlgorithm; - -namespace GEOLIB -{ -class GeoObject; -class GeoType; -} - -/** - * \brief A model for the ConditionView implementing a tree of FEM-Conditions (BCs, ICs, STs) as a double-linked list. - * \sa TreeModel, ConditionView, TreeItem, CondObjectListItem - */ -class ConditionModel : public TreeModel -{ - Q_OBJECT - -public: - ConditionModel(ProjectData &project, QObject* parent = 0); - ~ConditionModel(); - - int columnCount(const QModelIndex& parent = QModelIndex()) const; - /// Returns the vtk source object for the specified subtree of a geometry with the given name. - vtkPolyDataAlgorithm* vtkSource(const std::string &name, FEMCondition::CondType type); - -public slots: - /// Adds a vector of FEM Conditions to the model. Objects in the vector can consist of BCs, ICs or STs in any combination and sequence. - void addConditions(std::vector<FEMCondition*> &conditions); - - /// Removes a subtree (BCs, ICs, STs) from the the model. If all conditions for a given geometry are removed, this tree is completely removed. - void removeFEMConditions(const QString &geometry_name, - FEMCondition::CondType type = FEMCondition::UNSPECIFIED); - -private: - /// Adds a new FEM condition to the condition tree model. - void addConditionItem(FEMCondition* conditions); - - /// Removes the FEM condition with the given index. - //bool removeConditionItem(const QModelIndex &idx); - - /// Creates the TreeItem for one of the condition subtrees. - CondObjectListItem* createCondParent(TreeItem* parent, FEMCondition::CondType type); - - /// Returns the subtree-item for a given type of condtion. - CondObjectListItem* getCondParent(TreeItem* parent, FEMCondition::CondType type); - - /// Returns the subtree item for a geometry with the given name. If create_item is true, this item will be created if it doesn't exist yet. - TreeItem* getGEOParent(const QString &geoName, bool create_item = false); - /// Returns the geo object for a geometric item of the given name and type for the associated geometry. - const GEOLIB::GeoObject* getGEOObject(const std::string &geo_name, - GEOLIB::GEOTYPE type, - const std::string &obj_name) const; - /// Returns the index of a geometric item of the given name and type for the associated geometry. - int getGEOIndex(const std::string &geo_name, - GEOLIB::GEOTYPE type, - const std::string &obj_name) const; - - ProjectData& _project; - -signals: - void conditionAdded(ConditionModel*, const std::string &name, FEMCondition::CondType); - void conditionsRemoved(ConditionModel*, const std::string &name, FEMCondition::CondType); -}; - -#endif // CONDITIONMODEL_H diff --git a/DataView/ConditionTabWidget.cpp b/DataView/ConditionTabWidget.cpp deleted file mode 100644 index 10323c838e3..00000000000 --- a/DataView/ConditionTabWidget.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/** - * \file ConditionTabWidget.cpp - * 2010/12/14 KR Initial implementation - * - * Implementation of StationTabWidget - */ - -// ** INCLUDES ** -#include "ConditionModel.h" -#include "ConditionTabWidget.h" -#include "TreeItem.h" - -ConditionTabWidget::ConditionTabWidget( QWidget* parent /*= 0*/ ) - : QWidget(parent) -{ - setupUi(this); -} diff --git a/DataView/ConditionTabWidget.h b/DataView/ConditionTabWidget.h deleted file mode 100644 index 076d6360d04..00000000000 --- a/DataView/ConditionTabWidget.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * \file ConditionTabWidget.h - * 2010/12/14 KR Initial implementation - * - */ - -#ifndef CONDITIONTABWIDGET_H -#define CONDITIONTABWIDGET_H - -// ** INCLUDES ** -#include "ui_ConditionTabWidgetBase.h" - -/** - * \brief Widget containing the ConditionView. - */ -class ConditionTabWidget : public QWidget, public Ui_ConditionTabWidgetBase -{ - Q_OBJECT - -public: - ConditionTabWidget(QWidget* parent = 0); -}; - -#endif // CONDITIONTABWIDGET_H diff --git a/DataView/ConditionTabWidgetBase.ui b/DataView/ConditionTabWidgetBase.ui deleted file mode 100644 index 2b9a2aaa98d..00000000000 --- a/DataView/ConditionTabWidgetBase.ui +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>ConditionTabWidgetBase</class> - <widget class="QWidget" name="ConditionTabWidgetBase"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>250</width> - <height>500</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="margin"> - <number>2</number> - </property> - <item> - <widget class="ConditionView" name="treeView"/> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>ConditionView</class> - <extends>QTreeView</extends> - <header>ConditionView.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/DataView/ConditionView.cpp b/DataView/ConditionView.cpp deleted file mode 100644 index b865854f26d..00000000000 --- a/DataView/ConditionView.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/** - * \file ConditionView.cpp - * 2010/12/13 KR Initial implementation - */ - -#include <QMenu> - -#include "CondItem.h" -#include "CondObjectListItem.h" -#include "ConditionModel.h" -#include "ConditionView.h" - -ConditionView::ConditionView(QWidget* parent) : QTreeView(parent) -{ -} - -void ConditionView::updateView() -{ - setAlternatingRowColors(true); - resizeColumnToContents(0); - setColumnWidth(1,50); - setColumnWidth(2,50); -} - -void ConditionView::on_Clicked(QModelIndex idx) -{ - qDebug("%d, %d",idx.parent().row(), idx.row()); -} - -void ConditionView::selectionChanged( const QItemSelection &selected, - const QItemSelection &deselected ) -{ - emit itemSelectionChanged(selected, deselected); - return QTreeView::selectionChanged(selected, deselected); -} - -void ConditionView::contextMenuEvent( QContextMenuEvent* event ) -{ - Q_UNUSED(event); - - CondObjectListItem* item = - dynamic_cast<CondObjectListItem*>(static_cast<ConditionModel*>(this->model())-> - getItem(this - -> - selectionModel()->currentIndex())); - if (item) - { - QMenu menu; - QAction* removeAction = menu.addAction("Remove"); - connect(removeAction, SIGNAL(triggered()), this, SLOT(removeCondition())); - menu.exec(event->globalPos()); - } -} - -void ConditionView::removeCondition() -{ - CondObjectListItem* item = - dynamic_cast<CondObjectListItem*>(static_cast<ConditionModel*>(this->model())-> - getItem(this - -> - selectionModel()->currentIndex())); - QString geo_name = item->parentItem()->data(0).toString(); - FEMCondition::CondType type = item->getType(); - emit conditionsRemoved(geo_name, type); -} -/* - void ConditionView::removeAllConditions() - { - ConditionModel* model = static_cast<ConditionModel*>(this->model()); - - for (size_t j=0; j<3; j++) - { - QModelIndex parentIndex = model->index(j, 0, QModelIndex()); - int nChildren = model->getItem(parentIndex)->childCount(); - for (int i=nChildren; i>=0; i--) - emit requestConditionRemoval(model->index(i, 0, parentIndex)); - } - } - */ diff --git a/DataView/DBConnectionDialog.h b/DataView/DBConnectionDialog.h index 7385933faae..65bf87d4543 100644 --- a/DataView/DBConnectionDialog.h +++ b/DataView/DBConnectionDialog.h @@ -8,7 +8,7 @@ #include "ui_DBConnection.h" #include <QSqlQueryModel> -#include <QtGui/QMainWindow> +#include <QDialog> /** * \brief A dialog window for settung up a database connection diff --git a/DataView/DataView.cpp b/DataView/DataView.cpp index 9d500cdee8c..d77883d79b1 100644 --- a/DataView/DataView.cpp +++ b/DataView/DataView.cpp @@ -80,13 +80,13 @@ void DataView::contextMenuEvent( QContextMenuEvent* event ) QAction* checkMeshAction = menu.addAction("Check mesh quality..."); QAction* saveMeshAction = menu.addAction("Save mesh..."); menu.addSeparator(); - QAction* directSTAction = menu.addAction("Add DIRECT source terms..."); + QAction* directSTAction = menu.addAction("Load DIRECT source terms..."); menu.addSeparator(); QAction* removeMeshAction = menu.addAction("Remove mesh"); connect(editMeshAction, SIGNAL(triggered()), this, SLOT(openMshEditDialog())); connect(checkMeshAction, SIGNAL(triggered()), this, SLOT(checkMeshQuality())); connect(saveMeshAction, SIGNAL(triggered()), this, SLOT(writeMeshToFile())); - connect(directSTAction, SIGNAL(triggered()), this, SLOT(addDIRECTSourceTerms())); + connect(directSTAction, SIGNAL(triggered()), this, SLOT(loadDIRECTSourceTerms())); connect(removeMeshAction, SIGNAL(triggered()), this, SLOT(removeMesh())); menu.exec(event->globalPos()); } @@ -146,7 +146,7 @@ int DataView::writeMeshToFile() const return 0; } -void DataView::addDIRECTSourceTerms() +void DataView::loadDIRECTSourceTerms() { QModelIndex index = this->selectionModel()->currentIndex(); const std::vector<GEOLIB::Point*>* points = static_cast<MshModel*>(this->model())->getMesh( diff --git a/DataView/DataView.h b/DataView/DataView.h index 94ea2627f14..4a74bbe7dbf 100644 --- a/DataView/DataView.h +++ b/DataView/DataView.h @@ -57,7 +57,7 @@ private slots: /// Adds a new mesh. void addMeshAction(); - void addDIRECTSourceTerms(); + void loadDIRECTSourceTerms(); /// Remove the currently selected mesh. void removeMesh(); diff --git a/DataView/DiagramView/DetailWindow.cpp b/DataView/DiagramView/DetailWindow.cpp index d2df79f2924..48b9a344a48 100644 --- a/DataView/DiagramView/DetailWindow.cpp +++ b/DataView/DiagramView/DetailWindow.cpp @@ -78,6 +78,25 @@ DetailWindow::DetailWindow(DiagramList* list, QWidget* parent) : QWidget(parent) resizeWindow(); } +DetailWindow::DetailWindow(std::vector<size_t> data, QWidget* parent) : QWidget(parent) +{ + setupUi(this); + size_t nEntries = data.size(); + std::vector< std::pair<float, float> > list_data(nEntries); + + for (size_t i=0; i<nEntries; i++) + list_data.push_back(std::pair<float, float>(static_cast<float>(i), static_cast<float>(data[i]))); + + DiagramList* list = new DiagramList(); + list->setList(list_data); + list->setXUnit("Value"); + list->setYUnit("Amount"); + list->setName("Histogram"); + stationView->setRenderHints( QPainter::Antialiasing ); + stationView->addGraph(list); + resizeWindow(); +} + DetailWindow::~DetailWindow() { } diff --git a/DataView/DiagramView/DetailWindow.h b/DataView/DiagramView/DetailWindow.h index 653541fe7aa..dc8af4c15ca 100644 --- a/DataView/DiagramView/DetailWindow.h +++ b/DataView/DiagramView/DetailWindow.h @@ -32,6 +32,9 @@ public: * \param parent The parent QWidget. */ DetailWindow(DiagramList* list, QWidget* parent = 0); + + DetailWindow(std::vector<size_t> data, QWidget* parent = 0); + ~DetailWindow(void); /** diff --git a/DataView/DiagramView/DiagramList.cpp b/DataView/DiagramView/DiagramList.cpp index 9a6edd1ce2d..f2940670b4a 100644 --- a/DataView/DiagramView/DiagramList.cpp +++ b/DataView/DiagramView/DiagramList.cpp @@ -217,15 +217,14 @@ int DiagramList::readList(const QString &path, std::vector<DiagramList*> &lists) void DiagramList::setList(std::vector< std::pair<QDateTime, float> > coords) { int numberOfDays; - QDateTime startDate; - startDate = coords[0].first; + this->_startDate = coords[0].first; _coords.push_back(std::pair<float, float>(0, coords[0].second)); size_t nCoords = coords.size(); for (size_t i = 1; i < nCoords; i++) { - numberOfDays = startDate.daysTo(coords[i].first); + numberOfDays = this->_startDate.daysTo(coords[i].first); _coords.push_back(std::pair<float, float>(numberOfDays, coords[i].second)); } @@ -234,6 +233,7 @@ void DiagramList::setList(std::vector< std::pair<QDateTime, float> > coords) void DiagramList::setList(std::vector< std::pair<float, float> > coords) { + this->_startDate = QDateTime(); size_t nCoords = coords.size(); for (size_t i = 0; i < nCoords; i++) _coords.push_back(coords[i]); diff --git a/DataView/DiagramView/DiagramScene.cpp b/DataView/DiagramView/DiagramScene.cpp index 16765ad473c..8b845561aac 100644 --- a/DataView/DiagramView/DiagramScene.cpp +++ b/DataView/DiagramView/DiagramScene.cpp @@ -193,14 +193,26 @@ void DiagramScene::constructGrid() QPen pen(Qt::black, 1, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin); _grid = addGrid(_bounds, numXTicks, numYTicks, pen); - for (int i = 0; i <= numXTicks; ++i) + if (_startDate == QDateTime()) { - int x = - static_cast<int>(_bounds.left() / _scaleX + - (i * (_bounds.width() / _scaleX) / numXTicks)); - QDateTime currentDate = _startDate.addSecs(x); - _xTicksText.push_back(addNonScalableText(currentDate.toString("dd.MM.yyyy"))); - _xTicksText.last()->setPos(x * _scaleX, _bounds.bottom() + 15); + for (int i = 0; i <= numXTicks; ++i) + { + int x = static_cast<int>(_bounds.left() / _scaleX + + (i * (_bounds.width() / _scaleX) / numXTicks)); + _xTicksText.push_back(addNonScalableText(QString::number(x))); + _xTicksText.last()->setPos(x * _scaleX, _bounds.bottom() + 15); + } + } + else + { + for (int i = 0; i <= numXTicks; ++i) + { + int x = static_cast<int>(_bounds.left() / _scaleX + + (i * (_bounds.width() / _scaleX) / numXTicks)); + QDateTime currentDate = _startDate.addSecs(x); + _xTicksText.push_back(addNonScalableText(currentDate.toString("dd.MM.yyyy"))); + _xTicksText.last()->setPos(x * _scaleX, _bounds.bottom() + 15); + } } for (int j = 0; j <= numYTicks; ++j) diff --git a/DataView/FEMConditionSetup.ui b/DataView/FEMConditionSetup.ui new file mode 100644 index 00000000000..fbc20c328bd --- /dev/null +++ b/DataView/FEMConditionSetup.ui @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>FEMConditionSetup</class> + <widget class="QDialog" name="FEMConditionSetup"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>280</width> + <height>272</height> + </rect> + </property> + <property name="windowTitle"> + <string>FEM Condition Setup</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Process Type</string> + </property> + <property name="margin"> + <number>10</number> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Distribution Type</string> + </property> + <property name="margin"> + <number>10</number> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Value</string> + </property> + <property name="margin"> + <number>10</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="processTypeBox"/> + </item> + <item row="4" column="1"> + <widget class="QComboBox" name="disTypeBox"> + <item> + <property name="text"> + <string>Constant (Direchlet)</string> + </property> + </item> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Primary Variable</string> + </property> + <property name="margin"> + <number>10</number> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="pvTypeBox"/> + </item> + <item row="5" column="1"> + <widget class="QLineEdit" name="firstValueEdit"/> + </item> + <item row="7" column="1"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="6" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Condition Type</string> + </property> + <property name="margin"> + <number>10</number> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QComboBox" name="condTypeBox"> + <item> + <property name="text"> + <string>Boundary Condition</string> + </property> + </item> + <item> + <property name="text"> + <string>Initial Condition</string> + </property> + </item> + <item> + <property name="text"> + <string>Source Term</string> + </property> + </item> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>FEMConditionSetup</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>FEMConditionSetup</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/DataView/FEMConditionSetupDialog.cpp b/DataView/FEMConditionSetupDialog.cpp new file mode 100644 index 00000000000..7bcb2b35988 --- /dev/null +++ b/DataView/FEMConditionSetupDialog.cpp @@ -0,0 +1,170 @@ +/** + * \file FEMConditionSetupDialog.cpp + * 2011/11/07 KR Initial implementation + */ + +#include "FEMConditionSetupDialog.h" +#include "OGSError.h" +#include "FEMEnums.h" +#include "ProjectData.h" +#include "StrictDoubleValidator.h" + +#include "BoundaryCondition.h" +#include "InitialCondition.h" +#include "SourceTerm.h" + +FEMConditionSetupDialog::FEMConditionSetupDialog(const std::string &associated_geometry, + const GEOLIB::GEOTYPE type, + const std::string &geo_name, + const GEOLIB::GeoObject* const geo_object, + QDialog* parent) +: QDialog(parent), _cond(associated_geometry, FEMCondition::UNSPECIFIED), _secondValueEdit(NULL), + _first_value_validator(NULL), _second_value_validator(NULL) +{ + _cond.setGeoType(type); + _cond.setGeoName(geo_name); + _cond.setGeoObj(geo_object); + + setupUi(this); + + setupDialog(); + + +} + +FEMConditionSetupDialog::FEMConditionSetupDialog(FEMCondition &cond, QDialog* parent) + : QDialog(parent), _cond(cond), _secondValueEdit(NULL), + _first_value_validator(NULL), _second_value_validator(NULL) +{ + setupDialog(); +} + +FEMConditionSetupDialog::~FEMConditionSetupDialog() +{ + delete _secondValueEdit; + delete _first_value_validator; + delete _second_value_validator; +} + +void FEMConditionSetupDialog::setupDialog() +{ + if (_cond.getGeoType() == GEOLIB::POLYLINE) + { + this->disTypeBox->addItem("Linear (Direchlet)"); + //this->disTypeBox->addItem("Linear (Neumann)"); + } + _first_value_validator = new StrictDoubleValidator(-1e+10, 1e+10, 5); + _second_value_validator = new StrictDoubleValidator(-1e+10, 1e+10, 5); + this->firstValueEdit->setText("0"); + this->firstValueEdit->setValidator (_first_value_validator); + + const std::list<std::string> process_names = FiniteElement::getAllProcessNames(); + for (std::list<std::string>::const_iterator it = process_names.begin(); it != process_names.end(); ++it) + this->processTypeBox->addItem(QString::fromStdString(*it)); + + const std::list<std::string> pv_names = FiniteElement::getAllPrimaryVariableNames(); + for (std::list<std::string>::const_iterator it = pv_names.begin(); it != pv_names.end(); ++it) + this->pvTypeBox->addItem(QString::fromStdString(*it)); +/* + const std::list<std::string> dis_names = FiniteElement::getAllDistributionNames(); + for (std::list<std::string>::const_iterator it = dis_names.begin(); it != dis_names.end(); ++it) + this->disTypeBox->addItem(QString::fromStdString(*it)); +*/ +} + +void FEMConditionSetupDialog::accept() +{ + _cond.setProcessType(static_cast<FiniteElement::ProcessType>(this->processTypeBox->currentIndex() + 1)); + _cond.setProcessPrimaryVariable(static_cast<FiniteElement::PrimaryVariable>(this->pvTypeBox->currentIndex() + 1)); + + QString dis_type_text = this->disTypeBox->currentText(); + if (condTypeBox->currentIndex()>1) + { + if (this->disTypeBox->currentIndex()>0) + _cond.setProcessDistributionType(FiniteElement::LINEAR_NEUMANN); + else + _cond.setProcessDistributionType(FiniteElement::CONSTANT_NEUMANN); + } + else + { + if (this->disTypeBox->currentIndex()>0) + _cond.setProcessDistributionType(FiniteElement::LINEAR); + else + _cond.setProcessDistributionType(FiniteElement::CONSTANT); + } + + std::vector<double> dis_values; + dis_values.push_back(strtod(this->firstValueEdit->text().toStdString().c_str(), 0)); + if (this->_secondValueEdit) + dis_values.push_back(strtod(this->_secondValueEdit->text().toStdString().c_str(), 0)); + _cond.setDisValue(dis_values); + + FEMCondition* new_cond(NULL); + switch(this->condTypeBox->currentIndex()) + { + case 0: + new_cond = new BoundaryCondition(_cond); + break; + case 1: + new_cond = new InitialCondition(_cond); + break; + default: + new_cond = new SourceTerm(_cond); + } + + emit addFEMCondition(new_cond); + this->done(QDialog::Accepted); +} + +void FEMConditionSetupDialog::reject() +{ + this->done(QDialog::Rejected); +} + + +void FEMConditionSetupDialog::on_condTypeBox_currentIndexChanged(int index) +{ + //if (index==1) + // this->geoNameBox->addItem("Domain"); + // remove "Domain" if IC is unselected + if (index>1) // source terms selected + { + while (this->disTypeBox->count()>0) + this->disTypeBox->removeItem(0); + this->disTypeBox->addItem("Constant (Neumann)"); + if (_cond.getGeoType() == GEOLIB::POLYLINE) + this->disTypeBox->addItem("Linear (Neumann)"); + } + else + { + while (this->disTypeBox->count()>0) + this->disTypeBox->removeItem(0); + this->disTypeBox->addItem("Constant (Direchlet)"); + if (_cond.getGeoType() == GEOLIB::POLYLINE) + this->disTypeBox->addItem("Linear (Direchlet)"); + } +} + + +void FEMConditionSetupDialog::on_disTypeBox_currentIndexChanged(int index) +{ + if (index>0) // linear + { + if (!_secondValueEdit) + { + _secondValueEdit = new QLineEdit("0"); + _secondValueEdit->setValidator(_second_value_validator); + static_cast<QGridLayout*>(this->layout())->addWidget(_secondValueEdit,5,1) ; + } + } + else // constant + { + if (_secondValueEdit) + { + static_cast<QGridLayout*>(this->layout())->removeWidget(_secondValueEdit); + delete _secondValueEdit; + _secondValueEdit = NULL; + } + } + +} diff --git a/DataView/FEMConditionSetupDialog.h b/DataView/FEMConditionSetupDialog.h new file mode 100644 index 00000000000..ea9c66c58b1 --- /dev/null +++ b/DataView/FEMConditionSetupDialog.h @@ -0,0 +1,65 @@ +/** + * \file FEMConditionSetupDialog.h + * 2011/11/07 KR Initial implementation + */ + +#ifndef FEMCONDITIONSETUPDIALOG_H +#define FEMCONDITIONSETUPDIALOG_H + +#include "ui_FEMConditionSetup.h" +#include "FEMCondition.h" + +#include <QDialog> + +class StrictDoubleValidator; + +namespace GEOLIB { + class GeoObject; +} + + +/** + * \brief A dialog window for adding FEM Conditions based + * on geometrica objects. + */ +class FEMConditionSetupDialog : public QDialog, private Ui_FEMConditionSetup +{ + Q_OBJECT + +public: + /// Constructor for creating a new FEM condition. + FEMConditionSetupDialog(const std::string &associated_geometry, + const GEOLIB::GEOTYPE type, + const std::string &geo_name, + const GEOLIB::GeoObject* const geo_object, + QDialog* parent = 0); + + /// Constructor for editing an existing FEM condition. + FEMConditionSetupDialog(FEMCondition &cond, QDialog* parent = 0); + ~FEMConditionSetupDialog(void); + +private: + void setupDialog(); + + FEMCondition _cond; + QLineEdit* _secondValueEdit; + StrictDoubleValidator* _first_value_validator; + StrictDoubleValidator* _second_value_validator; + +private slots: + /// Instructions if the OK-Button has been pressed. + void accept(); + + /// Instructions if the Cancel-Button has been pressed. + void reject(); + + void on_condTypeBox_currentIndexChanged(int index); + + void on_disTypeBox_currentIndexChanged(int index); + +signals: + void addFEMCondition(FEMCondition*); + +}; + +#endif //FEMCONDITIONSETUPDIALOG_H diff --git a/DataView/GEOModels.cpp b/DataView/GEOModels.cpp index ec684f79b2c..c6f2079f033 100644 --- a/DataView/GEOModels.cpp +++ b/DataView/GEOModels.cpp @@ -206,3 +206,30 @@ void GEOModels::connectPolylineSegments(const std::string &geoName, else OGSError::box("Corresponding geometry not found."); } + + +void GEOModels::addNameForElement(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, size_t id, std::string new_name) +{ + switch(object_type) { + case GEOLIB::POINT: + { + GEOLIB::PointVec* pnt_vec = this->getPointVecObj(geometry_name); + pnt_vec->setNameForElement(id, new_name); + break; + } + case GEOLIB::POLYLINE: + { + GEOLIB::PolylineVec* ply_vec = this->getPolylineVecObj(geometry_name); + ply_vec->setNameForElement(id, new_name); + break; + } + case GEOLIB::SURFACE: + { + GEOLIB::SurfaceVec* sfc_vec = this->getSurfaceVecObj(geometry_name); + sfc_vec->setNameForElement(id, new_name); + break; + } + default: + std::cout << "Error in GEOModels::addNameForElement() - Unknown GEOTYPE..." << std::endl; + } +} diff --git a/DataView/GEOModels.h b/DataView/GEOModels.h index 7532bc76165..1396567f33b 100644 --- a/DataView/GEOModels.h +++ b/DataView/GEOModels.h @@ -72,6 +72,8 @@ public slots: const std::string &name); virtual bool removeSurfaceVec(const std::string &name); + void addNameForElement(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, size_t id, std::string new_name); + /// Calls all necessary functions to connect polyline-segments and update all views and windows. void connectPolylineSegments(const std::string &geoName, std::vector<size_t> indexlist, diff --git a/DataView/GMSHPrefsDialog.cpp b/DataView/GMSHPrefsDialog.cpp index b087545d18c..d171ab8e6c5 100644 --- a/DataView/GMSHPrefsDialog.cpp +++ b/DataView/GMSHPrefsDialog.cpp @@ -53,7 +53,7 @@ GMSHPrefsDialog::GMSHPrefsDialog(const GEOLIB::GEOObjects* geoObjects, QDialog* // get station names std::vector<std::string> geo_station_names; - geoObjects->getStationNames(geo_station_names); + geoObjects->getStationVectorNames(geo_station_names); for (size_t k(0); k < geo_station_names.size(); k++) geoNames.push_back (geo_station_names[k]); diff --git a/DataView/GMSHPrefsDialog.h b/DataView/GMSHPrefsDialog.h index c3c520c3680..760490f9dc6 100644 --- a/DataView/GMSHPrefsDialog.h +++ b/DataView/GMSHPrefsDialog.h @@ -7,7 +7,7 @@ #define GMSHPREFSDIALOG_H #include "ui_GMSHPrefs.h" -#include <QtGui/QMainWindow> +#include <QDialog> class QStringListModel; diff --git a/DataView/GeoObjectListItem.h b/DataView/GeoObjectListItem.h index 7c373de9fd1..19a848ff6ce 100644 --- a/DataView/GeoObjectListItem.h +++ b/DataView/GeoObjectListItem.h @@ -16,6 +16,12 @@ #include <QModelIndex> #include <vtkPolyDataAlgorithm.h> +/** + * Creates parent items for geometric object lists (i.e. points, polylines and surfaces) + * for the GeoTreeModel + * + * \sa GeoTreeModel, GeoTreeItem + */ class GeoObjectListItem : public TreeItem { public: diff --git a/DataView/GeoTreeModel.cpp b/DataView/GeoTreeModel.cpp index 652add5b54d..95617c0ddd0 100644 --- a/DataView/GeoTreeModel.cpp +++ b/DataView/GeoTreeModel.cpp @@ -16,40 +16,26 @@ GeoTreeModel::GeoTreeModel( QObject* parent ) { QList<QVariant> rootData; delete _rootItem; - rootData << "Id" << "x" << "y" << "z"; + rootData << "Id" << "x" << "y" << "z" << "name "; _rootItem = new GeoTreeItem(rootData, NULL, NULL); } GeoTreeModel::~GeoTreeModel() { } -/* - const GEOLIB::GeoObject* GeoTreeModel::objectFromIndex( const QModelIndex& index, QString &geoName ) const - { - if (index.isValid()) - { - GeoTreeItem* treeItem = static_cast<GeoTreeItem*>(index.internalPointer()); - //TreeItem* parentItem = treeItem->parentItem(); - //geoName = parentItem->data(0).toString(); - if (treeItem) return treeItem->getGeoObject(); - } - return NULL; - } - */ + void GeoTreeModel::addPointList(QString geoName, const GEOLIB::PointVec* pointVec) { const std::vector<GEOLIB::Point*>* points = pointVec->getVector(); QList<QVariant> geoData; - geoData << QVariant(geoName) << "" << "" << ""; - //BaseItem* grpItem = new BaseItem(listName, stations); - GeoTreeItem* geo = new GeoTreeItem(geoData, _rootItem); + geoData << QVariant(geoName) << "" << "" << "" << ""; + GeoTreeItem* geo (new GeoTreeItem(geoData, _rootItem)); _lists.push_back(geo); _rootItem->appendChild(geo); QList<QVariant> pointData; - pointData << "Points" << "" << "" << ""; - //BaseItem* grpItem = new BaseItem(listName, stations); + pointData << "Points" << "" << "" << "" << ""; GeoObjectListItem* pointList = new GeoObjectListItem(pointData, geo, points, GEOLIB::POINT); geo->appendChild(pointList); @@ -57,14 +43,16 @@ void GeoTreeModel::addPointList(QString geoName, const GEOLIB::PointVec* pointVe for (size_t j = 0; j < nPoints; j++) { - QList<QVariant> pnt; - pnt << static_cast<unsigned>(j) << - QString::number((*(*points)[j])[0], - 'f') << QString::number((*(*points)[j])[1],'f') << QString::number( - (*(*points)[j])[2], - 'f'); - GeoTreeItem* point = - new GeoTreeItem(pnt, pointList, static_cast<GEOLIB::Point*>((*points)[j])); + const GEOLIB::Point &pnt(*(*points)[j]); + std::string pnt_name(""); + pointVec->getNameOfElementByID(j, pnt_name); + QList<QVariant> pnt_data; + pnt_data << static_cast<unsigned>(j) + << QString::number(pnt[0], 'f') + << QString::number(pnt[1], 'f') + << QString::number(pnt[2], 'f') + << QString::fromStdString(pnt_name); + GeoTreeItem* point(new GeoTreeItem(pnt_data, pointList, static_cast<const GEOLIB::Point*>(&pnt))); pointList->appendChild(point); } @@ -79,14 +67,15 @@ void GeoTreeModel::addPolylineList(QString geoName, const GEOLIB::PolylineVec* p int nLists = _rootItem->childCount(); TreeItem* geo(NULL); for (int i = 0; i < nLists; i++) + { if (_rootItem->child(i)->data(0).toString().compare(geoName) == 0) geo = _rootItem->child(i); + } if (geo == NULL) { - std::cout << - "GeoTreeModel::addPolylineList() - Error: No corresponding geometry found..." << - std::endl; + std::cout << "GeoTreeModel::addPolylineList() - Error: No corresponding geometry found..." + << std::endl; return; } @@ -94,7 +83,6 @@ void GeoTreeModel::addPolylineList(QString geoName, const GEOLIB::PolylineVec* p QList<QVariant> plyData; plyData << "Polylines" << "" << "" << ""; - //BaseItem* grpItem = new BaseItem(listName, stations); GeoObjectListItem* plyList = new GeoObjectListItem(plyData, geo, lines, GEOLIB::POLYLINE); geo->appendChild(plyList); this->addChildren(plyList, polylineVec, 0, lines->size()); @@ -129,31 +117,30 @@ void GeoTreeModel::addChildren(GeoObjectListItem* plyList, size_t start_index, size_t end_index) { - const std::vector<GEOLIB::Polyline*>* lines = polyline_vec->getVector(); + const std::vector<GEOLIB::Polyline*> lines = *(polyline_vec->getVector()); for (size_t i = start_index; i < end_index; i++) { - QList<QVariant> line; + QList<QVariant> line_data; std::string ply_name(""); - line << "Line " + QString::number(i); if (polyline_vec->getNameOfElementByID(i, ply_name)) - line << QString::fromStdString(ply_name) << "" << ""; - else - line << "" << "" << ""; + line_data << "Line " + QString::number(i) << QString::fromStdString(ply_name) << "" << ""; + else line_data << "Line " + QString::number(i) << "" << "" << ""; - GeoTreeItem* lineItem = new GeoTreeItem(line, plyList, (*lines)[i]); + const GEOLIB::Polyline &line(*(lines[i])); + GeoTreeItem* lineItem(new GeoTreeItem(line_data, plyList, &line)); plyList->appendChild(lineItem); - int nPoints = static_cast<int>((*lines)[i]->getNumberOfPoints()); + int nPoints = static_cast<int>(lines[i]->getNumberOfPoints()); for (int j = 0; j < nPoints; j++) { - QList<QVariant> pnt; - pnt << static_cast<int>((*lines)[i]->getPointID(j)) << - QString::number((*(*(*lines)[i])[j])[0], - 'f') << - QString::number((*(*(*lines)[i])[j])[1], - 'f') << QString::number((*(*(*lines)[i])[j])[2],'f'); - TreeItem* child = new TreeItem(pnt, lineItem); + const GEOLIB::Point pnt(*(line[j])); + QList<QVariant> pnt_data; + pnt_data << static_cast<int>(line.getPointID(j)) + << QString::number(pnt[0], 'f') + << QString::number(pnt[1], 'f') + << QString::number(pnt[2], 'f'); + TreeItem* child(new TreeItem(pnt_data, lineItem)); lineItem->appendChild(child); } } @@ -165,14 +152,15 @@ void GeoTreeModel::addSurfaceList(QString geoName, const GEOLIB::SurfaceVec* sur int nLists = _rootItem->childCount(); TreeItem* geo(NULL); for (int i = 0; i < nLists; i++) + { if (_rootItem->child(i)->data(0).toString().compare(geoName) == 0) geo = _rootItem->child(i); + } if (geo == NULL) { - std::cout << - "GeoTreeModel::addSurfaceList() - Error: No corresponding geometry found..." << - std::endl; + std::cout << "GeoTreeModel::addSurfaceList() - Error: No corresponding geometry found..." + << std::endl; return; } @@ -192,20 +180,22 @@ void GeoTreeModel::appendSurfaces(const std::string &name, GEOLIB::SurfaceVec* s for (size_t i = 0; i < _lists.size(); i++) { if ( name.compare( _lists[i]->data(0).toString().toStdString() ) == 0 ) - for (int j = 0; j < _lists[i]->childCount(); j++) + { + int nChildren = _lists[i]->childCount(); + for (int j = 0; j < nChildren; j++) { - GeoObjectListItem* parent = - static_cast<GeoObjectListItem*>(_lists[i]->child(j)); + GeoObjectListItem* parent = static_cast<GeoObjectListItem*>(_lists[i]->child(j)); if (GEOLIB::SURFACE == parent->getType()) { this->addChildren(parent, surfaceVec, parent->childCount(), surfaceVec->getVector()->size()); - reset(); parent->vtkSource()->Modified(); + reset(); return; } } + } } OGSError::box("Error adding surface to geometry."); } @@ -217,42 +207,38 @@ void GeoTreeModel::addChildren(GeoObjectListItem* sfcList, { const std::vector<GEOLIB::Surface*>* surfaces = surface_vec->getVector(); + const std::vector<GEOLIB::Point*> &nodesVec(*((*surfaces)[start_index]->getPointVec())); for (size_t i = start_index; i < end_index; i++) { QList<QVariant> surface; std::string sfc_name(""); - surface << "Surface " + QString::number(i); - if (surface_vec->getNameOfElementByID(i, sfc_name)) - surface << QString::fromStdString(sfc_name) << "" << ""; - else - surface << "" << "" << ""; + sfc_name = surface_vec->getNameOfElementByID(i, sfc_name); + surface << "Surface " + QString::number(i) << QString::fromStdString(sfc_name) << "" << ""; - GeoTreeItem* surfaceItem = new GeoTreeItem(surface, sfcList, (*surfaces)[i]); + const GEOLIB::Surface &sfc(*(*surfaces)[i]); + GeoTreeItem* surfaceItem(new GeoTreeItem(surface, sfcList, &sfc)); sfcList->appendChild(surfaceItem); - const std::vector<GEOLIB::Point*>* nodesVec = (*surfaces)[i]->getPointVec(); - int nElems = static_cast<int>((*surfaces)[i]->getNTriangles()); for (int j = 0; j < nElems; j++) { QList<QVariant> elem; - elem << j << static_cast<int>((*(*(*surfaces)[i])[j])[0]) << - static_cast<int>((*(*(*surfaces)[i])[j])[1]) << - static_cast<int>((*(*(*surfaces)[i])[j])[2]); - TreeItem* child = new TreeItem(elem, surfaceItem); + const GEOLIB::Triangle &triangle(*sfc[j]); + elem << j << static_cast<int>(triangle[0]) + << static_cast<int>(triangle[1]) + << static_cast<int>(triangle[2]); + TreeItem* child(new TreeItem(elem, surfaceItem)); surfaceItem->appendChild(child); for (int k = 0; k < 3; k++) { QList<QVariant> node; - node << static_cast<int>((*(*(*surfaces)[i])[j])[k]) << - QString::number((*(*nodesVec)[(*(*(*surfaces)[i])[j])[k]])[0], - 'f') << QString::number( - (*(*nodesVec)[(*(*(*surfaces)[i])[j])[k]])[1], - 'f') << QString::number( - (*(*nodesVec)[(*(*(*surfaces)[i])[j])[k]])[2], - 'f'); - TreeItem* nchild = new TreeItem(node, child); + const GEOLIB::Point &pnt(*(nodesVec[triangle[k]])); + node << static_cast<int>(triangle[k]) + << QString::number(pnt[0], 'f') + << QString::number(pnt[1], 'f') + << QString::number(pnt[2], 'f'); + TreeItem* nchild(new TreeItem(node, child)); child->appendChild(nchild); } } @@ -301,3 +287,46 @@ vtkPolyDataAlgorithm* GeoTreeModel::vtkSource(const std::string &name, GEOLIB::G } return NULL; } + +void GeoTreeModel::setNameForItem(const std::string &name, GEOLIB::GEOTYPE type, size_t id, std::string item_name) +{ + int type_idx(0); + int col_idx(1); + + switch(type) + { + case GEOLIB::POINT: + type_idx = 0; + col_idx = 4; // for points the name is at a different position + break; + case GEOLIB::POLYLINE: + type_idx = 1; + break; + case GEOLIB::SURFACE: + type_idx = 2; + break; + case GEOLIB::VOLUME: + type_idx = 3; + break; + default: + type_idx = -1; + } + + for (size_t i=0; i<_lists.size(); i++) + { + if ( name.compare( _lists[i]->data(0).toString().toStdString() ) == 0 ) + { + TreeItem* object_list = _lists[i]->child(type_idx); +// for (int j=0; j<object_list->childCount(); j++) +// { + TreeItem* item = object_list->child(/*j*/id); +// if (static_cast<size_t>(item->data(0).toInt()) == id) +// { + item->setData(col_idx, QString::fromStdString(item_name)); +// break; +// } +// } + break; + } + } +} diff --git a/DataView/GeoTreeModel.h b/DataView/GeoTreeModel.h index 3dc20199f6b..8da296ec245 100644 --- a/DataView/GeoTreeModel.h +++ b/DataView/GeoTreeModel.h @@ -59,6 +59,8 @@ public: */ void removeGeoList(const std::string &name, GEOLIB::GEOTYPE type = GEOLIB::INVALID); + void setNameForItem(const std::string &name, GEOLIB::GEOTYPE type, size_t id, std::string item_name); + /* * Returns the geo-object specified by the given index. * \param index Index of the requested item diff --git a/DataView/GeoTreeView.cpp b/DataView/GeoTreeView.cpp index 4a64a5bd746..60e23b97ea0 100644 --- a/DataView/GeoTreeView.cpp +++ b/DataView/GeoTreeView.cpp @@ -13,12 +13,8 @@ #include "GeoTreeView.h" #include "OGSError.h" -#include "XMLInterface.h" - GeoTreeView::GeoTreeView(QWidget* parent) : QTreeView(parent) { -// setContextMenuPolicy(Qt::CustomContextMenu); -// connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showContextMenu(const QPoint &))); } void GeoTreeView::updateView() @@ -38,8 +34,19 @@ void GeoTreeView::on_Clicked(QModelIndex idx) void GeoTreeView::selectionChanged( const QItemSelection &selected, const QItemSelection &deselected ) { - emit itemSelectionChanged(selected, deselected); - return QTreeView::selectionChanged(selected, deselected); + if (!selected.isEmpty()) + { + const QModelIndex idx = *(selected.indexes().begin()); + const TreeItem* tree_item = static_cast<TreeModel*>(this->model())->getItem(idx); + + const GeoObjectListItem* list_item = dynamic_cast<GeoObjectListItem*>(tree_item->parentItem()); + if (list_item) + emit geoItemSelected(list_item->vtkSource(), tree_item->row()); + else + emit removeGeoItemSelection(); + } + //emit itemSelectionChanged(selected, deselected); + //return QTreeView::selectionChanged(selected, deselected); } void GeoTreeView::selectionChangedFromOutside( const QItemSelection &selected, @@ -63,64 +70,91 @@ void GeoTreeView::contextMenuEvent( QContextMenuEvent* event ) GeoObjectListItem* list = dynamic_cast<GeoObjectListItem*>(item); QMenu menu; - if (item->childCount() > 0) + // The current index is a list of points/polylines/surfaces + if (list != NULL) { - // The current index refers to the name of a geometry-object - if (item->child(0)->data(0).toString().compare("Points") == 0) // clumsy way to find out + QAction* connectPlyAction(NULL); + if (list->getType() == GEOLIB::POLYLINE) { - QAction* addCNDAction = menu.addAction("Add FEM Conditions..."); - QAction* saveAction = menu.addAction("Save geometry..."); - menu.addSeparator(); - QAction* removeAction = menu.addAction("Remove geometry"); - connect(addCNDAction, SIGNAL(triggered()), this, SLOT(addFEMConditions())); - connect(saveAction, SIGNAL(triggered()), this, SLOT(writeToFile())); - connect(removeAction, SIGNAL(triggered()), this, SLOT(removeList())); + connectPlyAction = menu.addAction("Connect Polylines..."); + connect(connectPlyAction, SIGNAL(triggered()), this, + SLOT(connectPolylines())); } - else if (list != NULL) + menu.addSeparator(); + QAction* removeAction = menu.addAction("Remove " + item->data(0).toString()); + connect(removeAction, SIGNAL(triggered()), this, SLOT(removeList())); + } + else + { + GeoObjectListItem* parent = dynamic_cast<GeoObjectListItem*>(item->parentItem()); + + // The current index refers to a geo-object + if (parent != NULL) { - QAction* connectPlyAction(NULL); - if (list->getType() == GEOLIB::POLYLINE) - { - connectPlyAction = menu.addAction("Connect Polylines..."); - connect(connectPlyAction, SIGNAL(triggered()), this, - SLOT(connectPolylines())); - } - menu.addSeparator(); - QAction* removeAction = menu.addAction("Remove " + item->data(0).toString()); - connect(removeAction, SIGNAL(triggered()), this, SLOT(removeList())); + QAction* addCondAction = menu.addAction("Set as FEM condition..."); + QAction* addNameAction = menu.addAction("Set name..."); + connect(addCondAction, SIGNAL(triggered()), this, SLOT(setElementAsCondition())); + connect(addNameAction, SIGNAL(triggered()), this, SLOT(setNameForElement())); } - // The current index refers to a geo object - else + // The current index refers to the name of a geometry-object + else if (item->childCount() > 0) { - QString temp_name; - QMenu menu; - /* - if (static_cast<GeoTreeModel*>(model())->objectFromIndex(index, temp_name)->type() == GEOLIB::POINT) - { - QAction* stratAction = menu.addAction("Display Stratigraphy..."); - QAction* exportAction = menu.addAction("Export to GMS..."); - connect(stratAction, SIGNAL(triggered()), this, SLOT(displayStratigraphy())); - connect(exportAction, SIGNAL(triggered()), this, SLOT(exportStation())); - menu.exec(event->globalPos()); - } - else - { - menu.addAction("View Information..."); - QAction* showDiagramAction = menu.addAction("View Diagram..."); - connect(showDiagramAction, SIGNAL(triggered()), this, SLOT(showDiagramPrefsDialog())); - menu.exec(event->globalPos()); - } - */ + if (item->child(0)->data(0).toString().compare("Points") == 0) // clumsy way to find out + { + QAction* saveAction = menu.addAction("Save geometry..."); + QAction* addCNDAction = menu.addAction("Load FEM Conditions..."); + QAction* saveCondAction = menu.addAction("Save FEM conditions..."); + menu.addSeparator(); + QAction* removeAction = menu.addAction("Remove geometry"); + connect(saveAction, SIGNAL(triggered()), this, SLOT(writeToFile())); + connect(addCNDAction, SIGNAL(triggered()), this, SLOT(loadFEMConditions())); + connect(saveCondAction, SIGNAL(triggered()), this, SLOT(saveFEMConditions())); + connect(removeAction, SIGNAL(triggered()), this, SLOT(removeList())); + } } } + menu.exec(event->globalPos()); } -void GeoTreeView::addFEMConditions() +void GeoTreeView::connectPolylines() +{ + TreeItem* item = static_cast<GeoTreeModel*>(model())->getItem( + this->selectionModel()->currentIndex())->parentItem(); + emit requestLineEditDialog(item->data(0).toString().toStdString()); +} + +void GeoTreeView::removeList() { TreeItem* item = static_cast<GeoTreeModel*>(model())->getItem( this->selectionModel()->currentIndex()); - emit loadFEMCondFileRequested(item->data(0).toString().toStdString()); + + GeoObjectListItem* list = dynamic_cast<GeoObjectListItem*>(item); + if (list) + emit listRemoved((item->parentItem()->data( + 0).toString()).toStdString(), list->getType()); + else + emit listRemoved((item->data(0).toString()).toStdString(), GEOLIB::INVALID); +} + +void GeoTreeView::setElementAsCondition() +{ + const TreeItem* item = static_cast<GeoTreeModel*>(model())->getItem( + this->selectionModel()->currentIndex()); + const size_t id = item->row(); + const GEOLIB::GEOTYPE type = static_cast<GeoObjectListItem*>(item->parentItem())->getType(); + const std::string geometry_name = item->parentItem()->parentItem()->data(0).toString().toStdString(); + emit requestCondSetupDialog(geometry_name, type, id); +} + +void GeoTreeView::setNameForElement() +{ + const TreeItem* item = static_cast<GeoTreeModel*>(model())->getItem( + this->selectionModel()->currentIndex()); + const size_t id = item->row(); + const GEOLIB::GEOTYPE type = static_cast<GeoObjectListItem*>(item->parentItem())->getType(); + const std::string geometry_name = item->parentItem()->parentItem()->data(0).toString().toStdString(); + emit requestNameChangeDialog(geometry_name, type, id); } void GeoTreeView::writeToFile() const @@ -129,30 +163,23 @@ void GeoTreeView::writeToFile() const this->selectionModel()->currentIndex()); QString gliName = item->data(0).toString(); QString fileName = QFileDialog::getSaveFileName(NULL, - "Save geometry as", - gliName, - "GeoSys mesh file (*.gml)"); + "Save geometry as", gliName, "GeoSys geometry file (*.gml)"); if (!fileName.isEmpty()) emit saveToFileRequested(gliName, fileName); } -void GeoTreeView::removeList() +void GeoTreeView::loadFEMConditions() { TreeItem* item = static_cast<GeoTreeModel*>(model())->getItem( this->selectionModel()->currentIndex()); - - GeoObjectListItem* list = dynamic_cast<GeoObjectListItem*>(item); - if (list) - emit listRemoved((item->parentItem()->data( - 0).toString()).toStdString(), list->getType()); - else - emit listRemoved((item->data(0).toString()).toStdString(), GEOLIB::INVALID); + emit loadFEMCondFileRequested(item->data(0).toString().toStdString()); } -void GeoTreeView::connectPolylines() +void GeoTreeView::saveFEMConditions() { TreeItem* item = static_cast<GeoTreeModel*>(model())->getItem( - this->selectionModel()->currentIndex())->parentItem(); - emit requestLineEditDialog(item->data(0).toString().toStdString()); -} - + this->selectionModel()->currentIndex()); + QString fileName = QFileDialog::getSaveFileName(NULL, + "Save FEM Conditions as", "", "GeoSys FEM Condition file (*.cnd)"); + emit saveFEMConditionsRequested(item->data(0).toString(), fileName); +} \ No newline at end of file diff --git a/DataView/GeoTreeView.h b/DataView/GeoTreeView.h index fc75c36f5c8..466289aa82a 100644 --- a/DataView/GeoTreeView.h +++ b/DataView/GeoTreeView.h @@ -10,6 +10,8 @@ #include <QContextMenuEvent> #include <QTreeView> +class vtkPolyDataAlgorithm; + /** * \brief A view for the GeoTreeModel * \sa GeoTreeModel, GeoTreeItem @@ -38,23 +40,33 @@ private: void contextMenuEvent( QContextMenuEvent* e ); private slots: + /// Allows to add FEM Conditions to a process + void loadFEMConditions(); void on_Clicked(QModelIndex idx); - /// Allows to add FEM Conditions to add to Geometry - void addFEMConditions(); /// Calls a LineEditDialog. void connectPolylines(); + /// Calls a FEMConditionSetupDialog. + void setElementAsCondition(); + /// Calls a SetNameDialog. + void setNameForElement(); /// Saves a geometry in a file. void writeToFile() const; /// Removes a whole geometry or parts of it. void removeList(); + /// Saves FEM Conditions associated with the given geometry + void saveFEMConditions(); signals: - void itemSelectionChanged(const QItemSelection & selected, - const QItemSelection & deselected); + void geoItemSelected(const vtkPolyDataAlgorithm*, int); + void removeGeoItemSelection(); + //void itemSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected); void listRemoved(std::string name, GEOLIB::GEOTYPE); void loadFEMCondFileRequested(std::string); void saveToFileRequested(QString, QString) const; + void requestCondSetupDialog(const std::string&, const GEOLIB::GEOTYPE, const size_t); void requestLineEditDialog(const std::string&); + void requestNameChangeDialog(const std::string&, const GEOLIB::GEOTYPE, const size_t); + void saveFEMConditionsRequested(QString, QString); }; #endif //GEOTREEVIEW_H diff --git a/DataView/LineEditDialog.h b/DataView/LineEditDialog.h index ec709b743ad..048be457e34 100644 --- a/DataView/LineEditDialog.h +++ b/DataView/LineEditDialog.h @@ -7,7 +7,7 @@ #define LINEEDITDIALOG_H #include "ui_LineEdit.h" -#include <QtGui/QMainWindow> +#include <QDialog> #include "PolylineVec.h" diff --git a/DataView/ListPropertiesDialog.h b/DataView/ListPropertiesDialog.h index e3e306a79df..540af179e55 100644 --- a/DataView/ListPropertiesDialog.h +++ b/DataView/ListPropertiesDialog.h @@ -9,7 +9,6 @@ #include "GEOModels.h" #include "Station.h" #include <QDialog> -#include <QtGui/QMainWindow> #include <vector> class QLabel; diff --git a/DataView/ModellingTabWidget.cpp b/DataView/ModellingTabWidget.cpp new file mode 100644 index 00000000000..85bc76df178 --- /dev/null +++ b/DataView/ModellingTabWidget.cpp @@ -0,0 +1,26 @@ +/** + * \file ModellingTabWidget.cpp + * 2010/12/14 KR Initial implementation + * + * Implementation of StationTabWidget + */ + +// ** INCLUDES ** +#include "ProcessModel.h" +#include "ModellingTabWidget.h" + +ModellingTabWidget::ModellingTabWidget( QWidget* parent /*= 0*/ ) + : QWidget(parent) +{ + setupUi(this); +} + +void ModellingTabWidget::on_addProcessButton_pressed() +{ + emit requestNewProcess(); +} + +void ModellingTabWidget::on_deleteAllButton_pressed() +{ + static_cast<ProcessModel*>(this->treeView->model())->removeAllProcesses(); +} diff --git a/DataView/ModellingTabWidget.h b/DataView/ModellingTabWidget.h new file mode 100644 index 00000000000..6a741be7b02 --- /dev/null +++ b/DataView/ModellingTabWidget.h @@ -0,0 +1,31 @@ +/** + * \file ModellingTabWidget.h + * 2010/12/14 KR Initial implementation + * + */ + +#ifndef MODELLINGTABWIDGET_H +#define MODELLINGTABWIDGET_H + +// ** INCLUDES ** +#include "ui_ModellingTabWidgetBase.h" + +/** + * \brief Widget containing the ProcessView. + */ +class ModellingTabWidget : public QWidget, public Ui_ModellingTabWidgetBase +{ + Q_OBJECT + +public: + ModellingTabWidget(QWidget* parent = 0); + +private slots: + void on_addProcessButton_pressed(); + void on_deleteAllButton_pressed(); + +signals: + void requestNewProcess(); +}; + +#endif // MODELLINGTABWIDGET_H diff --git a/DataView/ModellingTabWidgetBase.ui b/DataView/ModellingTabWidgetBase.ui new file mode 100644 index 00000000000..d5ede9a4f06 --- /dev/null +++ b/DataView/ModellingTabWidgetBase.ui @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ModellingTabWidgetBase</class> + <widget class="QWidget" name="ModellingTabWidgetBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>250</width> + <height>500</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="margin"> + <number>2</number> + </property> + <item> + <widget class="ProcessView" name="treeView"/> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QPushButton" name="addProcessButton"> + <property name="text"> + <string>Add process...</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="deleteAllButton"> + <property name="text"> + <string>Remove All</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>ProcessView</class> + <extends>QTreeView</extends> + <header>ProcessView.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/DataView/MshEditDialog.h b/DataView/MshEditDialog.h index 3b115a02bfd..214c04dabdf 100644 --- a/DataView/MshEditDialog.h +++ b/DataView/MshEditDialog.h @@ -7,7 +7,7 @@ #define MSHEDITDIALOG_H #include "ui_MshEdit.h" -#include <QtGui/QMainWindow> +#include <QDialog> #include "MshLayerMapper.h" diff --git a/DataView/MshLayerMapper.cpp b/DataView/MshLayerMapper.cpp index 5322f611425..f79cb3cb525 100644 --- a/DataView/MshLayerMapper.cpp +++ b/DataView/MshLayerMapper.cpp @@ -51,7 +51,7 @@ MeshLib::CFEMesh* MshLayerMapper::CreateLayers(const MeshLib::CFEMesh* mesh, for (size_t i = 0; i < nElems; i++) { MeshLib::CElem* elem( new MeshLib::CElem() ); - size_t nElemNodes = mesh->ele_vector[i]->nodes_index.Size(); + size_t nElemNodes = mesh->ele_vector[i]->getNodeIndices().Size(); if (mesh->ele_vector[i]->GetElementType() == MshElemType::TRIANGLE) elem->setElementProperties(MshElemType::PRISM); // extrude triangles to prism else if (mesh->ele_vector[i]->GetElementType() == MshElemType::QUAD) @@ -72,7 +72,7 @@ MeshLib::CFEMesh* MshLayerMapper::CreateLayers(const MeshLib::CFEMesh* mesh, } elem->SetPatchIndex(layer_id - 1); elem->SetNodesNumber(2 * nElemNodes); - elem->nodes_index.resize(2 * nElemNodes); + elem->getNodeIndices().resize(2 * nElemNodes); for (size_t j = 0; j < nElemNodes; j++) { long idx = mesh->ele_vector[i]->GetNodeIndex(j); @@ -85,7 +85,7 @@ MeshLib::CFEMesh* MshLayerMapper::CreateLayers(const MeshLib::CFEMesh* mesh, } } - new_mesh->setNumberOfElementsFromElementsVectorSize (); + new_mesh->setNumberOfNodesFromNodesVectorSize (); new_mesh->setNumberOfMeshLayers(nLayers); // HACK this crashes on linux systems probably because of uninitialised variables in the the element class @@ -415,15 +415,15 @@ void MshLayerMapper::CheckLayerMapping(MeshLib::CFEMesh* mesh, const size_t nLay new_elem->SetNodesNumber(4); Math_Group::vec<MeshLib::CNode*> nodes(4); - nodes[0] = mesh->nod_vector[elem->nodes_index[a]]; - nodes[1] = mesh->nod_vector[elem->nodes_index[b + 3]]; - nodes[2] = mesh->nod_vector[elem->nodes_index[c + 3]]; - nodes[3] = mesh->nod_vector[elem->nodes_index[c]]; + nodes[0] = mesh->nod_vector[elem->getNodeIndices()[a]]; + nodes[1] = mesh->nod_vector[elem->getNodeIndices()[b + 3]]; + nodes[2] = mesh->nod_vector[elem->getNodeIndices()[c + 3]]; + nodes[3] = mesh->nod_vector[elem->getNodeIndices()[c]]; new_elem->SetNodes(nodes, true); - new_elem->nodes_index.resize(4); + new_elem->getNodeIndices().resize(4); for (size_t k = 0; k < 4; k++) - new_elem->nodes_index[k] = elem->GetNode(k)->GetIndex(); + new_elem->getNodeIndices()[k] = elem->GetNode(k)->GetIndex(); new_elems.push_back(new_elem); // change prism-element to 2nd tetrahedron @@ -431,15 +431,15 @@ void MshLayerMapper::CheckLayerMapping(MeshLib::CFEMesh* mesh, const size_t nLay elem->SetElementType(MshElemType::TETRAHEDRON); elem->SetNodesNumber(4); - nodes[0] = mesh->nod_vector[elem->nodes_index[b]]; - nodes[1] = mesh->nod_vector[elem->nodes_index[a]]; - nodes[2] = mesh->nod_vector[elem->nodes_index[c]]; - nodes[3] = mesh->nod_vector[elem->nodes_index[b + 3]]; + nodes[0] = mesh->nod_vector[elem->getNodeIndices()[b]]; + nodes[1] = mesh->nod_vector[elem->getNodeIndices()[a]]; + nodes[2] = mesh->nod_vector[elem->getNodeIndices()[c]]; + nodes[3] = mesh->nod_vector[elem->getNodeIndices()[b + 3]]; elem->SetNodes(nodes, true); - elem->nodes_index.resize(4); + elem->getNodeIndices().resize(4); for (size_t k = 0; k < 4; k++) - elem->nodes_index[k] = elem->GetNode(k)->GetIndex(); + elem->getNodeIndices()[k] = elem->GetNode(k)->GetIndex(); break; } case 2: // two nodes of the prism are marked false, i.e. create a tetrahedron element from the remaining 4 prism nodes @@ -457,15 +457,15 @@ void MshLayerMapper::CheckLayerMapping(MeshLib::CFEMesh* mesh, const size_t nLay elem->SetNodesNumber(4); Math_Group::vec<MeshLib::CNode*> nodes(4); - nodes[0] = mesh->nod_vector[elem->nodes_index[b]]; - nodes[1] = mesh->nod_vector[elem->nodes_index[a]]; - nodes[2] = mesh->nod_vector[elem->nodes_index[c]]; - nodes[3] = mesh->nod_vector[elem->nodes_index[a + 3]]; + nodes[0] = mesh->nod_vector[elem->getNodeIndices()[b]]; + nodes[1] = mesh->nod_vector[elem->getNodeIndices()[a]]; + nodes[2] = mesh->nod_vector[elem->getNodeIndices()[c]]; + nodes[3] = mesh->nod_vector[elem->getNodeIndices()[a + 3]]; elem->SetNodes(nodes, true); - elem->nodes_index.resize(4); + elem->getNodeIndices().resize(4); for (size_t k = 0; k < 4; k++) - elem->nodes_index[k] = elem->GetNode(k)->GetIndex(); + elem->getNodeIndices()[k] = elem->GetNode(k)->GetIndex(); /* //for j, l nodes if they becomes on top surface. 24.02.2009. WW if (node_b->GetBoundaryType()=='1') @@ -541,7 +541,7 @@ void MshLayerMapper::CheckLayerMapping(MeshLib::CFEMesh* mesh, const size_t nLay nElems = mesh->ele_vector.size(); for(size_t i = 0; i < nElems; i++) for(int j = 0; j < mesh->ele_vector[i]->GetVertexNumber(); j++) - mesh->ele_vector[i]->nodes_index[j] = + mesh->ele_vector[i]->getNodeIndices()[j] = mesh->ele_vector[i]->GetNode(j)->GetIndex(); // delete elements if two of its nodes are identical (can this actually happen?????) @@ -610,7 +610,7 @@ void MshLayerMapper::CheckLayerMapping(MeshLib::CFEMesh* mesh, const size_t nLay nElems = mesh->ele_vector.size(); for (size_t i = 0; i < nElems; i++) for (int j = 0; j < mesh->ele_vector[i]->GetVertexNumber(); j++) - mesh->ele_vector[i]->nodes_index[j] = + mesh->ele_vector[i]->getNodeIndices()[j] = mesh->ele_vector[i]->GetNode(j)->GetIndex(); mesh->ConstructGrid(); diff --git a/DataView/MshQualitySelectionDialog.h b/DataView/MshQualitySelectionDialog.h index e10bf7b3de0..a74d3e2a4e3 100644 --- a/DataView/MshQualitySelectionDialog.h +++ b/DataView/MshQualitySelectionDialog.h @@ -8,6 +8,7 @@ #include "MSHEnums.h" #include "ui_MshQualitySelection.h" +#include <QDialog> class VtkMeshSource; diff --git a/DataView/MshTabWidget.cpp b/DataView/MshTabWidget.cpp index cd9ff9c46bf..fbe82e62f1c 100644 --- a/DataView/MshTabWidget.cpp +++ b/DataView/MshTabWidget.cpp @@ -16,52 +16,4 @@ MshTabWidget::MshTabWidget( QWidget* parent /*= 0*/ ) connect(this->addMeshPushButton, SIGNAL(clicked()), this->treeView, SLOT(addMeshAction())); connect(this->clearAllPushButton, SIGNAL(clicked()), this->treeView, SLOT(removeAllMeshes())); - -/* - mshTableView->setSelectionMode(QAbstractItemView::ExtendedSelection); - mshTableView->setSelectionBehavior(QAbstractItemView::SelectRows); - mshNodeTableView->setSelectionMode(QAbstractItemView::ExtendedSelection); - mshNodeTableView->setSelectionBehavior(QAbstractItemView::SelectRows); - - connect(mshTableView, SIGNAL(itemSelectionChanged(QItemSelection, QItemSelection)), - this, SLOT(changeMshSubmodelViews(QItemSelection, QItemSelection))); - */ } - -/* - void MshTabWidget::changeMshSubmodelViews( QItemSelection selected, QItemSelection deselected ) - { - - if (selected.size() > 0) - { - QModelIndex index = *(selected.begin()->indexes().begin()); - if (!index.isValid()) - return; - - MshModel* mshModel = static_cast<MshModel*>(mshTableView->model()); - - ModelItem* item = mshModel->itemFromIndex(index); - - mshNodeTableView->setModel(item->models()[0]); - mshNodeTableView->resizeColumnsToContents(); - mshNodeTableView->resizeRowsToContents(); - - connect(mshNodeTableView, SIGNAL(itemSelectionChanged(const QItemSelection&,const QItemSelection&)), - item->models()[0], SLOT(setSelection(const QItemSelection&, const QItemSelection&))); - - // connect(item->models()[0], SIGNAL(dataChanged(QModelIndex,QModelIndex)), _scene, SLOT(updateItems(QModelIndex,QModelIndex))); - // connect(item->models()[1], SIGNAL(dataChanged(QModelIndex,QModelIndex)), _scene, SLOT(updateItems(QModelIndex,QModelIndex))); - - mshElemTableView->setModel(item->models()[1]); - mshElemTableView->resizeColumnsToContents(); - mshElemTableView->resizeRowsToContents(); - - } - else - { - mshNodeTableView->setModel(NULL); - mshElemTableView->setModel(NULL); - } - - } - */ diff --git a/DataView/NewProcess.ui b/DataView/NewProcess.ui new file mode 100644 index 00000000000..25b20ce6ef6 --- /dev/null +++ b/DataView/NewProcess.ui @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>NewProcess</class> + <widget class="QDialog" name="NewProcess"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>350</width> + <height>160</height> + </rect> + </property> + <property name="windowTitle"> + <string>Create new process...</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="horizontalSpacing"> + <number>18</number> + </property> + <item row="2" column="3"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="pvLabel"> + <property name="text"> + <string>Select Primary Variable</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QComboBox" name="pvTypeBox"/> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="processLabel"> + <property name="text"> + <string>Select Process Type</string> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QComboBox" name="processTypeBox"/> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>NewProcess</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>NewProcess</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/DataView/NewProcessDialog.cpp b/DataView/NewProcessDialog.cpp new file mode 100644 index 00000000000..91c2a80c25e --- /dev/null +++ b/DataView/NewProcessDialog.cpp @@ -0,0 +1,42 @@ +/** + * \file NewProcessDialog.cpp + * 2011/11/17 KR Initial implementation + */ + +#include "NewProcessDialog.h" +#include "FEMEnums.h" +#include "ProcessInfo.h" + + +NewProcessDialog::NewProcessDialog(QDialog* parent) +: QDialog(parent) +{ + setupUi(this); + setupDialog(); +} + +void NewProcessDialog::setupDialog() +{ + const std::list<std::string> process_names = FiniteElement::getAllProcessNames(); + for (std::list<std::string>::const_iterator it = process_names.begin(); it != process_names.end(); ++it) + this->processTypeBox->addItem(QString::fromStdString(*it)); + + const std::list<std::string> pv_names = FiniteElement::getAllPrimaryVariableNames(); + for (std::list<std::string>::const_iterator it = pv_names.begin(); it != pv_names.end(); ++it) + this->pvTypeBox->addItem(QString::fromStdString(*it)); +} + +void NewProcessDialog::accept() +{ + ProcessInfo* info = new ProcessInfo(); + info->setProcessType(static_cast<FiniteElement::ProcessType>(this->processTypeBox->currentIndex() + 1)); + info->setProcessPrimaryVariable(static_cast<FiniteElement::PrimaryVariable>(this->pvTypeBox->currentIndex() + 1)); + + emit addProcess(info); + this->done(QDialog::Accepted); +} + +void NewProcessDialog::reject() +{ + this->done(QDialog::Rejected); +} diff --git a/DataView/NewProcessDialog.h b/DataView/NewProcessDialog.h new file mode 100644 index 00000000000..f189f1b2853 --- /dev/null +++ b/DataView/NewProcessDialog.h @@ -0,0 +1,43 @@ +/** + * \file NewProcessDialog.h + * 2011/11/17 KR Initial implementation + */ + +#ifndef NEWPROCESSDIALOG_H +#define NEWPROCESSDIALOG_H + +#include <QDialog> + +#include "ui_NewProcess.h" + +class ProcessInfo; + +/** + * \brief A dialog window for adding a new process in GUI + */ +class NewProcessDialog : public QDialog, private Ui_NewProcess +{ + Q_OBJECT + +public: + /// Constructor for creating a new FEM condition. + NewProcessDialog(QDialog* parent = 0); + + ~NewProcessDialog(void) {}; + +private: + void setupDialog(); + +private slots: + /// Instructions if the OK-Button has been pressed. + void accept(); + + /// Instructions if the Cancel-Button has been pressed. + void reject(); + +signals: + void addProcess(ProcessInfo*); + +}; + +#endif //NEWPROCESSDIALOG_H diff --git a/DataView/OGSRaster.cpp b/DataView/OGSRaster.cpp index ed198ff2ea0..b5727f52c59 100644 --- a/DataView/OGSRaster.cpp +++ b/DataView/OGSRaster.cpp @@ -34,12 +34,7 @@ bool OGSRaster::loadImage(const QString &fileName, QImage &raster, QPointF &orig if (!loadImageFromASC(fileName, raster, origin, scalingFactor, autoscale)) return false; if (mirrorX) - raster = raster.transformed(QTransform(1, - 0, - 0, - -1, - 0, - 0), Qt::FastTransformation); + raster = raster.transformed(QTransform(1, 0, 0, -1, 0, 0), Qt::FastTransformation); } #ifdef libgeotiff_FOUND else if (fileInfo.suffix().toLower() == "tif") @@ -47,12 +42,7 @@ bool OGSRaster::loadImage(const QString &fileName, QImage &raster, QPointF &orig if (!loadImageFromTIFF(fileName, raster, origin, scalingFactor)) return false; if (!mirrorX) - raster = raster.transformed(QTransform(1, - 0, - 0, - -1, - 0, - 0), Qt::FastTransformation); + raster = raster.transformed(QTransform(1, 0, 0, -1, 0, 0), Qt::FastTransformation); } #endif else if (!loadImageFromFile(fileName, raster)) @@ -94,12 +84,8 @@ bool OGSRaster::loadImageFromASC(const QString &fileName, pixVal[index + i] = strtod(replaceString(",", ".", s).c_str(),0); if (pixVal[index + i] != header.noData) { // find intensity bounds but ignore noData values - minVal = - (pixVal[index + - i] < minVal) ? pixVal[index + i] : minVal; - maxVal = - (pixVal[index + - i] > maxVal) ? pixVal[index + i] : maxVal; + minVal = (pixVal[index + i] < minVal) ? pixVal[index + i] : minVal; + maxVal = (pixVal[index + i] > maxVal) ? pixVal[index + i] : maxVal; } } } @@ -117,14 +103,9 @@ bool OGSRaster::loadImageFromASC(const QString &fileName, { // scale intensities and set nodata values to zero (black) if (pixVal[index + i] != header.noData) { - value = - (pixVal[index + i] == - header.noData) ? minVal : pixVal[index + i]; - gVal = - (autoscale) ? static_cast<int> (floor((value - - minVal) * - scalingFactor)) - : static_cast<int> (value); + value = pixVal[index + i]; + gVal = (autoscale) ? + static_cast<int> (floor((value -minVal) * scalingFactor)) : static_cast<int> (value); //gVal = value; // saudi arabia img.setPixel(i,j, qRgba(gVal, gVal, gVal, 255)); } @@ -197,9 +178,10 @@ bool OGSRaster::readASCHeader(ascHeader &header, std::ifstream &in) else return false; - // correct raster position by half a pixel for correct visualisation - header.x = header.x + (header.cellsize / 2); - header.y = header.y + (header.cellsize / 2); + // correct raster position by half a pixel for correct visualisation + // argh! wrong! correction has to happen in visualisation object, otherwise the actual data is wrong + //header.x = header.x + (header.cellsize / 2); + //header.y = header.y + (header.cellsize / 2); return true; } diff --git a/DataView/ProcessItem.h b/DataView/ProcessItem.h new file mode 100644 index 00000000000..cc71efb6917 --- /dev/null +++ b/DataView/ProcessItem.h @@ -0,0 +1,34 @@ +/** + * \file ProcessItem.h + * 2011/11/22 KR Initial implementation + */ + +#ifndef PROCESSITEM_H +#define PROCESSITEM_H + +#include "TreeItem.h" +#include "ProcessInfo.h" + +/** + * \brief A TreeItem representing process information. + * \sa TreeItem + */ +class ProcessItem : public TreeItem +{ +public: + /// Constructor + ProcessItem(const QList<QVariant> &data, TreeItem* parent, const ProcessInfo* pcs) + : TreeItem(data, parent), _item(pcs) + { + } + + ~ProcessItem() {} + + /// Returns the Process Information associated with the item. + const ProcessInfo* getItem() { return _item; } + +private: + const ProcessInfo* _item; +}; + +#endif //PROCESSITEM_H diff --git a/DataView/ProcessModel.cpp b/DataView/ProcessModel.cpp new file mode 100644 index 00000000000..7076c75582c --- /dev/null +++ b/DataView/ProcessModel.cpp @@ -0,0 +1,267 @@ +/** + * \file ProcessModel.cpp + * 18/10/2010 KR Initial implementation + */ + +// ** INCLUDES ** +#include "ProcessItem.h" +#include "CondObjectListItem.h" +#include "CondItem.h" +#include "ProcessItem.h" +#include "ProcessModel.h" +#include "FEMCondition.h" +#include "GEOObjects.h" +#include "GeoObject.h" +#include "GeoType.h" + +#include <QFileInfo> +#include <vtkPolyDataAlgorithm.h> + +ProcessModel::ProcessModel( ProjectData &project, QObject* parent /*= 0*/ ) + : TreeModel(parent), _project(project) +{ + QList<QVariant> rootData; + delete _rootItem; + rootData << "Name" << "Value" << "" << "" << ""; + _rootItem = new TreeItem(rootData, NULL); +} + +ProcessModel::~ProcessModel() +{ +} + +int ProcessModel::columnCount( const QModelIndex &parent /*= QModelIndex()*/ ) const +{ + Q_UNUSED(parent) + + return 2; +} + +void ProcessModel::addConditionItem(FEMCondition* c) +{ + ProcessItem* processParent = this->getProcessParent(c->getProcessType()); + if (processParent == NULL) + { + ProcessInfo* pcs = new ProcessInfo(c->getProcessType(), c->getProcessPrimaryVariable(), NULL); + processParent = this->addProcess(pcs); + } + + CondObjectListItem* condParent = this->getCondParent(processParent, c->getCondType()); + if (condParent == NULL) + condParent = this->createCondParent(processParent, c->getCondType(), c->getAssociatedGeometryName()); + + if (condParent) + { + QList<QVariant> condData; + condData << QString::fromStdString(c->getGeoName()) + << QString::fromStdString(c->getGeoTypeAsString()); + CondItem* condItem = new CondItem(condData, condParent, c); + condParent->appendChild(condItem); + // add process information + //QList<QVariant> pcsData; + //pcsData << QString::fromStdString(convertProcessTypeToString(c->getProcessType())); + //TreeItem* pcsInfo = new TreeItem(pcsData, condItem); + // add information on primary variable + QList<QVariant> pvData; + pvData << QString::fromStdString(convertPrimaryVariableToString(c->getProcessPrimaryVariable())); + TreeItem* pvInfo = new TreeItem(pvData, condItem); + // add distribution information + QList<QVariant> disData; + disData << QString::fromStdString(convertDisTypeToString(c->getProcessDistributionType())); + std::vector<double> dis_value = c->getDisValue(); + TreeItem* disInfo; + if (c->getProcessDistributionType() == FiniteElement::CONSTANT || + c->getProcessDistributionType() == FiniteElement::CONSTANT_NEUMANN) + { + //for (size_t i = 0; i < dis_value.size(); i++) + disData << dis_value[0]; + disInfo = new TreeItem(disData, condItem); + } + else + { + size_t nVals = dis_value.size() / 2; + disData << static_cast<int>(nVals); + disInfo = new TreeItem(disData, condItem); + for (size_t i = 0; i < nVals; i++) + { + QList<QVariant> linData; + linData << dis_value[2 * i] << dis_value[2 * i + 1]; + TreeItem* linInfo = new TreeItem(linData, disInfo); + disInfo->appendChild(linInfo); + } + } + + //condItem->appendChild(pcsInfo); + condItem->appendChild(pvInfo); + condItem->appendChild(disInfo); + + condParent->addCondition(c); + reset(); + } + else + std::cout << "Error in ProcessModel::addConditionItem() - Parent object not found..." << std::endl; +} + +void ProcessModel::addCondition(FEMCondition* condition) +{ + const bool is_domain = (condition->getGeoType() == GEOLIB::GEODOMAIN) ? true : false; + + const GEOLIB::GeoObject* object = condition->getGeoObj(); + if (object == NULL) + { + object = _project.getGEOObjects()->getGEOObject( + condition->getAssociatedGeometryName(), + condition->getGeoType(), + condition->getGeoName()); + condition->setGeoObj(object); + } + if (object || is_domain) + { + _project.addCondition(condition); + this->addConditionItem(condition); + } + else + std::cout << "Error in ProcessModel::addConditions() - Specified geometrical object \"" + << condition->getGeoName() << "\" not found in associated geometry..." + << std::endl; +} + +void ProcessModel::addConditions(std::vector<FEMCondition*> &conditions) +{ + for (size_t i = 0; i < conditions.size(); i++) + this->addCondition(conditions[i]); +} + +ProcessItem* ProcessModel::addProcess(ProcessInfo *pcs) +{ + if (this->getProcessParent(pcs->getProcessType()) == NULL) + { + this->_project.addProcess(pcs); + QList<QVariant> processData; + processData << QVariant(QString::fromStdString(FiniteElement::convertProcessTypeToString(pcs->getProcessType()))) << ""; + ProcessItem* process = new ProcessItem(processData, _rootItem, pcs); + _rootItem->appendChild(process); + reset(); + return process; + } + else + { + std::cout << "Warning in ProcessModel::addProcess() - " + << FiniteElement::convertProcessTypeToString(pcs->getProcessType()) + << " already exists." << std::endl; + return NULL; + } +} + +void ProcessModel::removeFEMConditions(const FiniteElement::ProcessType pcs_type, const std::string &geometry_name, const FEMCondition::CondType cond_type) +{ + _project.removeConditions(pcs_type, geometry_name, cond_type); + + while (_rootItem->childCount()>0) + { + ProcessItem* pcs = static_cast<ProcessItem*>(_rootItem->child(0)); + for (int j=0; j<pcs->childCount(); j++) + emit conditionsRemoved(this, pcs->getItem()->getProcessType(), (static_cast<CondObjectListItem*>(pcs->child(j)))->getType()); + + _rootItem->removeChildren(0, 1); + } + + const std::vector<FEMCondition*> conds = _project.getConditions(FiniteElement::INVALID_PROCESS, "", FEMCondition::UNSPECIFIED); + if (!conds.empty()) + { + size_t nConds (conds.size()); + for (size_t i=0; i<nConds; i++) + this->addConditionItem(conds[i]); + } + reset(); +} + +void ProcessModel::removeProcess(const FiniteElement::ProcessType type) +{ + this->removeFEMConditions(type, "", FEMCondition::UNSPECIFIED); + + const ProcessItem* processParent = this->getProcessParent(type); + if (processParent) + { + this->_project.removeProcess(type); + removeRows(processParent->row(), 1, QModelIndex()); + } + reset(); +} + +void ProcessModel::removeAllProcesses() +{ + int nProcesses = _rootItem->childCount(); + for (int i=0; i<nProcesses; i++) + { + ProcessItem* item = static_cast<ProcessItem*>(_rootItem->child(i)); + removeProcess(item->getItem()->getProcessType()); + } +} + +int ProcessModel::getGEOIndex(const std::string &geo_name, + GEOLIB::GEOTYPE type, + const std::string &obj_name) const +{ + bool exists(false); + size_t idx(0); + if (type == GEOLIB::POINT) + exists = this->_project.getGEOObjects()->getPointVecObj(geo_name)->getElementIDByName(obj_name, idx); + else if (type == GEOLIB::POLYLINE) + exists = this->_project.getGEOObjects()->getPolylineVecObj(geo_name)->getElementIDByName(obj_name,idx); + else if (type == GEOLIB::SURFACE) + exists = this->_project.getGEOObjects()->getSurfaceVecObj(geo_name)->getElementIDByName(obj_name,idx); + + if (exists) + return static_cast<int>(idx); + return -1; +} + +ProcessItem* ProcessModel::getProcessParent(const FiniteElement::ProcessType type) const +{ + int nLists = _rootItem->childCount(); + for (int i = 0; i < nLists; i++) + if (static_cast<ProcessItem*>(_rootItem->child(i))->getItem()->getProcessType() == type) + return static_cast<ProcessItem*>(_rootItem->child(i)); + + return NULL; +} + +CondObjectListItem* ProcessModel::getCondParent(TreeItem* parent, const FEMCondition::CondType type) +{ + int nLists = parent->childCount(); + for (int i = 0; i < nLists; i++) + if (dynamic_cast<CondObjectListItem*>(parent->child(i))->getType() == type) + return dynamic_cast<CondObjectListItem*>(parent->child(i)); + return NULL; +} + +CondObjectListItem* ProcessModel::createCondParent(ProcessItem* parent, const FEMCondition::CondType cond_type, const std::string &geometry_name) +{ + QString condType(QString::fromStdString(FEMCondition::condTypeToString(cond_type))); + QList<QVariant> condData; + condData << condType << ""; + + const std::vector<GEOLIB::Point*>* pnts = _project.getGEOObjects()->getPointVec(geometry_name); + if (pnts) + { + CondObjectListItem* cond = new CondObjectListItem(condData, parent, cond_type, pnts); + parent->appendChild(cond); + emit conditionAdded(this, parent->getItem()->getProcessType(), cond_type); + return cond; + } + + return NULL; +} + +vtkPolyDataAlgorithm* ProcessModel::vtkSource(const FiniteElement::ProcessType pcs_type, const FEMCondition::CondType cond_type) +{ + ProcessItem* processParent = this->getProcessParent(pcs_type); + if (processParent) + { + CondObjectListItem* condParent = this->getCondParent(processParent, cond_type); + if (condParent) + return condParent->vtkSource(); + } + return NULL; +} diff --git a/DataView/ProcessModel.h b/DataView/ProcessModel.h new file mode 100644 index 00000000000..0970502eeae --- /dev/null +++ b/DataView/ProcessModel.h @@ -0,0 +1,87 @@ +/** + * \file ProcessModel.h + * 18/10/2010 KR Initial implementation + */ + +#ifndef PROCESSMODEL_H +#define PROCESSMODEL_H + +// ** INCLUDES ** +#include "ProjectData.h" +#include "TreeModel.h" + +class FEMCondition; +class ProcessItem; +class CondObjectListItem; +class vtkPolyDataAlgorithm; + +namespace GEOLIB +{ +class GeoObject; +} + +/** + * \brief A model implementing a tree structure for process-relevant information such as + * process types, FEM-Conditions (BCs, ICs, STs), etc. as a double-linked list. + * \sa TreeModel, ProcessView, TreeItem, CondObjectListItem + */ +class ProcessModel : public TreeModel +{ + Q_OBJECT + +public: + ProcessModel(ProjectData &project, QObject* parent = 0); + ~ProcessModel(); + + int columnCount(const QModelIndex& parent = QModelIndex()) const; + /// Returns the vtk source object for the specified subtree of a process with the given name. + vtkPolyDataAlgorithm* vtkSource(const FiniteElement::ProcessType pcs_type, const FEMCondition::CondType cond_type); + +public slots: + /// Adds a vector of FEM Conditions to the model. Objects in the vector can consist of BCs, ICs or STs in any combination and sequence. + void addConditions(std::vector<FEMCondition*> &conditions); + + /// Adds a single FEM Conditions to the model + void addCondition(FEMCondition* condition); + + /// Adds a process to the model + ProcessItem* addProcess(ProcessInfo* pcs); + + /// Removes FEMConditions from the the model. Conditions can be specified by process type, geometry name or condition type or a combination of the three. + void removeFEMConditions(const FiniteElement::ProcessType pcs_type, const std::string &geometry_name, const FEMCondition::CondType cond_type); + + /// Removes a process from the model + void removeProcess(const FiniteElement::ProcessType type); + + /// Removes all processes from the model + void removeAllProcesses(); + +private: + /// Adds a new FEM condition to the condition tree model. + void addConditionItem(FEMCondition* condition); + + /// Removes the FEM condition with the given index. + //bool removeConditionItem(const QModelIndex &idx); + + /// Creates the TreeItem for one of the condition subtrees. + CondObjectListItem* createCondParent(ProcessItem* parent, const FEMCondition::CondType type, const std::string &geometry_name); + + /// Returns the subtree-item for a given type of condtion. + CondObjectListItem* getCondParent(TreeItem* parent, const FEMCondition::CondType type) ; + + /// Returns the subtree item for a process with the given name. If create_item is true, this item will be created if it doesn't exist yet. + ProcessItem* getProcessParent(const FiniteElement::ProcessType type) const; + + /// Returns the index of a geometric item of the given name and type for the associated geometry. + int getGEOIndex(const std::string &geo_name, + GEOLIB::GEOTYPE type, + const std::string &obj_name) const; + + ProjectData& _project; + +signals: + void conditionAdded(ProcessModel*, const FiniteElement::ProcessType, const FEMCondition::CondType); + void conditionsRemoved(ProcessModel*, const FiniteElement::ProcessType, const FEMCondition::CondType); +}; + +#endif // PROCESSMODEL_H diff --git a/DataView/ProcessView.cpp b/DataView/ProcessView.cpp new file mode 100644 index 00000000000..d71ef1beab4 --- /dev/null +++ b/DataView/ProcessView.cpp @@ -0,0 +1,88 @@ +/** + * \file ProcessView.cpp + * 2010/12/13 KR Initial implementation + */ + +#include <QMenu> +#include <QFileDialog> + +#include "ProcessItem.h" +#include "CondObjectListItem.h" +#include "ProcessModel.h" +#include "ProcessView.h" + + +ProcessView::ProcessView(QWidget* parent) : QTreeView(parent) +{ +} + +void ProcessView::updateView() +{ + setAlternatingRowColors(true); + resizeColumnToContents(0); + setColumnWidth(1,50); + setColumnWidth(2,50); +} + +void ProcessView::on_Clicked(QModelIndex idx) +{ + qDebug("%d, %d",idx.parent().row(), idx.row()); +} + +void ProcessView::selectionChanged( const QItemSelection &selected, + const QItemSelection &deselected ) +{ + emit itemSelectionChanged(selected, deselected); + return QTreeView::selectionChanged(selected, deselected); +} + +void ProcessView::contextMenuEvent( QContextMenuEvent* event ) +{ + Q_UNUSED(event); + + ProcessItem* pcs_item = dynamic_cast<ProcessItem*>(static_cast<ProcessModel*>(this->model())-> + getItem(this->selectionModel()->currentIndex())); + CondObjectListItem* cond_item = + dynamic_cast<CondObjectListItem*>(static_cast<ProcessModel*>(this->model())-> + getItem(this->selectionModel()->currentIndex())); + + if (pcs_item || cond_item) + { + QMenu menu; + if (cond_item) + { + QAction* removeCondAction = menu.addAction("Remove conditions"); + connect(removeCondAction, SIGNAL(triggered()), this, SLOT(removeCondition())); + } + + if (pcs_item) + { + QAction* removePCSAction = menu.addAction("Remove process"); + connect(removePCSAction, SIGNAL(triggered()), this, SLOT(removeProcess())); + } + menu.exec(event->globalPos()); + } +} + +void ProcessView::removeCondition() +{ + CondObjectListItem* item = dynamic_cast<CondObjectListItem*>(static_cast<ProcessModel*>(this->model())->getItem(this->selectionModel()->currentIndex())); + + if (item) + { + const FiniteElement::ProcessType pcs_type = static_cast<ProcessItem*>(item->parentItem())->getItem()->getProcessType(); + const FEMCondition::CondType cond_type = item->getType(); + emit conditionsRemoved(pcs_type, "", cond_type); + } +} + +void ProcessView::removeProcess() +{ + ProcessItem* item = dynamic_cast<ProcessItem*>(static_cast<ProcessModel*>(this->model())->getItem(this->selectionModel()->currentIndex())); + + if (item) + { + const FiniteElement::ProcessType pcs_type = item->getItem()->getProcessType(); + emit processRemoved(pcs_type); + } +} diff --git a/DataView/ConditionView.h b/DataView/ProcessView.h similarity index 66% rename from DataView/ConditionView.h rename to DataView/ProcessView.h index 619da4366aa..d868fa21c75 100644 --- a/DataView/ConditionView.h +++ b/DataView/ProcessView.h @@ -1,10 +1,10 @@ /** - * \file ConditionView.h + * \file ProcessView.h * 2010/12/13 KR Initial implementation */ -#ifndef CONDITIONVIEW_H -#define CONDITIONVIEW_H +#ifndef PROCESSVIEW_H +#define PROCESSVIEW_H #include <QContextMenuEvent> #include <QTreeView> @@ -18,13 +18,13 @@ class ConditionModel; * information such as Process Type, Distribution, etc. * \sa ConditionModel, CondItem */ -class ConditionView : public QTreeView +class ProcessView : public QTreeView { Q_OBJECT public: /// Constructor - ConditionView(QWidget* parent = 0); + ProcessView(QWidget* parent = 0); /// Update the view to visualise changes made to the underlying data void updateView(); @@ -40,12 +40,12 @@ private: private slots: void on_Clicked(QModelIndex idx); void removeCondition(); - //void removeAllConditions(); + void removeProcess(); signals: - void itemSelectionChanged(const QItemSelection & selected, - const QItemSelection & deselected); - void conditionsRemoved(QString, FEMCondition::CondType); + void conditionsRemoved(const FiniteElement::ProcessType, const std::string&, const FEMCondition::CondType); + void itemSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected); + void processRemoved(const FiniteElement::ProcessType); }; -#endif //CONDITIONVIEW_H +#endif //PROCESSVIEW_H diff --git a/DataView/QueryResultsDialog.h b/DataView/QueryResultsDialog.h index fa6dc45a947..2e374b32784 100644 --- a/DataView/QueryResultsDialog.h +++ b/DataView/QueryResultsDialog.h @@ -8,7 +8,7 @@ #include "ui_DatabaseResultView.h" #include <QSqlQueryModel> -#include <QtGui/QMainWindow> +#include <QDialog> /** * \brief A Dialog for displaying the results of a database query in a table. diff --git a/DataView/SHPImportDialog.h b/DataView/SHPImportDialog.h index 82813e3dae2..59e834978cc 100644 --- a/DataView/SHPImportDialog.h +++ b/DataView/SHPImportDialog.h @@ -7,7 +7,6 @@ #define SHPIMPORTDIALOG_H #include <QDialog> -#include <QtGui/QMainWindow> class SHPInterface; class GEOModels; diff --git a/DataView/SetNameDialog.cpp b/DataView/SetNameDialog.cpp new file mode 100644 index 00000000000..2f0ffb19468 --- /dev/null +++ b/DataView/SetNameDialog.cpp @@ -0,0 +1,57 @@ +/** + * \file SetNameDialog.cpp + * 2011/10/26 KR Initial implementation + */ + +#include "SetNameDialog.h" + +#include <QDialogButtonBox> +#include <QDialogButtonBox> +#include <QLabel> +#include <QLineEdit> +#include <QVBoxLayout> + +SetNameDialog::SetNameDialog(const std::string &parent_name, const std::string &object_type_name, size_t id, const std::string &old_name = "", QDialog* parent) : + QDialog(parent), _parent_name(parent_name), _object_type_name(object_type_name), _id(id) +{ + setupDialog(old_name); + show(); +} + +SetNameDialog::~SetNameDialog() +{ + delete _buttonBox; + delete _layout; + delete _new_name; + delete _txt_label; +} + +void SetNameDialog::setupDialog(const std::string &old_name) +{ + _layout = new QVBoxLayout(this); + QString dialog_text("Please enter a name for " + QString::fromStdString(_object_type_name) + " #" + QString::number(_id)); + _txt_label = new QLabel(this); + _txt_label->setText(dialog_text); + _new_name = new QLineEdit(QString::fromStdString(old_name)); + + setWindowTitle("Set name..."); + _layout->addWidget( _txt_label ); + _layout->addWidget( _new_name ); + _buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + connect(_buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + _layout->addWidget( _buttonBox ); + + setLayout(_layout); +} + +void SetNameDialog::accept() +{ + emit requestNameChange(_parent_name, GEOLIB::convertGeoType(_object_type_name), _id, _new_name->text().toStdString()); + this->done(QDialog::Accepted); +} + +void SetNameDialog::reject() +{ + this->done(QDialog::Rejected); +} diff --git a/DataView/SetNameDialog.h b/DataView/SetNameDialog.h new file mode 100644 index 00000000000..9b95132d410 --- /dev/null +++ b/DataView/SetNameDialog.h @@ -0,0 +1,59 @@ +/** + * \file SetNameDialog.h + * 2011/10/26 KR Initial implementation + */ + +#ifndef SETNAMEDIALOG_H +#define SETNAMEDIALOG_H + +#include "GeoType.h" + +#include <QDialog> + +class QDialogButtonBox; +class QLabel; +class QLineEdit; +class QVBoxLayout; + +/** + * \brief Small dialog for setting a name for an object. + */ +class SetNameDialog : public QDialog +{ + Q_OBJECT + +public: + /// Constructor + SetNameDialog(const std::string &parent_name, + const std::string &object_type_name, + size_t id, + const std::string &old_name, + QDialog* parent = 0); + ~SetNameDialog(); + + QDialogButtonBox* _buttonBox; /// The buttons used in this dialog. + +private: + /// Constructs a dialog window + void setupDialog(const std::string &old_name); + + QLabel* _txt_label; + QLineEdit* _new_name; + QVBoxLayout* _layout; + + std::string _parent_name; + std::string _object_type_name; + size_t _id; + +private slots: + /// Instructions if the OK-Button has been pressed. + void accept(); + + /// Instructions if the Cancel-Button has been pressed. + void reject(); + +signals: + void requestNameChange(const std::string&, const GEOLIB::GEOTYPE, size_t, std::string); +}; + +#endif //SETNAMEDIALOG_H diff --git a/Gui/CMakeLists.txt b/Gui/CMakeLists.txt index 3fa240d0920..7c5479c8ad5 100644 --- a/Gui/CMakeLists.txt +++ b/Gui/CMakeLists.txt @@ -93,9 +93,13 @@ IF (Shapelib_FOUND) TARGET_LINK_LIBRARIES( ogs-gui ${Shapelib_LIBRARIES} ) ENDIF () # Shapelib_FOUND -IF (libtiff_FOUND AND libgeotiff_FOUND) - TARGET_LINK_LIBRARIES( ogs-gui ${libtiff_LIBRARIES} ${libgeotiff_LIBRARIES} ) -ENDIF () # libtiff_FOUND AND libgeotiff_FOUND +IF (libgeotiff_FOUND) + TARGET_LINK_LIBRARIES( ogs-gui ${libgeotiff_LIBRARIES} ) +ENDIF () # libgeotiff_FOUND + +IF (libtiff_FOUND) + TARGET_LINK_LIBRARIES( ogs-gui ${libtiff_LIBRARIES} ) +ENDIF () # libtiff_FOUND ADD_DEPENDENCIES ( ogs-gui VtkVis OGSProject ) @@ -104,6 +108,10 @@ IF(MSVC) SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:MSVCRT") ENDIF(MSVC) +IF(OGS_BUILD_INFO) + ADD_DEFINITIONS(-DOGS_BUILD_INFO) +ENDIF() # OGS_BUILD_INFO + ### OpenSG support ### IF (OGS_USE_OPENSG) USE_OPENSG(ogs-gui) diff --git a/Gui/mainwindow.cpp b/Gui/mainwindow.cpp index c7dca3b5073..58028f7a1b2 100644 --- a/Gui/mainwindow.cpp +++ b/Gui/mainwindow.cpp @@ -7,7 +7,7 @@ #include "mainwindow.h" // models -#include "ConditionModel.h" +#include "ProcessModel.h" #include "ElementTreeModel.h" #include "GEOModels.h" #include "GeoTreeModel.h" @@ -17,10 +17,13 @@ //dialogs #include "DBConnectionDialog.h" #include "DiagramPrefsDialog.h" +#include "FEMConditionSetupDialog.h" #include "GMSHPrefsDialog.h" #include "LineEditDialog.h" #include "ListPropertiesDialog.h" #include "MshQualitySelectionDialog.h" +#include "NewProcessDialog.h" +#include "SetNameDialog.h" #include "VisPrefsDialog.h" #include "VtkAddFilterDialog.h" @@ -47,7 +50,6 @@ #include "rf_bc_new.h" #include "rf_ic_new.h" #include "rf_st_new.h" -#include "wait.h" // FileIO includes #include "FEFLOWInterface.h" @@ -60,7 +62,10 @@ #include "OGSIOVer4.h" #include "PetrelInterface.h" #include "StationIO.h" -#include "XMLInterface.h" +#include "XmlIO/XmlCndInterface.h" +#include "XmlIO/XmlGmlInterface.h" +#include "XmlIO/XmlGspInterface.h" +#include "XmlIO/XmlStnInterface.h" #include "StringTools.h" @@ -74,6 +79,7 @@ #include <QDesktopWidget> #include <QFileDialog> #include <QMessageBox> +#include <QObject> #include <QSettings> // VTK includes @@ -93,6 +99,15 @@ #include "VtkTrackedCamera.h" #endif // OGS_USE_VRPN +#ifdef OGS_BUILD_INFO +#include "BuildInfo.h" +#endif // OGS_BUILD_INFO + +//// test only +//#include "rf_mmp_new.h" +//#include "rf_msp_new.h" +//#include "rf_mfp_new.h" + /// FEM. 11.03.2010. WW #include "problem.h" Problem* aproblem = NULL; @@ -109,29 +124,25 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) _project.setGEOObjects(_geoModels); _meshModels = new MshModel(_project); _elementModel = new ElementTreeModel(); - _conditionModel = new ConditionModel(_project); + _processModel = new ProcessModel(_project); geoTabWidget->treeView->setModel(_geoModels->getGeoModel()); stationTabWidget->treeView->setModel(_geoModels->getStationModel()); mshTabWidget->treeView->setModel(_meshModels); mshTabWidget->elementView->setModel(_elementModel); - conditionTabWidget->treeView->setModel(_conditionModel); + modellingTabWidget->treeView->setModel(_processModel); // vtk visualization pipeline _vtkVisPipeline = new VtkVisPipeline(visualizationWidget->renderer()); // station model connects - connect(stationTabWidget->treeView, - SIGNAL(stationListExportRequested(std::string, std::string)), + connect(stationTabWidget->treeView, SIGNAL(stationListExportRequested(std::string, std::string)), this, SLOT(exportBoreholesToGMS(std::string, std::string))); // export Stationlist to GMS - connect(stationTabWidget->treeView, - SIGNAL(stationListRemoved(std::string)), _geoModels, + connect(stationTabWidget->treeView, SIGNAL(stationListRemoved(std::string)), _geoModels, SLOT(removeStationVec(std::string))); // update model when stations are removed - connect(stationTabWidget->treeView, - SIGNAL(stationListSaved(QString, QString)), this, + connect(stationTabWidget->treeView, SIGNAL(stationListSaved(QString, QString)), this, SLOT(writeStationListToFile(QString, QString))); // save Stationlist to File - connect(_geoModels, - SIGNAL(stationVectorRemoved(StationTreeModel *, std::string)), + connect(_geoModels, SIGNAL(stationVectorRemoved(StationTreeModel *, std::string)), this, SLOT(updateDataViews())); // update data view when stations are removed connect(stationTabWidget->treeView, SIGNAL(diagramRequested(QModelIndex &)), this, SLOT(showDiagramPrefsDialog(QModelIndex &))); // connect treeview to diagramview @@ -143,14 +154,23 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) this, SLOT(writeGeometryToFile(QString, QString))); // save geometry to file connect(geoTabWidget->treeView, SIGNAL(requestLineEditDialog(const std::string &)), this, SLOT(showLineEditDialog(const std::string &))); // open line edit dialog + connect(geoTabWidget->treeView, SIGNAL(requestNameChangeDialog(const std::string&, const GEOLIB::GEOTYPE, size_t)), + this, SLOT(showGeoNameDialog(const std::string&, const GEOLIB::GEOTYPE, size_t))); + connect(geoTabWidget->treeView, SIGNAL(requestCondSetupDialog(const std::string&, const GEOLIB::GEOTYPE, size_t)), + this, SLOT(showCondSetupDialog(const std::string&, const GEOLIB::GEOTYPE, size_t))); connect(geoTabWidget->treeView, SIGNAL(loadFEMCondFileRequested(std::string)), - this, SLOT(loadFEMConditionsFromFile(std::string))); // add FEM Conditions + this, SLOT(loadFEMConditions(std::string))); // add FEM Conditions + connect(geoTabWidget->treeView, SIGNAL(saveFEMConditionsRequested(QString, QString)), + this, SLOT(writeFEMConditionsToFile(QString, QString))); connect(_geoModels, SIGNAL(geoDataAdded(GeoTreeModel *, std::string, GEOLIB::GEOTYPE)), this, SLOT(updateDataViews())); connect(_geoModels, SIGNAL(geoDataRemoved(GeoTreeModel *, std::string, GEOLIB::GEOTYPE)), this, SLOT(updateDataViews())); - //connect(_geoModels, SIGNAL(geoDataRemoved(GeoTreeModel*, std::string, GEOLIB::GEOTYPE)), - // _conditionModel, SLOT(removeFEMConditions(std::string, GEOLIB::GEOTYPE))); + connect(geoTabWidget->treeView, SIGNAL(geoItemSelected(const vtkPolyDataAlgorithm*, int)), + _vtkVisPipeline, SLOT(highlightGeoObject(const vtkPolyDataAlgorithm*, int))); + connect(geoTabWidget->treeView, SIGNAL(removeGeoItemSelection()), + _vtkVisPipeline, SLOT(removeHighlightedGeoObject())); + // Setup connections for mesh models to GUI connect(mshTabWidget->treeView, SIGNAL(requestMeshRemoval(const QModelIndex &)), @@ -159,14 +179,16 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) _elementModel, SLOT(clearView())); connect(mshTabWidget->treeView, SIGNAL(qualityCheckRequested(VtkMeshSource*)), this, SLOT(showMshQualitySelectionDialog(VtkMeshSource*))); - connect(mshTabWidget->treeView, - SIGNAL(requestDIRECTSourceTerms(const std::vector<GEOLIB::Point*>*)), + connect(mshTabWidget->treeView, SIGNAL(requestDIRECTSourceTerms(const std::vector<GEOLIB::Point*>*)), this, SLOT(loadDIRECTSourceTerms(const std::vector<GEOLIB::Point*>*))); - // Setup connections for condition model to GUI - connect(conditionTabWidget->treeView, - SIGNAL(conditionsRemoved(QString, FEMCondition::CondType)), - _conditionModel, SLOT(removeFEMConditions(QString, FEMCondition::CondType))); + // Setup connections for process model to GUI + connect(modellingTabWidget->treeView, SIGNAL(conditionsRemoved(const FiniteElement::ProcessType, const std::string&, const FEMCondition::CondType)), + _processModel, SLOT(removeFEMConditions(const FiniteElement::ProcessType, const std::string&, const FEMCondition::CondType))); + connect(modellingTabWidget->treeView, SIGNAL(processRemoved(const FiniteElement::ProcessType)), + _processModel, SLOT(removeProcess(const FiniteElement::ProcessType))); + connect(modellingTabWidget, SIGNAL(requestNewProcess()), + this, SLOT(showNewProcessDialog())); // VisPipeline Connects connect(_geoModels, SIGNAL(geoDataAdded(GeoTreeModel *, std::string, GEOLIB::GEOTYPE)), @@ -174,14 +196,10 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) connect(_geoModels, SIGNAL(geoDataRemoved(GeoTreeModel *, std::string, GEOLIB::GEOTYPE)), _vtkVisPipeline, SLOT(removeSourceItem(GeoTreeModel *, std::string, GEOLIB::GEOTYPE))); - connect(_conditionModel, - SIGNAL(conditionAdded(ConditionModel *, std::string, FEMCondition::CondType)), - _vtkVisPipeline, - SLOT(addPipelineItem(ConditionModel *, std::string, FEMCondition::CondType))); - connect(_conditionModel, - SIGNAL(conditionsRemoved(ConditionModel *, std::string, FEMCondition::CondType)), - _vtkVisPipeline, - SLOT(removeSourceItem(ConditionModel *, std::string, FEMCondition::CondType))); + connect(_processModel, SIGNAL(conditionAdded(ProcessModel *, const FiniteElement::ProcessType, const FEMCondition::CondType)), + _vtkVisPipeline, SLOT(addPipelineItem(ProcessModel *, const FiniteElement::ProcessType, const FEMCondition::CondType))); + connect(_processModel, SIGNAL(conditionsRemoved(ProcessModel *, const FiniteElement::ProcessType, const FEMCondition::CondType)), + _vtkVisPipeline, SLOT(removeSourceItem(ProcessModel *, const FiniteElement::ProcessType, const FEMCondition::CondType))); connect(_geoModels, SIGNAL(stationVectorAdded(StationTreeModel *, std::string)), _vtkVisPipeline, SLOT(addPipelineItem(StationTreeModel *, std::string))); @@ -237,8 +255,8 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) // Stack the data dock widgets together tabifyDockWidget(geoDock, mshDock); - tabifyDockWidget(mshDock, conditionDock); - tabifyDockWidget(conditionDock, stationDock); + tabifyDockWidget(mshDock, modellingDock); + tabifyDockWidget(modellingDock, stationDock); // Restore window geometry readSettings(); @@ -283,9 +301,9 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) SLOT(showMshDockWidget(bool))); menuWindows->addAction(showMshDockAction); - QAction* showCondDockAction = conditionDock->toggleViewAction(); - showCondDockAction->setStatusTip(tr("Shows / hides the FEM conditions view")); - connect(showCondDockAction, SIGNAL(triggered(bool)), this, + QAction* showModellingDockAction = modellingDock->toggleViewAction(); + showModellingDockAction->setStatusTip(tr("Shows / hides the Process view")); + connect(showModellingDockAction, SIGNAL(triggered(bool)), this, SLOT(showMshDockWidget(bool))); menuWindows->addAction(showMshDockAction); @@ -341,6 +359,9 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) // std::cout << "size of CBoundaryCondition: " << sizeof (CBoundaryCondition) << std::endl; // std::cout << "size of CElement: " << sizeof (FiniteElement::CElement) << std::endl; +// std::cout << "size of CMediumProperties: " << sizeof(CMediumProperties) << std::endl; +// std::cout << "size of CSolidProperties: " << sizeof(SolidProp::CSolidProperties) << std::endl; +// std::cout << "size of CFluidProperties: " << sizeof(CFluidProperties) << std::endl; // std::cout << "size of CRFProcess: " << sizeof (CRFProcess) << std::endl; // std::cout << "size of CFEMesh: " << sizeof (MeshLib::CFEMesh) << std::endl; } @@ -350,7 +371,7 @@ MainWindow::~MainWindow() delete _db; delete _vtkVisPipeline; delete _meshModels; - delete _conditionModel; + delete _processModel; //delete _visPrefsDialog; //delete _geoModels; @@ -392,9 +413,9 @@ void MainWindow::showMshDockWidget(bool show) void MainWindow::showConditionDockWidget(bool show) { if (show) - conditionDock->show(); + modellingDock->show(); else - conditionDock->hide(); + modellingDock->hide(); } void MainWindow::showVisDockWidget(bool show) @@ -408,11 +429,8 @@ void MainWindow::showVisDockWidget(bool show) void MainWindow::open() { QSettings settings("UFZ", "OpenGeoSys-5"); - QString fileName = QFileDialog::getOpenFileName( this, "Select data file to open", - settings.value( - "lastOpenedFileDirectory"). - toString(), - "Geosys files (*.gsp *.gli *.gml *.msh *.stn);;Project files (*.gsp);;GLI files (*.gli);;MSH files (*.msh);;STN files (*.stn);;All files (* *.*)"); + QString fileName = QFileDialog::getOpenFileName( this, "Select data file to open",settings.value("lastOpenedFileDirectory").toString(), + "Geosys files (*.gsp *.gli *.gml *.msh *.stn);;Project files (*.gsp);;GeoSys FEM Conditions (*.cnd *.bc *.ic *.st);;GLI files (*.gli);;MSH files (*.msh);;STN files (*.stn);;All files (* *.*)"); if (!fileName.isEmpty()) { QDir dir = QDir(fileName); @@ -473,20 +491,15 @@ void MainWindow::save() if (fi.suffix().toLower() == "gsp") { std::string schemaName(_fileFinder.getPath("OpenGeoSysProject.xsd")); - XMLInterface xml(&_project, schemaName); - xml.writeProjectFile(fileName); - /* - } else if (fi.suffix().toLower() == "gml") { - std::string schemaName(_fileFinder.getPath("OpenGeoSysGLI.xsd")); - XMLInterface xml(_geoModels, schemaName); - xml.writeGLIFile(fileName, gliName); - */ + XmlGspInterface xml(&_project, schemaName); + xml.writeFile(fileName); } else if (fi.suffix().toLower() == "geo") { // it works like this (none of it is particularily fast or optimised or anything): // 1. merge all geometries that are currently loaded, all of these will be integrated into the mesh // 2. if "useStationsAsConstraints"-parameter is true, GMSH-Interface will also integrate all stations that are currently loaded + // if "useSteinerPoints"-parameter is true, additional points will be inserted in large areas without information // 3. after the geo-file is created the merged geometry is deleted again as it is no longer needed GMSHInterface gmsh_io(fileName.toStdString()); std::vector<std::string> names; @@ -494,7 +507,7 @@ void MainWindow::save() std::string merge_name("MergedGeometry"); _geoModels->mergeGeometries (names, merge_name); gmsh_io.writeGMSHInputFile(merge_name, - *(this->_project.getGEOObjects()), true); + *(this->_project.getGEOObjects()), true, true); this->_project.getGEOObjects()->removeSurfaceVec(merge_name); this->_project.getGEOObjects()->removePolylineVec(merge_name); this->_project.getGEOObjects()->removePointVec(merge_name); @@ -518,8 +531,7 @@ void MainWindow::loadFile(const QString &fileName) QApplication::setOverrideCursor(Qt::WaitCursor); QFileInfo fi(fileName); - std::string - base = + std::string base = fi.absoluteDir().absoluteFilePath(fi.completeBaseName()).toStdString(); if (fi.suffix().toLower() == "gli") { @@ -528,7 +540,8 @@ void MainWindow::loadFile(const QString &fileName) myTimer0.start(); #endif // FileIO::readGLIFileV4 (fileName.toStdString(), _geoModels); - readGLIFileV4(fileName.toStdString(), _geoModels); + std::string unique_name; + readGLIFileV4(fileName.toStdString(), _geoModels, unique_name); #ifndef NDEBUG std::cout << myTimer0.elapsed() << " ms" << std::endl; #endif @@ -550,8 +563,8 @@ void MainWindow::loadFile(const QString &fileName) else if (fi.suffix().toLower() == "gsp") { std::string schemaName(_fileFinder.getPath("OpenGeoSysProject.xsd")); - XMLInterface xml(&_project, schemaName); - xml.readProjectFile(fileName); + XmlGspInterface xml(&_project, schemaName); + xml.readFile(fileName); std::cout << "Adding missing meshes to GUI..." << std::endl; _meshModels->updateModel(); } @@ -562,8 +575,8 @@ void MainWindow::loadFile(const QString &fileName) myTimer0.start(); #endif std::string schemaName(_fileFinder.getPath("OpenGeoSysGLI.xsd")); - XMLInterface xml(&_project, schemaName); - xml.readGLIFile(fileName); + XmlGmlInterface xml(&_project, schemaName); + xml.readFile(fileName); #ifndef NDEBUG std::cout << myTimer0.elapsed() << " ms" << std::endl; #endif @@ -572,8 +585,8 @@ void MainWindow::loadFile(const QString &fileName) else if (fi.suffix().toLower() == "stn") { std::string schemaName(_fileFinder.getPath("OpenGeoSysSTN.xsd")); - XMLInterface xml(&_project, schemaName); - xml.readSTNFile(fileName); + XmlStnInterface xml(&_project, schemaName); + xml.readFile(fileName); } // OpenGeoSys mesh files else if (fi.suffix().toLower() == "msh") @@ -585,6 +598,13 @@ void MainWindow::loadFile(const QString &fileName) else OGSError::box("Failed to load a mesh file."); } + else if ((fi.suffix().toLower() == "cnd") || + (fi.suffix().toLower() == "bc") || + (fi.suffix().toLower() == "ic") || + (fi.suffix().toLower() == "st")) + { + this->loadFEMConditionsFromFile(fileName); + } // GMS borehole files else if (fi.suffix().toLower() == "txt") @@ -703,9 +723,23 @@ void MainWindow::writeSettings() void MainWindow::about() { QString ogsVersion = QString(OGS_VERSION); - QMessageBox::about(this, tr("About OpenGeoSys-5"), tr( - "Built on %1\nOGS Version: %2").arg( - QDate::currentDate().toString()).arg(ogsVersion)); + + QString about = tr("Built on %1\nOGS Version: %2\n\n").arg( + QDate::currentDate().toString(Qt::ISODate)).arg(ogsVersion); +#ifdef OGS_BUILD_INFO +#ifdef SVN_REVISION + about.append(QString("Svn commit: %1\n").arg(SVN_REVISION)); +#endif +#ifdef GIT_COMMIT_INFO + QString gitCommit = QString(GIT_COMMIT_INFO); + about.append(QString("Git commit: %1\n").arg(gitCommit.mid(7))); +#endif // GIT_COMMIT_INFO +#ifdef GIT_BRANCH_INFO + QString gitBranch = QString(GIT_BRANCH_INFO); + about.append(QString("Git branch: %1\n").arg(gitBranch.mid(2))); +#endif // GIT_BRANCH_INFO +#endif // OGS_BUILD_INFO + QMessageBox::about(this, "About OpenGeoSys-5", about); } QMenu* MainWindow::createImportFilesMenu() @@ -716,9 +750,9 @@ QMenu* MainWindow::createImportFilesMenu() QAction* gmsFiles = importFiles->addAction("G&MS Files..."); connect(gmsFiles, SIGNAL(triggered()), this, SLOT(importGMS())); QAction* gocadFiles = importFiles->addAction("&Gocad Files..."); + connect(gocadFiles, SIGNAL(triggered()), this, SLOT(importGoCad())); QAction* netcdfFiles = importFiles->addAction("&NetCDF Files..."); connect(netcdfFiles, SIGNAL(triggered()), this, SLOT(importNetcdf())); - connect(gocadFiles, SIGNAL(triggered()), this, SLOT(importGoCad())); QAction* petrelFiles = importFiles->addAction("&Petrel Files..."); connect(petrelFiles, SIGNAL(triggered()), this, SLOT(importPetrel())); QAction* rasterFiles = importFiles->addAction("&Raster Files..."); @@ -731,6 +765,8 @@ QMenu* MainWindow::createImportFilesMenu() QAction* shapeFiles = importFiles->addAction("&Shape Files..."); connect(shapeFiles, SIGNAL(triggered()), this, SLOT(importShape())); #endif + QAction* tetgenFiles = importFiles->addAction("&TetGen Files..."); + connect( tetgenFiles, SIGNAL(triggered()), this, SLOT(importTetGen()) ); QAction* vtkFiles = importFiles->addAction("&VTK Files..."); connect( vtkFiles, SIGNAL(triggered()), this, SLOT(importVtk()) ); @@ -776,13 +812,9 @@ void MainWindow::importRaster() #else QString geotiffExtension(""); #endif - QString fileName = QFileDialog::getOpenFileName(this, - "Select raster file to import", - settings.value( - "lastOpenedFileDirectory").toString(), - QString( - "Raster files (*.asc *.bmp *.jpg *.png%1);;") - .arg(geotiffExtension)); + QString fileName = QFileDialog::getOpenFileName(this, "Select raster file to import", + settings.value("lastOpenedFileDirectory").toString(), QString( + "Raster files (*.asc *.bmp *.jpg *.png%1);;") .arg(geotiffExtension)); if (!fileName.isEmpty()) { @@ -803,13 +835,10 @@ void MainWindow::importRasterAsPoly() #else QString geotiffExtension(""); #endif - QString fileName = QFileDialog::getOpenFileName(this, - "Select raster file to import", - settings.value( - "lastOpenedFileDirectory").toString(), - QString( - "Raster files (*.asc *.bmp *.jpg *.png%1);;") - .arg(geotiffExtension)); + QString fileName = QFileDialog::getOpenFileName(this, "Select raster file to import", + settings.value("lastOpenedFileDirectory").toString(), QString( + "Raster files (*.asc *.bmp *.jpg *.png%1);;") .arg( + geotiffExtension)); if (!fileName.isEmpty()) { @@ -835,10 +864,8 @@ void MainWindow::importRasterAsPoly() void MainWindow::importShape() { QSettings settings("UFZ", "OpenGeoSys-5"); - QString fileName = QFileDialog::getOpenFileName(this, - "Select shape file to import", - settings.value( - "lastOpenedFileDirectory").toString(), + QString fileName = QFileDialog::getOpenFileName(this, "Select shape file to import", + settings.value("lastOpenedFileDirectory").toString(), "ESRI Shape files (*.shp );;"); QFileInfo fi(fileName); @@ -857,15 +884,9 @@ void MainWindow::importPetrel() { QSettings settings("UFZ", "OpenGeoSys-5"); QStringList sfc_file_names = QFileDialog::getOpenFileNames( - this, - "Select surface data file(s) to import", - "", - "Petrel files (*)"); + this, "Select surface data file(s) to import", "", "Petrel files (*)"); QStringList well_path_file_names = QFileDialog::getOpenFileNames( - this, - "Select well path data file(s) to import", - "", - "Petrel files (*)"); + this, "Select well path data file(s) to import", "", "Petrel files (*)"); if (sfc_file_names.size() != 0 || well_path_file_names.size() != 0) { loadPetrelFiles(sfc_file_names, well_path_file_names); @@ -891,6 +912,28 @@ void MainWindow::importNetcdf() } } +void MainWindow::importTetGen() +{ + QSettings settings("UFZ", "OpenGeoSys-5"); + QString node_fname(QFileDialog::getOpenFileName(this, "Select TetGen node file", + settings.value("lastOpenedFileDirectory").toString(), + "TetGen node files (*.node);;")); + QString element_fname(QFileDialog::getOpenFileName(this, "Select TetGen element file", + settings.value("lastOpenedFileDirectory").toString(), + "TetGen element files (*.ele);;")); + + if (!node_fname.isEmpty() && !element_fname.isEmpty()) { + FileIO::TetGenInterface tetgen; + MeshLib::CFEMesh* msh (tetgen.readTetGenMesh(node_fname.toStdString(), element_fname.toStdString())); + if (msh) { + std::string name(node_fname.toStdString()); + _meshModels->addMesh(msh, name); + } else + OGSError::box("Failed to load a TetGen mesh."); + settings.setValue("lastOpenedFileDirectory", QDir(node_fname).absolutePath()); + } +} + void MainWindow::importVtk() { QSettings settings("UFZ", "OpenGeoSys-5"); @@ -954,34 +997,47 @@ void MainWindow::showAddPipelineFilterItemDialog(QModelIndex parentIndex) dlg.exec(); } -void MainWindow::loadFEMConditionsFromFile(std::string geoName) + +void MainWindow::loadFEMConditions(std::string geoName) { QSettings settings("UFZ", "OpenGeoSys-5"); QString fileName = QFileDialog::getOpenFileName( this, "Select data file to open", - settings.value( - "lastOpenedFileDirectory"). - toString(), - "Geosys FEM condition files (*.cnd *.bc *.ic *.st);;All files (* *.*)"); - if (!fileName.isEmpty()) - { - QFileInfo fi(fileName); - QDir dir = QDir(fileName); - settings.setValue("lastOpenedFileDirectory", dir.absolutePath()); + settings.value( + "lastOpenedFileDirectory"). + toString(), + "Geosys FEM condition files (*.cnd *.bc *.ic *.st);;All files (* *.*)"); + QDir dir = QDir(fileName); + settings.setValue("lastOpenedFileDirectory", dir.absolutePath()); - std::vector<FEMCondition*> conditions; + if (!fileName.isEmpty()) + this->loadFEMConditionsFromFile(fileName, geoName); +} - if (fi.suffix().toLower() == "cnd") +void MainWindow::loadFEMConditionsFromFile(const QString &fileName, std::string geoName) +{ + std::vector<FEMCondition*> conditions; + QFileInfo fi(fileName); + if (fi.suffix().toLower() == "cnd") + { + std::string schemaName(_fileFinder.getPath("OpenGeoSysCond.xsd")); + XmlCndInterface xml(&_project, schemaName); + xml.readFile(conditions, fileName); + } + else + { + if (geoName.empty()) { - std::string schemaName(_fileFinder.getPath("OpenGeoSysCond.xsd")); - XMLInterface xml(&_project, schemaName); - xml.readFEMCondFile(conditions, fileName, QString::fromStdString(geoName)); + // assume that geoName is identical to filename of the currently loaded file (but with *.gli-extension) + QFileInfo fi(fileName); + geoName = fi.fileName().toStdString(); + geoName = geoName.substr(0, geoName.find_last_of(".")).append(".gli"); } - else if (fi.suffix().toLower() == "bc") + if (fi.suffix().toLower() == "bc") { QString name = fi.path() + "/"; BCRead((name.append(fi.baseName())).toStdString(), *_geoModels, geoName); for (std::list<CBoundaryCondition*>::iterator it = bc_list.begin(); - it != bc_list.end(); ++it) + it != bc_list.end(); ++it) { BoundaryCondition* bc = new BoundaryCondition(*(*it), geoName); conditions.push_back(bc); @@ -992,7 +1048,7 @@ void MainWindow::loadFEMConditionsFromFile(std::string geoName) QString name = fi.path() + "/"; ICRead((name.append(fi.baseName())).toStdString(), *_geoModels, geoName); for (std::vector<CInitialCondition*>::iterator it = ic_vector.begin(); - it != ic_vector.end(); ++it) + it != ic_vector.end(); ++it) { InitialCondition* ic = new InitialCondition(*(*it), geoName); conditions.push_back(ic); @@ -1003,43 +1059,49 @@ void MainWindow::loadFEMConditionsFromFile(std::string geoName) QString name = fi.path() + "/"; STRead((name.append(fi.baseName())).toStdString(), *_geoModels, geoName); for (std::vector<CSourceTerm*>::iterator it = st_vector.begin(); - it != st_vector.end(); ++it) + it != st_vector.end(); ++it) { SourceTerm* st = new SourceTerm(*(*it), geoName); conditions.push_back(st); } } - - if (!conditions.empty()) - { - this->_conditionModel->addConditions(conditions); - - for (std::list<CBoundaryCondition*>::iterator it = bc_list.begin(); - it != bc_list.end(); ++it) - delete *it; - bc_list.clear(); - for (size_t i = 0; i < ic_vector.size(); i++) - delete ic_vector[i]; - ic_vector.clear(); - for (size_t i = 0; i < st_vector.size(); i++) - delete st_vector[i]; - st_vector.clear(); - } + } + if (!conditions.empty()) + { + this->_processModel->addConditions(conditions); + + for (std::list<CBoundaryCondition*>::iterator it = bc_list.begin(); + it != bc_list.end(); ++it) + delete *it; + bc_list.clear(); + for (size_t i = 0; i < ic_vector.size(); i++) + delete ic_vector[i]; + ic_vector.clear(); + for (size_t i = 0; i < st_vector.size(); i++) + delete st_vector[i]; + st_vector.clear(); } } +void MainWindow::writeFEMConditionsToFile(QString geoName, QString fileName) +{ + std::string schemaName(_fileFinder.getPath("OpenGeoSysCond.xsd")); + XmlCndInterface xml(&_project, schemaName); + xml.writeFile(fileName, geoName); +} + void MainWindow::writeGeometryToFile(QString gliName, QString fileName) { std::string schemaName(_fileFinder.getPath("OpenGeoSysGLI.xsd")); - XMLInterface xml(&_project, schemaName); - xml.writeGLIFile(fileName, gliName); + XmlGmlInterface xml(&_project, schemaName); + xml.writeFile(fileName, gliName); } void MainWindow::writeStationListToFile(QString listName, QString fileName) { std::string schemaName(_fileFinder.getPath("OpenGeoSysSTN.xsd")); - XMLInterface xml(&_project, schemaName); - xml.writeSTNFile(fileName, listName); + XmlStnInterface xml(&_project, schemaName); + xml.writeFile(fileName, listName); } void MainWindow::exportBoreholesToGMS(std::string listName, @@ -1154,30 +1216,58 @@ void MainWindow::showDiagramPrefsDialog() } } +void MainWindow::showGeoNameDialog(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, size_t id) +{ + std::string old_name = this->_geoModels->getElementNameByID(geometry_name, object_type, id); + SetNameDialog dlg(geometry_name, GEOLIB::convertGeoTypeToString(object_type), id, old_name); + connect(&dlg, SIGNAL(requestNameChange(const std::string&, const GEOLIB::GEOTYPE, size_t, std::string)), + this->_geoModels, SLOT(addNameForElement(const std::string&, const GEOLIB::GEOTYPE, size_t, std::string))); + dlg.exec(); + + static_cast<GeoTreeModel*>(this->geoTabWidget->treeView->model())->setNameForItem(geometry_name, object_type, + id, this->_geoModels->getElementNameByID(geometry_name, object_type, id)); +} + +void MainWindow::showCondSetupDialog(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, size_t id) +{ + std::string geo_name = this->_geoModels->getElementNameByID(geometry_name, object_type, id); + if (geo_name.empty()) + { + this->showGeoNameDialog(geometry_name, object_type, id); + geo_name = this->_geoModels->getElementNameByID(geometry_name, object_type, id); + } + // Object should now have a name ... if not, cancel the setup process + if (geo_name.empty()) + OGSError::box("FEM Condition Setup cancelled."); + else + { + FEMConditionSetupDialog dlg(geometry_name, object_type, geo_name, this->_geoModels->getGEOObject(geometry_name, object_type, geo_name)); + connect(&dlg, SIGNAL(addFEMCondition(FEMCondition*)), this->_processModel, SLOT(addCondition(FEMCondition*))); + dlg.exec(); + } +} + +void MainWindow::showNewProcessDialog() +{ + NewProcessDialog dlg; + connect(&dlg , SIGNAL(addProcess(ProcessInfo*)), + _processModel, SLOT(addProcess(ProcessInfo*))); + dlg.exec(); +} + 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<size_t>, double, std::string, bool, bool)), + _geoModels, SLOT(connectPolylineSegments(const std::string &, std::vector<size_t>, double, std::string, bool, bool))); lineEdit.exec(); } void MainWindow::showGMSHPrefsDialog() { GMSHPrefsDialog dlg(_geoModels); - connect( - &dlg, - SIGNAL(requestMeshing(std::vector<std::string> const &, size_t, double, double, - double, bool)), - this, - SLOT(callGMSH(std::vector<std::string> const &, size_t, double, double, double, - bool))); + connect(&dlg, SIGNAL(requestMeshing(std::vector<std::string> const &, size_t, double, double, double, bool)), + this, SLOT(callGMSH(std::vector<std::string> const &, size_t, double, double, double, bool))); dlg.exec(); } @@ -1196,6 +1286,9 @@ void MainWindow::showVisalizationPrefsDialog() void MainWindow::FEMTestStart() { + //FEMConditionSetupDialog* dlg = new FEMConditionSetupDialog(this->_project); + //dlg->exec(); + // *** begin test TetGen read mesh const std::string path ("/home/fischeth/Desktop/data/Ketzin/PSglobal/Tom/MSH/"); std::string mesh_name ("ClosedSurface"); @@ -1208,340 +1301,7 @@ void MainWindow::FEMTestStart() if (mesh) _meshModels->addMesh(mesh, mesh_name); else - OGSError::box("Failed to load TetGen mesh file."); - - // *** end test TetGen read mesh - -// // *** begin creating closed surface mesh -// { -// std::string path("/home/fischeth/Desktop/data/Ketzin/PSglobal/Tom/"); -// std::string fname(path+"ClosedSurface.geo"); -// FileIO::GMSHInterface gmsh_io(fname); -// -// std::vector<std::string> geometries; -// double param4(0); -// -// // all geos for top surface -// geometries.push_back("Boreholes Ketzin Top"); -// geometries.push_back("CoarseGridPointsAsStationsTop"); -// geometries.push_back("MiddleGridPointsAsStationsTop"); -// geometries.push_back("FineGridPointsAsStationsTop"); -// geometries.push_back("KetzinPolygonTop"); -// gmsh_io.writeAllDataToGMSHInputFile(*_geoModels, -// geometries, param4); -// -// geometries.clear(); -// // all geos for bottom surface -// geometries.push_back("Boreholes Ketzin Bottom"); -// geometries.push_back("CoarseGridPointsAsStationsBottom"); -// geometries.push_back("MiddleGridPointsAsStationsBottom"); -// geometries.push_back("FineGridPointsAsStationsBottom"); -// geometries.push_back("KetzinPolygonBottom"); -// -// gmsh_io.writeAllDataToGMSHInputFile(*_geoModels, -// geometries, param4); -// -// geometries.clear(); -// geometries.push_back("KetzinPolygonNorth"); -// gmsh_io.writeAllDataToGMSHInputFile(*_geoModels, -// geometries, param4); -// geometries.clear(); -// geometries.push_back("KetzinPolygonWest"); -// gmsh_io.writeAllDataToGMSHInputFile(*_geoModels, -// geometries, param4); -// geometries.clear(); -// geometries.push_back("KetzinPolygonSouth"); -// gmsh_io.writeAllDataToGMSHInputFile(*_geoModels, -// geometries, param4); -// geometries.clear(); -// geometries.push_back("KetzinPolygonEast"); -// gmsh_io.writeAllDataToGMSHInputFile(*_geoModels, -// geometries, param4); -// } -// // *** end creating closed surface mesh - -// // *** begin assign z values -// { -// // get the surface -// std::vector<std::string> geo_names; -// _geoModels->getGeometryNames (geo_names); -// std::vector<GEOLIB::Surface*> const* sfcs (_geoModels->getSurfaceVec(geo_names[0])); -// GEOLIB::Surface const* sfc ((*sfcs)[5]); -// const size_t n_triangles (sfc->getNTriangles()); -// size_t k; -// -// std::vector<GEOLIB::Point*> const* pnts (_geoModels->getPointVec(geo_names[1])); -// -// // write Points (inclusive z values) to file -// std::ofstream out ("RasterPointsBottom.stn"); -// if (out) { -// // data -// for (size_t n(0); n<pnts->size(); n++) { -// // search triangle the point is inside -// const double test_pnt[3] = { (*(*pnts)[n])[0], (*(*pnts)[n])[1], 0}; -// for (k=0; k<n_triangles; k++) { -// GEOLIB::Triangle const * const tri ((*sfc)[k]); -// if (tri->containsPoint2D(test_pnt)) { -// // compute coefficients c0, c1, c2 for the plane f(x,y) = c0 x + c1 y + c2 -// double c[3]; -// GEOLIB::getPlaneCoefficients(*tri, c); -// const double zval (c[0] * test_pnt[0] + c[1] * test_pnt[1] + c[2]); -// out << " <station x=\"" << test_pnt[0] << "\" y=\"" << test_pnt[1] << "\" z=\"" << zval << "\" id=\"" << n << "\">" << std::endl; -// out << " <name>" << n << "</name>" << std::endl; -// out << " </station>" << std::endl; -// break; -// } -// } -// if (k==n_triangles) { -// out << n << " " << test_pnt[0] << " " << test_pnt[1] << " -9999" << std::endl; -// } -// } -// out.close(); -// } -// } -// // *** end assign z values - -// // *** begin create raster test -// { -// // get the surface -// std::vector<std::string> geo_names; -// _geoModels->getGeometryNames (geo_names); -// std::vector<GEOLIB::Surface*> const* sfcs (_geoModels->getSurfaceVec(geo_names[0])); -// GEOLIB::Surface const* sfc ((*sfcs)[4]); -// -// double cell_size(50); -// double no_data_val(-9999); -// GEOLIB::Raster my_raster (cell_size, no_data_val); -// size_t n_rows(0), n_cols(0); -// double *raster (my_raster.getRasterFromSurface(*sfc, n_rows, n_cols)); -// // write raster to testfile -// std::ofstream out ("RasterTop-50m-New.asc"); -// if (out) { -// // write header -// out << "ncols\t" << n_cols << std::endl; -// out << "nrows\t" << n_rows << std::endl; -// out << "xllcorner\t" << (sfc->getAABB().getMinPoint())[0] - 0.5 * cell_size << std::endl; -// out << "yllcorner\t" << (sfc->getAABB().getMinPoint())[1] - 0.5 * cell_size << std::endl; -// out << "cellsize\t" << cell_size << std::endl; -// out << "NODATA_value\t" << no_data_val << std::endl; -// // data -// for (size_t r(0); r<n_rows; r++) { -// for (size_t c(0); c<n_cols-1; c++) { -// out << raster[r*n_cols+c] << " "; -// } -// out << raster[(r+1)*n_cols-1] << std::endl; -// } -// out.close(); -// } -// delete [] raster; -// } -// // *** end create raster test - -// // *** begin test CFEMesh::GetNODOnSFC () -// { -// // get the surface -// std::vector<std::string> geo_names; -// _geoModels->getGeometryNames (geo_names); -// std::vector<GEOLIB::Surface*> const* sfcs (_geoModels->getSurfaceVec(geo_names[0])); -// GEOLIB::Surface const* sfc ((*sfcs)[0]); -// -// std::string mesh_name ("/home/fischeth/Desktop/data/TestData/RectangleVictor/rectangle.msh"); -// MeshLib::CFEMesh const* mesh (_project.getMesh (mesh_name)); -// -// std::vector<size_t> mesh_node_ids; -// mesh->GetNODOnSFC(sfc, mesh_node_ids); -// std::cout << mesh_node_ids.size() << " mesh nodes found" << std::endl; -// for (size_t k(0); k<mesh_node_ids.size(); k++) { -// std::cout << mesh_node_ids[k] << "\t" << std::flush; -// } -// std::cout << std::endl; -// } -// // *** end test CFEMesh::GetNODOnSFC () - -// // *** begin test merge geometries -// std::vector<std::string> geo_names; -// _geoModels->getGeometryNames (geo_names); -// std::string merge_name("MergedGeometry"); -// _geoModels->mergeGeometries (geo_names, merge_name); -// // *** end test merge geometries - -// std::string fname_mesh ("SurfaceBC.msh"); -// FileIO::Gmsh2GeoIO::loadMeshAsGeometry(fname_mesh, _geoModels); - -// { -// std::ofstream os ("Points5000000.gli"); -// if (os) { -// os << "#POINTS" << std::endl; -// for (size_t k(0); k<5000000; k++) { -// os << k << " " << (rand()%1000)/1000.0 -// << " " << (rand()%1000)/1000.0 -// << " " << (rand()%1000)/1000.0 << std::endl; -// } -// os << "#STOP" << std::endl; -// } -// } - -// std::vector<std::string> station_names; -// _geoModels->getStationNames (station_names); -// if (!station_names.empty()) { -// size_t resolution(36); -// for (std::vector<std::string>::const_iterator it(station_names.begin()); it -// != station_names.end(); it++) { -// -// std::string project_name("Circle"); -// project_name += *it; -// -// std::vector<GEOLIB::Point*> *pnts(new std::vector<GEOLIB::Point*>); -// const std::vector<GEOLIB::Point*>* middle_pnts( -// _geoModels->getPointVec(*it)); -// std::vector<GEOLIB::Polyline*> *plys(new std::vector< -// GEOLIB::Polyline*>); -// std::map<std::string, size_t> * ply_names(new std::map<std::string,size_t>); -// -// for (size_t k(0); k < middle_pnts->size(); k++) { -// GEOLIB::Polygon *polygon(createPolygonFromCircle( -// *((*middle_pnts)[k]), 450.0, *pnts, resolution)); -// plys->push_back(polygon); -// std::string station_name("CircleAreaAroundStation"); -// if (dynamic_cast<GEOLIB::Station*> ((*middle_pnts)[k])) { -// station_name -// += (dynamic_cast<GEOLIB::Station*> ((*middle_pnts)[k])->getName()); -// } else { -// station_name += number2str(k); -// } -// ply_names->insert(std::pair<std::string, size_t>(station_name,k)); -// } -// -// _geoModels->addPointVec(pnts, project_name); -// _geoModels->addPolylineVec(plys, project_name, ply_names); -// } -// } - -// if (_geoModels) { -// std::vector<std::string> geo_names; -// _geoModels->getGeometryNames (geo_names); -// -// if (!geo_names.empty()) { -// std::vector<GEOLIB::Polyline*> const* plys (_geoModels->getPolylineVec (geo_names[0])); -// std::vector<GEOLIB::Polyline*>* polyline_vec (new std::vector<GEOLIB::Polyline*>); -// GEOLIB::Polygon* polygon (NULL); -// -// if (!_meshModels) { -// std::cout << "no mesh loaded" << std::endl; -// } else { -// std::string mesh_name ("model25"); -// MeshLib::CFEMesh const* mesh ((_meshModels->getMesh (mesh_name))->getCFEMesh()); -// -// MeshLib::ExtractMeshNodes extract_mesh_nodes (mesh); -//// std::vector<GEOLIB::Point*> * pnts_vec (const_cast<std::vector<GEOLIB::Point*>*>(_geoModels->getPointVec(geo_names[0]))); -// extract_mesh_nodes.getPolygonFromPolyline (*((*plys)[19]), _geoModels, geo_names[0], polygon); -// if (polygon) -// polyline_vec->push_back (polygon); -//// extract_mesh_nodes.getPolygonFromPolyline (*((*plys)[1]), *(pnts_vec), polygon); -//// if (polygon) -//// polyline_vec->push_back (polygon); -//// extract_mesh_nodes.getPolygonFromPolyline (*((*plys)[2]), *(pnts_vec), polygon); -//// if (polygon) -//// polyline_vec->push_back (polygon); -//// extract_mesh_nodes.getPolygonFromPolyline (*((*plys)[3]), *(pnts_vec), polygon); -//// if (polygon) -//// polyline_vec->push_back (polygon); -// } -// -// if (!polyline_vec->empty()) { -// if (_geoModels->appendPolylineVec (*polyline_vec, geo_names[0])) -// std::cout << "added " << polyline_vec->size() << " polygons" << std::endl; -// else -// std::cout << "failed to add " << polyline_vec->size() << " polygons" << std::endl; -// -// delete polyline_vec; -// } -// } -// } -//#ifndef NDEBUG -// std::cout << "FEM Test here ..." << std::endl; -// QSettings settings("UFZ", "OpenGeoSys-5"); -// -// QString fileName = QFileDialog::getOpenFileName(this, -// "Select matrix file in binary compressed row storage format", settings.value( -// "lastOpenedFileDirectory").toString(), -// "binary matrix file (*.bin);;"); -// -// std::string fname (fileName.toStdString()); -// // open input stream -// std::ifstream in (fname.c_str(), std::ios::binary); -// -// if (in) { -// long n(0), *iA(NULL), *jA(NULL); -// double *A(NULL), *rhs(NULL); -// -// std::cout << "reading matrix ... " << std::flush; -// // read matrix and right hand side (format provided by WW) -// FileIO::readCompressedStorageFmt (in, n, iA, jA, A, rhs); -// in.close (); -// std::cout << "done" << std::endl; -// -// unsigned n_unsigned (n); -// unsigned *iA_unsigned (new unsigned[n_unsigned+1]); -// for (unsigned k(0); k<n_unsigned+1; k++) -// iA_unsigned[k] = iA[k]; -// -// unsigned *jA_unsigned (new unsigned[iA_unsigned[n_unsigned]]); -// for (unsigned k(0); k<iA_unsigned[n_unsigned]; k++) -// jA_unsigned[k] = jA[k]; -// -// // some tests -// bool valid(true); -// for (unsigned i = 0; i < n_unsigned && valid; ++i) { -// const unsigned end (iA_unsigned[i+1]); -// for (unsigned k (iA_unsigned[i]); k < end; k++) -// if (jA_unsigned[k] >= n_unsigned) { -// std::cout << "row " << i << " has column entry "; -// std::cout << iA_unsigned[k] << " but matrix has dim "; -// std::cout << n_unsigned << " x " << n_unsigned << std::endl; -// valid = false; -// } -// } -// if (!valid) { -// std::cout << "matrix not in valid format" << std::endl; -// } else { -// unsigned min (iA_unsigned[1]-iA_unsigned[0]), max(iA_unsigned[1]-iA_unsigned[0]), max_idx(0), min_idx(0); -// for (unsigned k=0; k<n_unsigned; ++k) { -// unsigned deg = iA_unsigned[k+1]-iA_unsigned[k]; -// if (deg < min) {min = deg; min_idx = k;} -// if (deg > max) {max = deg; max_idx = k;} -// } -// std::cout << "\taverage deg: " << double (iA_unsigned[n_unsigned]) / n_unsigned << std::endl; -// std::cout << "\trow " << max_idx << " with max deg " << max << std::endl; -// std::cout << "\trow " << min_idx << " with min deg " << min << std::endl; -// -// // write matrix -// std::ofstream mat_out ("testmat.bin", std::ios::out|std::ios::binary); -// if (mat_out) { -// FileIO::writeCompressedStorageFmt (mat_out, n_unsigned, iA_unsigned, jA_unsigned, A); -// mat_out.close(); -// } -// // write right hand side -// std::ofstream rhs_out ("rhs.dat"); -// if (rhs_out) { -// for (unsigned k(0); k<n_unsigned; k++) { -// rhs_out << rhs[k] << std::endl; -// } -// rhs_out.close(); -// } -// } -// -// delete [] iA; -// delete [] jA; -// delete [] iA_unsigned; -// delete [] jA_unsigned; -// delete [] rhs; -// delete [] A; -// } -// -//#else - std::cout << "This is test functionality only..." << std::endl; -//#endif + OGSError::box("Failed to load TetGen mesh file."); std::cout << "This is test functionality only..." << std::endl; } void MainWindow::showTrackingSettingsDialog() @@ -1798,14 +1558,12 @@ void MainWindow::loadDIRECTSourceTerms(const std::vector<GEOLIB::Point*>* points this->_geoModels->addPointVec(new_points, geo_name, name_pnt_id_map); STRead((name.append(fi.baseName())).toStdString(), *_geoModels, geo_name); - std::vector<FEMCondition*> conditions = SourceTerm::createDirectSourceTerms( - st_vector, - geo_name); + std::vector<FEMCondition*> conditions = SourceTerm::createDirectSourceTerms(st_vector,geo_name); // add boundary conditions to model if (!conditions.empty()) { - this->_conditionModel->addConditions(conditions); + this->_processModel->addConditions(conditions); for (size_t i = 0; i < st_vector.size(); i++) delete st_vector[i]; st_vector.clear(); diff --git a/Gui/mainwindow.h b/Gui/mainwindow.h index 04cba75d6f0..59baa051383 100644 --- a/Gui/mainwindow.h +++ b/Gui/mainwindow.h @@ -15,7 +15,7 @@ class GEOModels; class MshModel; class ElementTreeModel; class StationTreeModel; -class ConditionModel; +class ProcessModel; class VtkVisPipeline; class DatabaseConnection; class VisPrefsDialog; @@ -74,11 +74,17 @@ protected slots: void importNetcdf(); //YW 07.2010 void importVtk(); void importFeflow(); - void loadFEMConditionsFromFile(std::string); + void importTetGen(); + void loadFEMConditions(std::string geoName); void openDatabase(); void openDatabaseConnection(); void openRecentFile(); void about(); + void showAddPipelineFilterItemDialog(QModelIndex parentIndex); + /// Call dialog for creating or modifying FEM conditions. + void showCondSetupDialog(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, size_t id); + /// Allows setting the name for a geometric object + void showGeoNameDialog(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, size_t id); /// Calls the diagram prefs dialog from the Tools menu. void showDiagramPrefsDialog(); /// Calls the diagram prefs dialog from the station list (i.e. for a specific station). @@ -86,13 +92,14 @@ protected slots: void showLineEditDialog(const std::string &geoName); void showGMSHPrefsDialog(); void showMshQualitySelectionDialog(VtkMeshSource* mshSource); + void showNewProcessDialog(); void showPropertiesDialog(std::string const& name); void showVisalizationPrefsDialog(); void showTrackingSettingsDialog(); void updateDataViews(); + void writeFEMConditionsToFile(QString geoName, QString fileName); void writeGeometryToFile(QString listName, QString fileName); void writeStationListToFile(QString listName, QString fileName); - void showAddPipelineFilterItemDialog(QModelIndex parentIndex); void on_actionExportVTK_triggered(bool checked = false); void on_actionExportVRML2_triggered(bool checked = false); @@ -108,6 +115,7 @@ protected slots: private: QMenu* createImportFilesMenu(); void loadFile(const QString &fileName); + void loadFEMConditionsFromFile(const QString &fileName, std::string geoName = ""); void loadPetrelFiles(const QStringList &sfc_file_names, const QStringList &well_path_file_names); @@ -122,7 +130,7 @@ private: GEOModels* _geoModels; MshModel* _meshModels; ElementTreeModel* _elementModel; - ConditionModel* _conditionModel; + ProcessModel* _processModel; ProjectData _project; VtkVisPipeline* _vtkVisPipeline; QList<QRect> _screenGeometries; diff --git a/Gui/mainwindow.ui b/Gui/mainwindow.ui index e777ae1abb8..aad1c105991 100644 --- a/Gui/mainwindow.ui +++ b/Gui/mainwindow.ui @@ -105,6 +105,8 @@ <addaction name="actionSave_As"/> <addaction name="separator"/> <addaction name="menuExport"/> + <addaction name="separator"/> + <addaction name="separator"/> <addaction name="action_Exit"/> </widget> <widget class="QMenu" name="menuWindows"> @@ -128,10 +130,17 @@ <addaction name="actionDiagram_Viewer"/> <addaction name="actionFEM_Test"/> </widget> + <widget class="QMenu" name="menuHelp"> + <property name="title"> + <string>Help</string> + </property> + <addaction name="actionAbout"/> + </widget> <addaction name="menu_File"/> <addaction name="menuTools"/> <addaction name="menuWindows"/> <addaction name="menuSettings"/> + <addaction name="menuHelp"/> </widget> <widget class="QToolBar" name="mainToolBar"> <attribute name="toolBarArea"> @@ -196,9 +205,9 @@ </layout> </widget> </widget> - <widget class="QDockWidget" name="conditionDock"> + <widget class="QDockWidget" name="modellingDock"> <property name="windowTitle"> - <string>FEM Conditions</string> + <string>Modelling</string> </property> <attribute name="dockWidgetArea"> <number>1</number> @@ -209,7 +218,7 @@ <number>1</number> </property> <item> - <widget class="ConditionTabWidget" name="conditionTabWidget" native="true"/> + <widget class="ModellingTabWidget" name="modellingTabWidget" native="true"/> </item> </layout> </widget> @@ -379,6 +388,11 @@ <string>Diagram Viewer...</string> </property> </action> + <action name="actionAbout"> + <property name="text"> + <string>About</string> + </property> + </action> </widget> <layoutdefault spacing="6" margin="11"/> <customwidgets> @@ -407,15 +421,15 @@ <container>1</container> </customwidget> <customwidget> - <class>ConditionTabWidget</class> + <class>GeoTabWidget</class> <extends>QWidget</extends> - <header>ConditionTabWidget.h</header> + <header>GeoTabWidget.h</header> <container>1</container> </customwidget> <customwidget> - <class>GeoTabWidget</class> + <class>ModellingTabWidget</class> <extends>QWidget</extends> - <header>GeoTabWidget.h</header> + <header location="global">ModellingTabWidget.h</header> <container>1</container> </customwidget> </customwidgets> @@ -581,6 +595,22 @@ </hint> </hints> </connection> + <connection> + <sender>actionAbout</sender> + <signal>triggered()</signal> + <receiver>MainWindowClass</receiver> + <slot>about()</slot> + <hints> + <hint type="sourcelabel"> + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel"> + <x>400</x> + <y>372</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>open()</slot> @@ -593,5 +623,6 @@ <slot>showGMSHPrefsDialog()</slot> <slot>FEMTestStart()</slot> <slot>showDiagramPrefsDialog()</slot> + <slot>about()</slot> </slots> </ui> diff --git a/VtkVis/CMakeLists.txt b/VtkVis/CMakeLists.txt index 31a585ba9cb..d98326dac0b 100644 --- a/VtkVis/CMakeLists.txt +++ b/VtkVis/CMakeLists.txt @@ -1,5 +1,6 @@ # Source files SET( SOURCES + MeshFromRasterDialog.cpp QVtkDataSetMapper.cpp VisPrefsDialog.cpp VisualizationWidget.cpp @@ -15,6 +16,7 @@ SET( SOURCES VtkCompositeColorByHeightFilter.cpp VtkCompositeColormapToImageFilter.cpp VtkCompositeContourFilter.cpp + VtkCompositeGeoObjectFilter.cpp VtkCompositeImageToCylindersFilter.cpp VtkCompositeLineToTubeFilter.cpp VtkCompositePointToGlyphFilter.cpp @@ -45,6 +47,7 @@ SET( SOURCES # Moc headers SET( MOC_HEADERS + MeshFromRasterDialog.h QVtkDataSetMapper.h VisPrefsDialog.h VisualizationWidget.h @@ -69,6 +72,7 @@ SET( HEADERS VtkCompositeColorByHeightFilter.h VtkCompositeColormapToImageFilter.h VtkCompositeContourFilter.h + VtkCompositeGeoObjectFilter.h VtkCompositeImageToCylindersFilter.h VtkCompositeLineToTubeFilter.h VtkCompositePointToGlyphFilter.h @@ -95,6 +99,7 @@ SET( HEADERS # UI files SET ( UIS + MeshFromRaster.ui VtkAddFilterDialogBase.ui VtkVisTabWidgetBase.ui VisualizationWidgetBase.ui diff --git a/VtkVis/MeshFromRaster.ui b/VtkVis/MeshFromRaster.ui new file mode 100644 index 00000000000..32c88e9b8e6 --- /dev/null +++ b/VtkVis/MeshFromRaster.ui @@ -0,0 +1,156 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MeshFromRaster</class> + <widget class="QDialog" name="MeshFromRaster"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>350</width> + <height>220</height> + </rect> + </property> + <property name="windowTitle"> + <string>Create mesh from raster...</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="1"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QGroupBox" name="interpretationGroupBox"> + <property name="title"> + <string>Interpret intensities as</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QRadioButton" name="elevationButton"> + <property name="text"> + <string>Elevation</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="materialButton"> + <property name="text"> + <string>Materials</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="ignoreButton"> + <property name="text"> + <string>Ignore</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="1"> + <widget class="QGroupBox" name="elementTypeGroupBox"> + <property name="title"> + <string>Represent pixels as</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QRadioButton" name="triButton"> + <property name="text"> + <string>sets of two triangles</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="quadButton"> + <property name="text"> + <string>rectangles</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="hexButton"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>hexahedra</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="0"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="mshNameLabel"> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string> Name of mesh:</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="mshNameEdit"/> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>MeshFromRaster</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>MeshFromRaster</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/VtkVis/MeshFromRasterDialog.cpp b/VtkVis/MeshFromRasterDialog.cpp new file mode 100644 index 00000000000..597a83ca1fb --- /dev/null +++ b/VtkVis/MeshFromRasterDialog.cpp @@ -0,0 +1,43 @@ +/** + * \file MeshFromRasterDialog.cpp + * 2011/11/17 KR Initial implementation + */ + +#include "MeshFromRasterDialog.h" +#include "OGSError.h" + +MeshFromRasterDialog::MeshFromRasterDialog(QDialog* parent) +: QDialog(parent) +{ + setupUi(this); + + this->elevationButton->setChecked(true); + this->triButton->setChecked(true); + this->mshNameEdit->setText("NewMesh"); +} + + +MeshFromRasterDialog::~MeshFromRasterDialog() +{ +} + + +void MeshFromRasterDialog::accept() +{ + UseIntensityAs::type i_type(UseIntensityAs::ELEVATION); + if (this->materialButton->isChecked()) i_type = UseIntensityAs::MATERIAL; + else if (this->ignoreButton->isChecked()) i_type = UseIntensityAs::NONE; + + MshElemType::type e_type(MshElemType::TRIANGLE); + if (this->quadButton->isChecked()) e_type = MshElemType::QUAD; + else if (this->hexButton->isChecked()) e_type = MshElemType::HEXAHEDRON; + + emit setMeshParameters(this->mshNameEdit->text(), e_type, i_type); + this->done(QDialog::Accepted); +} + +void MeshFromRasterDialog::reject() +{ + this->done(QDialog::Rejected); +} + diff --git a/VtkVis/MeshFromRasterDialog.h b/VtkVis/MeshFromRasterDialog.h new file mode 100644 index 00000000000..944c4cd2dc4 --- /dev/null +++ b/VtkVis/MeshFromRasterDialog.h @@ -0,0 +1,40 @@ +/** + * \file MeshFromRasterDialog.h + * 2011/11/17 KR Initial implementation + */ + +#ifndef MSHFROMRASTERDIALOG_H +#define MSHFROMRASTERDIALOG_H + +#include "ui_MeshFromRaster.h" +#include "VtkMeshConverter.h" + +#include <QtGui/QDialog> + + +/** + * \brief A dialog for specifying the parameters to construct a mesh based on a raster + */ +class MeshFromRasterDialog : public QDialog, private Ui_MeshFromRaster +{ + Q_OBJECT + +public: + /// Constructor + MeshFromRasterDialog(QDialog* parent = 0); + + ~MeshFromRasterDialog(void); + +private slots: + /// Instructions if the OK-Button has been pressed. + void accept(); + + /// Instructions if the Cancel-Button has been pressed. + void reject(); + +signals: + void setMeshParameters(QString, MshElemType::type, UseIntensityAs::type); + +}; + +#endif //MSHFROMRASTERDIALOG_H diff --git a/VtkVis/VtkCompositeContourFilter.cpp b/VtkVis/VtkCompositeContourFilter.cpp index 0e7ef3bcebb..2aeba6dbc7b 100644 --- a/VtkVis/VtkCompositeContourFilter.cpp +++ b/VtkVis/VtkCompositeContourFilter.cpp @@ -42,7 +42,7 @@ void VtkCompositeContourFilter::init() // Put that list in the property map (*_algorithmUserVectorProperties)["Range"] = contourRangeList; - // Make a new entry in the property map for the SelectedComponent property + // Make a new entry in the property map for the "Number of Values" property (*_algorithmUserProperties)["Number of Contours"] = 10; // The threshold filter is last one and so it is also the _outputAlgorithm diff --git a/VtkVis/VtkCompositeGeoObjectFilter.cpp b/VtkVis/VtkCompositeGeoObjectFilter.cpp new file mode 100644 index 00000000000..ea99f754fe8 --- /dev/null +++ b/VtkVis/VtkCompositeGeoObjectFilter.cpp @@ -0,0 +1,97 @@ +/** + * \file VtkCompositeGeoObjectFilter.cpp + * 2011/12/02 KR Initial implementation + * + * Implementation of VtkCompositeGeoObjectFilter class + */ + +// ** INCLUDES ** +#include "VtkCompositeGeoObjectFilter.h" + +#include <vtkDataSetSurfaceFilter.h> +#include <vtkSmartPointer.h> +#include <vtkThreshold.h> +#include <vtkAlgorithmOutput.h> + +#include "VtkPolylinesSource.h" +#include "VtkSurfacesSource.h" +#include "VtkCompositePointToGlyphFilter.h" +#include "VtkCompositeLineToTubeFilter.h" + +#include <vtkPointData.h> + +VtkCompositeGeoObjectFilter::VtkCompositeGeoObjectFilter( vtkAlgorithm* inputAlgorithm ) + : VtkCompositeFilter(inputAlgorithm), _type(GEOLIB::POINT), _threshold(vtkThreshold::New()) +{ + if (inputAlgorithm->GetNumberOfInputPorts() && inputAlgorithm->GetNumberOfInputConnections(0)) + { + vtkAlgorithmOutput* ao = inputAlgorithm->GetInputConnection(0,0); + + if (ao) + { + vtkAlgorithm* parentAlg = ao->GetProducer(); + + if (dynamic_cast<VtkPolylinesSource*>(parentAlg) != NULL) + _type = GEOLIB::POLYLINE; + else if (dynamic_cast<VtkSurfacesSource*>(parentAlg) != NULL) + _type = GEOLIB::SURFACE; + } + + } + + this->init(); +} + +VtkCompositeGeoObjectFilter::~VtkCompositeGeoObjectFilter() +{ +} + +void VtkCompositeGeoObjectFilter::init() +{ + this->_inputDataObjectType = VTK_POLY_DATA; + this->_outputDataObjectType = VTK_POLY_DATA; + + _threshold->SetInputConnection(_inputAlgorithm->GetOutputPort()); + _threshold->SetSelectedComponent(0); + _threshold->ThresholdBetween(0,0); + + vtkDataSetSurfaceFilter* surface = vtkDataSetSurfaceFilter::New(); + surface->SetInputConnection(_threshold->GetOutputPort()); + + VtkCompositeFilter* composite; + if (_type == GEOLIB::POINT) + { + composite = new VtkCompositePointToGlyphFilter(surface); + composite->SetUserProperty("Radius", this->GetInitialRadius()); + _outputAlgorithm = composite->GetOutputAlgorithm(); + } + 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) +{ + _threshold->ThresholdBetween(idx, idx); +} + +float VtkCompositeGeoObjectFilter::GetInitialRadius() const +{ + double bounding_box[6]; + static_cast<vtkPolyData*>(this->_inputAlgorithm->GetOutputDataObject(0))->GetBounds(bounding_box); + double x_diff = abs(bounding_box[0]-bounding_box[1]); + double y_diff = abs(bounding_box[2]-bounding_box[3]); + double z_diff = abs(bounding_box[5]-bounding_box[5]); + + double max = (x_diff > y_diff) ? x_diff : y_diff; + max = (max > z_diff) ? max : z_diff; + + return max/200.0; +} diff --git a/VtkVis/VtkCompositeGeoObjectFilter.h b/VtkVis/VtkCompositeGeoObjectFilter.h new file mode 100644 index 00000000000..0ab513e3f04 --- /dev/null +++ b/VtkVis/VtkCompositeGeoObjectFilter.h @@ -0,0 +1,39 @@ +/** + * \file VtkCompositeGeoObjectFilter.h + * 2011/12/02 KR Initial implementation + */ + +#ifndef VTKCOMPOSITEGEOOBJECTFILTER_H +#define VTKCOMPOSITEGEOOBJECTFILTER_H + +#include "VtkCompositeFilter.h" +#include "GeoType.h" + +class vtkThreshold; + +/// @brief Hightlights a single GeoObject +class VtkCompositeGeoObjectFilter : public VtkCompositeFilter +{ +public: + VtkCompositeGeoObjectFilter(vtkAlgorithm* inputAlgorithm); + virtual ~VtkCompositeGeoObjectFilter(); + + virtual void init(); + + /// @brief Sets user properties. + void SetUserProperty(QString name, QVariant value) + { + Q_UNUSED(name); + Q_UNUSED(value); + } + + void SetIndex(size_t idx); + +private: + float GetInitialRadius() const; + + GEOLIB::GEOTYPE _type; + vtkThreshold* _threshold; +}; + +#endif // VTKCOMPOSITEGEOOBJECTFILTER_H diff --git a/VtkVis/VtkCompositeLineToTubeFilter.cpp b/VtkVis/VtkCompositeLineToTubeFilter.cpp index 23f1cc51a9c..e61192f4947 100644 --- a/VtkVis/VtkCompositeLineToTubeFilter.cpp +++ b/VtkVis/VtkCompositeLineToTubeFilter.cpp @@ -33,16 +33,18 @@ void VtkCompositeLineToTubeFilter::init() mergePoints->SetTolerance(0.0); mergePoints->ConvertLinesToPointsOn(); + double default_radius(GetInitialRadius()); + int default_number_of_sides(8); vtkTubeFilter* tubes = vtkTubeFilter::New(); tubes->SetInputConnection(0, mergePoints->GetOutputPort(0)); tubes->SetInputArrayToProcess(1,0,0,vtkDataObject::FIELD_ASSOCIATION_CELLS,"Stratigraphies"); - tubes->SetRadius(150); - tubes->SetNumberOfSides(10); + tubes->SetRadius(default_radius); + tubes->SetNumberOfSides(default_number_of_sides); tubes->SetCapping(1); //tubes->SetVaryRadiusToVaryRadiusByScalar(); // KR radius changes with scalar - (*_algorithmUserProperties)["Radius"] = 150.0; - (*_algorithmUserProperties)["NumberOfSides"] = 6; + (*_algorithmUserProperties)["Radius"] = default_radius; + (*_algorithmUserProperties)["NumberOfSides"] = default_number_of_sides; (*_algorithmUserProperties)["Capping"] = true; _outputAlgorithm = tubes; @@ -59,3 +61,17 @@ void VtkCompositeLineToTubeFilter::SetUserProperty( QString name, QVariant value else if (name.compare("Capping") == 0) static_cast<vtkTubeFilter*>(_outputAlgorithm)->SetCapping(value.toBool()); } + +float VtkCompositeLineToTubeFilter::GetInitialRadius() const +{ + double bounding_box[6]; + static_cast<vtkPolyData*>(this->_inputAlgorithm->GetOutputDataObject(0))->GetBounds(bounding_box); + double x_diff = abs(bounding_box[0]-bounding_box[1]); + double y_diff = abs(bounding_box[2]-bounding_box[3]); + double z_diff = abs(bounding_box[5]-bounding_box[5]); + + double max = (x_diff > y_diff) ? x_diff : y_diff; + max = (max > z_diff) ? max : z_diff; + + return max/200.0; +} diff --git a/VtkVis/VtkCompositeLineToTubeFilter.h b/VtkVis/VtkCompositeLineToTubeFilter.h index b91ec023216..10b6b6603e3 100644 --- a/VtkVis/VtkCompositeLineToTubeFilter.h +++ b/VtkVis/VtkCompositeLineToTubeFilter.h @@ -20,6 +20,7 @@ public: virtual void SetUserProperty(QString name, QVariant value); private: + float GetInitialRadius() const; }; #endif // VTKCOMPOSITELINETOTUBEFILTER_H diff --git a/VtkVis/VtkCompositePointToGlyphFilter.cpp b/VtkVis/VtkCompositePointToGlyphFilter.cpp index eccd50978c0..1ecabcc33a7 100644 --- a/VtkVis/VtkCompositePointToGlyphFilter.cpp +++ b/VtkVis/VtkCompositePointToGlyphFilter.cpp @@ -29,7 +29,7 @@ void VtkCompositePointToGlyphFilter::init() this->_inputDataObjectType = VTK_DATA_SET; this->_outputDataObjectType = VTK_POLY_DATA; - int default_radius(150); + double default_radius(GetInitialRadius()); _glyphSource = vtkSphereSource::New(); _glyphSource->SetRadius(default_radius); _glyphSource->SetPhiResolution(10); @@ -86,3 +86,17 @@ void VtkCompositePointToGlyphFilter::SetUserProperty( QString name, QVariant val else if (name.compare("Orient") == 0) static_cast<vtkGlyph3D*>(_outputAlgorithm)->SetOrient(value.toBool()); } + +float VtkCompositePointToGlyphFilter::GetInitialRadius() const +{ + double bounding_box[6]; + static_cast<vtkPolyData*>(this->_inputAlgorithm->GetOutputDataObject(0))->GetBounds(bounding_box); + double x_diff = abs(bounding_box[0]-bounding_box[1]); + double y_diff = abs(bounding_box[2]-bounding_box[3]); + double z_diff = abs(bounding_box[5]-bounding_box[5]); + + double max = (x_diff > y_diff) ? x_diff : y_diff; + max = (max > z_diff) ? max : z_diff; + + return max/100.0; +} diff --git a/VtkVis/VtkCompositePointToGlyphFilter.h b/VtkVis/VtkCompositePointToGlyphFilter.h index 5d6956defe9..dedd0a43855 100644 --- a/VtkVis/VtkCompositePointToGlyphFilter.h +++ b/VtkVis/VtkCompositePointToGlyphFilter.h @@ -22,6 +22,8 @@ public: virtual void SetUserProperty(QString name, QVariant value); private: + float GetInitialRadius() const; + vtkSphereSource* _glyphSource; }; diff --git a/VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp b/VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp index e2647f58855..44d27b7537d 100644 --- a/VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp +++ b/VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp @@ -50,8 +50,7 @@ void VtkCompositeTextureOnSurfaceFilter::init() QSettings settings("UFZ", "OpenGeoSys-5"); QString fileName = QFileDialog::getOpenFileName(parent, "Select raster file to apply as texture", - settings.value( - "lastOpenedTextureFileDirectory"). + settings.value("lastOpenedTextureFileDirectory"). toString(), "Raster files (*.asc *.bmp *.jpg *.png *.tif);;"); QFileInfo fi(fileName); diff --git a/VtkVis/VtkConditionSource.cpp b/VtkVis/VtkConditionSource.cpp index 806cf644a29..78f149a591f 100644 --- a/VtkVis/VtkConditionSource.cpp +++ b/VtkVis/VtkConditionSource.cpp @@ -80,6 +80,10 @@ int VtkConditionSource::RequestData( vtkInformation* request, vtkSmartPointer<vtkPolyData> output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); + vtkSmartPointer<vtkIdTypeArray> distypes = vtkSmartPointer<vtkIdTypeArray>::New(); + distypes->SetNumberOfComponents(1); + distypes->SetName("DisTypes"); + vtkSmartPointer<vtkDoubleArray> scalars = vtkSmartPointer<vtkDoubleArray>::New(); scalars->SetNumberOfComponents(1); scalars->SetName("Scalars"); @@ -94,18 +98,17 @@ int VtkConditionSource::RequestData( vtkInformation* request, size_t n_pnts = _points->size(); double value(-9999); - /* - if (!_cond_vec->empty()) - { - const std::vector<double> dv = (*_cond_vec)[0]->getDisValue(); - value = dv[dv.size()-1]; // get an existing value for the distribution so scaling on point data will be correct during rendering process! - } - */ + if (!_cond_vec->empty()) + { + const std::vector<double> dv = (*_cond_vec)[0]->getDisValue(); + value = dv[dv.size()-1]; // get an existing value for the distribution so scaling on point data will be correct during rendering process! + } for (size_t i = 0; i < n_pnts; i++) { double coords[3] = {(*(*_points)[i])[0], (*(*_points)[i])[1], (*(*_points)[i])[2]}; newPoints->InsertNextPoint(coords); + distypes->InsertNextValue(0); scalars->InsertNextValue(value); } @@ -115,6 +118,15 @@ int VtkConditionSource::RequestData( vtkInformation* request, FiniteElement::DistributionType type = (*_cond_vec)[n]->getProcessDistributionType(); const std::vector<double> dis_values = (*_cond_vec)[n]->getDisValue(); + vtkIdType dis_type_value(0); + std::map<FiniteElement::DistributionType, vtkIdType>::const_iterator it(_dis_type_map.find(type)); + if (it == _dis_type_map.end()) + { + dis_type_value = static_cast<vtkIdType>(_dis_type_map.size()); + _dis_type_map.insert(std::pair<FiniteElement::DistributionType, size_t>(type, dis_type_value)); + } + else dis_type_value = it->second; + if ((*_cond_vec)[n]->getGeoType() == GEOLIB::POINT) { size_t nPoints = _points->size(); @@ -129,6 +141,7 @@ int VtkConditionSource::RequestData( vtkInformation* request, newVerts->InsertNextCell(1, &vtk_id); if (type == FiniteElement::CONSTANT) scalars->SetValue(id, dis_values[0]); + distypes->SetValue(id, dis_type_value); break; } if (id == -1) @@ -146,6 +159,7 @@ int VtkConditionSource::RequestData( vtkInformation* request, { size_t pnt_id = ply->getPointID(i); //this->getIndex(ply->getPointID(i), newPoints, scalars, idx_map); newLines->InsertCellPoint(pnt_id); + distypes->SetValue(pnt_id, dis_type_value); if (type == FiniteElement::CONSTANT) scalars->SetValue(pnt_id, dis_values[0]); @@ -178,6 +192,7 @@ int VtkConditionSource::RequestData( vtkInformation* request, { size_t pnt_id = (*triangle)[j]; //this->getIndex((*triangle)[j], newPoints, scalars, idx_map); aPolygon->GetPointIds()->SetId(j, pnt_id); + distypes->SetValue(pnt_id, dis_type_value); if (type == FiniteElement::CONSTANT) scalars->SetValue(pnt_id, dis_values[0]); @@ -188,8 +203,7 @@ int VtkConditionSource::RequestData( vtkInformation* request, pnt_id) //if (this->getIndex(static_cast<size_t>(dis_values[j]), newPoints, scalars, idx_map) == pnt_id) { - scalars->SetValue(pnt_id, - dis_values[j + 1]); + scalars->SetValue(pnt_id,dis_values[j + 1]); break; } } @@ -215,6 +229,7 @@ int VtkConditionSource::RequestData( vtkInformation* request, double coords[3] = {box[i % 2][0], box[(i >> 1) % 2][1], box[i >> 2][2]}; newPoints->InsertNextPoint(coords); + distypes->InsertNextValue(dis_type_value); scalars->InsertNextValue(0.0); //idx_map.insert( std::pair<size_t,size_t>(pnt_idx+i, nPoints+i)); } @@ -223,12 +238,7 @@ int VtkConditionSource::RequestData( vtkInformation* request, { vtkIdType a[2] = {nPoints + i, nPoints + i + 4}; vtkIdType b[2] = {nPoints + (i * 2), nPoints + (i * 2 + 1)}; - vtkIdType c[2] = - {nPoints + - (static_cast<int>(i / - 2) * 4 + - (i % - 2)), nPoints + (static_cast<int>(i / 2) * 4 + (i % 2) + 2)}; + vtkIdType c[2] = {nPoints + (static_cast<int>(i / 2) * 4 + (i % 2)), nPoints + (static_cast<int>(i / 2) * 4 + (i % 2) + 2)}; newLines->InsertNextCell(2, &a[0]); newLines->InsertNextCell(2, &b[0]); newLines->InsertNextCell(2, &c[0]); @@ -237,6 +247,7 @@ int VtkConditionSource::RequestData( vtkInformation* request, } output->SetPoints(newPoints); + output->GetPointData()->AddArray(distypes); output->GetPointData()->AddArray(scalars); output->GetPointData()->SetActiveScalars("Scalars"); output->SetVerts(newVerts); diff --git a/VtkVis/VtkConditionSource.h b/VtkVis/VtkConditionSource.h index 75cdd5065eb..04c15eba7bd 100644 --- a/VtkVis/VtkConditionSource.h +++ b/VtkVis/VtkConditionSource.h @@ -57,6 +57,7 @@ private: const std::vector<GEOLIB::Point*>* _points; const std::vector<FEMCondition*>* _cond_vec; + std::map<FiniteElement::DistributionType, vtkIdType> _dis_type_map; }; #endif // VTKCONDITIONSOURCE_H diff --git a/VtkVis/VtkFilterFactory.cpp b/VtkVis/VtkFilterFactory.cpp index bcd9c656da1..e3d22317ad6 100644 --- a/VtkVis/VtkFilterFactory.cpp +++ b/VtkVis/VtkFilterFactory.cpp @@ -11,6 +11,7 @@ #include "VtkCompositeColorByHeightFilter.h" #include "VtkCompositeColormapToImageFilter.h" #include "VtkCompositeContourFilter.h" +#include "VtkCompositeGeoObjectFilter.h" #include "VtkCompositeImageToCylindersFilter.h" #include "VtkCompositeLineToTubeFilter.h" #include "VtkCompositePointToGlyphFilter.h" @@ -118,6 +119,8 @@ VtkCompositeFilter* VtkFilterFactory::CreateCompositeFilter( QString type, return new VtkCompositeSelectionFilter(inputAlgorithm); else if (type.compare(QString("VtkCompositeContourFilter")) == 0) return new VtkCompositeContourFilter(inputAlgorithm); + else if (type.compare(QString("VtkCompositeGeoObjectFilter")) == 0) + return new VtkCompositeGeoObjectFilter(inputAlgorithm); else return NULL; diff --git a/VtkVis/VtkGeoImageSource.cpp b/VtkVis/VtkGeoImageSource.cpp index 22fa8a20461..a2481baecab 100644 --- a/VtkVis/VtkGeoImageSource.cpp +++ b/VtkVis/VtkGeoImageSource.cpp @@ -80,11 +80,10 @@ void VtkGeoImageSource::setImageFilename(QString filename) QPointF origin; double spacing; OGSRaster::loadImage(filename, *raster, origin, spacing); - //int imgwidth = raster->width(); - //int imgheight = raster->height(); this->setImage(*raster); delete raster; - this->setOrigin(origin); + // correct raster position by half a pixel for correct visualisation + this->setOrigin(origin.x()+(spacing/2.0), origin.y()+(spacing/2.0), -10.0); this->setSpacing(spacing); this->SetName(filename); } @@ -113,9 +112,9 @@ void VtkGeoImageSource::setImage(QImage& image) _imageSource->Update(); // crashes otherwise } -void VtkGeoImageSource::setOrigin(QPointF origin) +void VtkGeoImageSource::setOrigin(double x, double y, double z) { - _imageInfo->SetOutputOrigin(origin.x(), origin.y(), -10.0); + _imageInfo->SetOutputOrigin(x, y, z); } void VtkGeoImageSource::setSpacing(double spacing) diff --git a/VtkVis/VtkGeoImageSource.h b/VtkVis/VtkGeoImageSource.h index 1338488a92f..c21e175c6c7 100644 --- a/VtkVis/VtkGeoImageSource.h +++ b/VtkVis/VtkGeoImageSource.h @@ -38,7 +38,7 @@ public: void setImage(QImage& image); - void setOrigin(QPointF origin); + void setOrigin(double x, double y, double z); void setSpacing(double spacing); diff --git a/VtkVis/VtkMeshConverter.cpp b/VtkVis/VtkMeshConverter.cpp index 70e2efe9ce9..5c837312146 100644 --- a/VtkVis/VtkMeshConverter.cpp +++ b/VtkVis/VtkMeshConverter.cpp @@ -19,66 +19,139 @@ #include <vtkCellData.h> #include <vtkUnstructuredGrid.h> +#include <QTime> + MeshLib::CFEMesh* VtkMeshConverter::convertImgToMesh(vtkImageData* img, const std::pair<double,double> &origin, - const double &scalingFactor) + const double &scalingFactor, + MshElemType::type elem_type, + UseIntensityAs::type intensity_type) { + if ((elem_type != MshElemType::TRIANGLE) && (elem_type != MshElemType::QUAD)) + { + std::cout << "Error in VtkMeshConverter::convertImgToMesh() - Invalid Mesh Element Type..." << std::endl; + return NULL; + } + vtkSmartPointer<vtkUnsignedCharArray> pixelData = vtkSmartPointer<vtkUnsignedCharArray>( vtkUnsignedCharArray::SafeDownCast(img->GetPointData()->GetScalars())); int* dims = img->GetDimensions(); - MeshLib::CFEMesh* mesh(new MeshLib::CFEMesh()); - size_t imgHeight = dims[0]; - size_t imgWidth = dims[1]; - std::vector<size_t> visNodes(imgWidth * imgHeight); + const size_t imgHeight = dims[0]; + const size_t imgWidth = dims[1]; + const size_t incHeight = imgHeight+1; + const size_t incWidth = imgWidth+1; + double* pixVal (new double[incHeight * incWidth]); + bool* visNodes(new bool[incWidth * incHeight]); + int* node_idx_map(new int[incWidth * incHeight]); + for (size_t j = 0; j < incWidth; j++) + { + pixVal[j]=0; + visNodes[j]=false; + node_idx_map[j]=-1; + } for (size_t i = 0; i < imgWidth; i++) + { for (size_t j = 0; j < imgHeight; j++) { - size_t index = i * imgHeight + j; - const double* colour = pixelData->GetTuple4(index); - double pixcol = 0.3 * colour[0] + 0.6 * colour[1] + 0.1 * colour[2]; - double coords[3] = - { origin.first + (scalingFactor * j), origin.second + (scalingFactor * i), - pixcol }; + const size_t img_idx = i * imgHeight + j; + const size_t index = (i+1) * incHeight + j; + const double* colour = pixelData->GetTuple4(img_idx); + pixVal[index] = 0.3 * colour[0] + 0.6 * colour[1] + 0.1 * colour[2]; visNodes[index] = (colour[3] > 0); + node_idx_map[index]=-1; + } + pixVal[(i+2)*incHeight-1]=0; + visNodes[(i+2)*incHeight-1]=false; + node_idx_map[(i+2)*incHeight-1]=-1; + } - MeshLib::CNode* node(new MeshLib::CNode(index)); - node->SetCoordinates(coords); - mesh->nod_vector.push_back(node); + MeshLib::CFEMesh* mesh(new MeshLib::CFEMesh()); + size_t node_idx_count(0); + const double x_offset(origin.first - scalingFactor/2.0); + const double y_offset(origin.second - scalingFactor/2.0); + + for (size_t i = 0; i < incWidth; i++) + for (size_t j = 0; j < incHeight; j++) + { + const size_t index = i * incHeight + j; + + bool set_node (false); + if (j==0 && i==imgWidth) set_node = visNodes[index]; + else if (j==0) set_node = (visNodes[index] || visNodes[index+incHeight]); + else if (i==imgWidth) set_node = (visNodes[index] || visNodes[index-1]); + else set_node = (visNodes[index] || visNodes[index-1] || visNodes[index+incHeight] || visNodes[index+incHeight-1]); + + if (set_node) + { + double zValue = (intensity_type == UseIntensityAs::ELEVATION) ? pixVal[index] : 0.0; + const double coords[3] = { x_offset + (scalingFactor * j), + y_offset + (scalingFactor * i), + zValue }; + + MeshLib::CNode* node(new MeshLib::CNode(node_idx_count)); + node->SetCoordinates(coords); + mesh->nod_vector.push_back(node); + node_idx_map[index] = node_idx_count; + node_idx_count++; + } } + QTime myTimer0; + myTimer0.start(); // set mesh elements - for (size_t i = 0; i < imgWidth - 1; i++) - for (size_t j = 0; j < imgHeight - 1; j++) + for (size_t i = 0; i < imgWidth; i++) + for (size_t j = 0; j < imgHeight; j++) { - int index = i * imgHeight + j; - - // if node is visible - if (visNodes[index]) + const int index = i * incHeight + j; + if ((node_idx_map[index]!=-1) && (node_idx_map[index+1]!=-1) && (node_idx_map[index+incHeight]!=-1) && (node_idx_map[index+incHeight+1]!=-1) && (visNodes[index+incHeight])) { - mesh->ele_vector.push_back(createElement(index, index + 1, index + - imgHeight)); // upper left triangle - mesh->ele_vector.push_back(createElement(index + 1, index + - imgHeight + 1, index + - imgHeight)); // lower right triangle + const int mat = (intensity_type != UseIntensityAs::MATERIAL) ? 0 : static_cast<int>(pixVal[index+incHeight]); + if (elem_type == MshElemType::TRIANGLE) + { + mesh->ele_vector.push_back(createElement(elem_type, mat, node_idx_map[index], node_idx_map[index + 1], + node_idx_map[index + incHeight])); // upper left triangle + mesh->ele_vector.push_back(createElement(elem_type, mat, node_idx_map[index + 1], + node_idx_map[index + incHeight + 1], + node_idx_map[index + incHeight])); // lower right triangle + } + if (elem_type == MshElemType::QUAD) + { + mesh->ele_vector.push_back(createElement(elem_type, mat, node_idx_map[index], node_idx_map[index + 1], + node_idx_map[index + incHeight + 1], + node_idx_map[index + incHeight])); + } } } + + std::cout << myTimer0.elapsed() << " ms" << std::endl; mesh->ConstructGrid(); + delete [] pixVal; + delete [] visNodes; + delete [] node_idx_map; return mesh; } -MeshLib::CElem* VtkMeshConverter::createElement(size_t node1, size_t node2, size_t node3) +MeshLib::CElem* VtkMeshConverter::createElement(MshElemType::type t, int mat, size_t node1, size_t node2, size_t node3, size_t node4) { - MeshLib::CElem* elem(new MeshLib::CElem()); - elem->setElementProperties(MshElemType::TRIANGLE); - elem->SetPatchIndex(1); - elem->SetNodesNumber(3); + MeshLib::CElem* elem(new MeshLib::CElem); + elem->setElementProperties(t); elem->SetNodeIndex(0, node1); elem->SetNodeIndex(1, node2); elem->SetNodeIndex(2, node3); + if (t == MshElemType::QUAD) + elem->SetNodeIndex(3, node4); + elem->SetPatchIndex(mat); elem->InitializeMembers(); return elem; +/* + if (t == MshElemType::QUAD) { + return new MeshLib::CElem (t, node1, node2, node3, node4, mat); + } else { + return new MeshLib::CElem (t, node1, node2, node3, mat); + } +*/ } MeshLib::CFEMesh* VtkMeshConverter::convertUnstructuredGrid(vtkUnstructuredGrid* grid) @@ -88,8 +161,8 @@ MeshLib::CFEMesh* VtkMeshConverter::convertUnstructuredGrid(vtkUnstructuredGrid* MeshLib::CFEMesh* mesh(new MeshLib::CFEMesh()); - size_t nNodes = grid->GetPoints()->GetNumberOfPoints(); - size_t nElems = grid->GetNumberOfCells(); + const size_t nNodes = grid->GetPoints()->GetNumberOfPoints(); + const size_t nElems = grid->GetNumberOfCells(); // set mesh nodes double* coords = NULL; @@ -142,7 +215,7 @@ MeshLib::CFEMesh* VtkMeshConverter::convertUnstructuredGrid(vtkUnstructuredGrid* cell = grid->GetCell(i); size_t nElemNodes = cell->GetNumberOfPoints(); elem->SetNodesNumber(nElemNodes); - elem->nodes_index.resize(nElemNodes); + elem->getNodeIndices().resize(nElemNodes); for (size_t j = 0; j < nElemNodes; j++) elem->SetNodeIndex(j, cell->GetPointId(j)); diff --git a/VtkVis/VtkMeshConverter.h b/VtkVis/VtkMeshConverter.h index f76ac4f5e43..af780637a3e 100644 --- a/VtkVis/VtkMeshConverter.h +++ b/VtkVis/VtkMeshConverter.h @@ -19,22 +19,40 @@ class CFEMesh; class CNode; } +/// Selection of possible interpretations for intensities +struct UseIntensityAs +{ + enum type { + ELEVATION, + MATERIAL, + NONE + }; +}; + /** * \brief Adapter class to convert FEM Mesh to a representation more suited for visualisation purposes */ class VtkMeshConverter { public: - /// Converts greyscale image to quad mesh + /** + * Converts greyscale image to a mesh + * \parelem_type defines if elements of the new mesh should be triangles or quads (or hexes for 3D) + * \param intensity_type defines how image intensities are interpreted + */ static MeshLib::CFEMesh* convertImgToMesh(vtkImageData* img, const std::pair<double,double> &origin, - const double &scalingFactor); + const double &scalingFactor, + MshElemType::type elem_type, + UseIntensityAs::type intensity_type); /// Converts a vtkUnstructuredGrid object to a CFEMesh static MeshLib::CFEMesh* convertUnstructuredGrid(vtkUnstructuredGrid* grid); private: - static MeshLib::CElem* createElement(size_t node1, size_t node2, size_t node3); + static MeshLib::CElem* createElement(MshElemType::type t, int mat, + size_t node1, size_t node2, + size_t node3, size_t node4 = 0); }; #endif // VTKMESHCONVERTER_H diff --git a/VtkVis/VtkPointsSource.cpp b/VtkVis/VtkPointsSource.cpp index 2528d2eb006..7f108aa8d21 100644 --- a/VtkVis/VtkPointsSource.cpp +++ b/VtkVis/VtkPointsSource.cpp @@ -17,6 +17,7 @@ #include <vtkPolyData.h> #include <vtkSmartPointer.h> #include <vtkStreamingDemandDrivenPipeline.h> +#include <vtkCellData.h> vtkStandardNewMacro(VtkPointsSource); vtkCxxRevisionMacro(VtkPointsSource, "$Revision$"); @@ -75,21 +76,31 @@ int VtkPointsSource::RequestData( vtkInformation* request, vtkSmartPointer<vtkCellArray> newVerts = vtkSmartPointer<vtkCellArray>::New(); newPoints->Allocate(numPoints); newVerts->Allocate(numPoints); + + vtkSmartPointer<vtkIntArray> pointIDs = vtkSmartPointer<vtkIntArray>::New(); + pointIDs->SetNumberOfComponents(1); + pointIDs->SetName("PointIDs"); if (outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()) > 0) return 1; // Generate points and vertices + int i = 0; for (std::vector<GEOLIB::Point*>::const_iterator it = _points->begin(); it != _points->end(); ++it) { double coords[3] = {(*(*it))[0], (*(*it))[1], (*(*it))[2]}; vtkIdType pid = newPoints->InsertNextPoint(coords); newVerts->InsertNextCell(1, &pid); + + pointIDs->InsertNextValue(i); + i++; } output->SetPoints(newPoints); output->SetVerts(newVerts); + output->GetCellData()->AddArray(pointIDs); + output->GetCellData()->SetActiveAttribute("PointIDs", vtkDataSetAttributes::SCALARS); return 1; } diff --git a/VtkVis/VtkStationSource.cpp b/VtkVis/VtkStationSource.cpp index 62075c54982..3af0866f47c 100644 --- a/VtkVis/VtkStationSource.cpp +++ b/VtkVis/VtkStationSource.cpp @@ -72,7 +72,7 @@ int VtkStationSource::RequestData( vtkInformation* request, if (!_stations) return 0; - int nStations = _stations->size(); + size_t nStations = _stations->size(); if (nStations == 0) return 0; diff --git a/VtkVis/VtkVisImageItem.cpp b/VtkVis/VtkVisImageItem.cpp index 2a896458b1c..6add66825eb 100644 --- a/VtkVis/VtkVisImageItem.cpp +++ b/VtkVis/VtkVisImageItem.cpp @@ -7,45 +7,47 @@ #include "VtkAlgorithmProperties.h" #include "VtkVisImageItem.h" -#include "QVtkDataSetMapper.h" #include <vtkActor.h> #include <vtkDataSetMapper.h> #include <vtkImageAlgorithm.h> +#include <vtkImageChangeInformation.h> #include <vtkRenderer.h> #include <vtkSmartPointer.h> -// export test +// export #include <vtkImageActor.h> #include <vtkXMLImageDataWriter.h> VtkVisImageItem::VtkVisImageItem( vtkAlgorithm* algorithm, TreeItem* parentItem, const QList<QVariant> data /*= QList<QVariant>()*/) - : VtkVisPipelineItem(algorithm, parentItem, data) + : VtkVisPipelineItem(algorithm, parentItem, data), _transformFilter(NULL) { } VtkVisImageItem::VtkVisImageItem( VtkCompositeFilter* compositeFilter, TreeItem* parentItem, const QList<QVariant> data /*= QList<QVariant>()*/) - : VtkVisPipelineItem(compositeFilter, parentItem, data) + : VtkVisPipelineItem(compositeFilter, parentItem, data), _transformFilter(NULL) { } VtkVisImageItem::~VtkVisImageItem() { + _transformFilter->Delete(); } void VtkVisImageItem::Initialize(vtkRenderer* renderer) { + _transformFilter = vtkImageChangeInformation::New(); + _transformFilter->SetInputConnection(_algorithm->GetOutputPort()); + _transformFilter->Update(); + _renderer = renderer; - _mapper = QVtkDataSetMapper::New(); - _mapper->InterpolateScalarsBeforeMappingOff(); // Use a special vtkImageActor instead of vtkActor - vtkImageAlgorithm* imageAlg = static_cast<vtkImageAlgorithm*>(_algorithm); vtkImageActor* imageActor = vtkImageActor::New(); - imageActor->SetInput(imageAlg->GetOutput()); + imageActor->SetInput(_transformFilter->GetOutput()); _actor = imageActor; _renderer->AddActor(_actor); @@ -53,11 +55,7 @@ void VtkVisImageItem::Initialize(vtkRenderer* renderer) VtkAlgorithmProperties* vtkProps = dynamic_cast<VtkAlgorithmProperties*>(_algorithm); if (vtkProps) setVtkProperties(vtkProps); -/* - // Copy properties from parent - else - { - */ + VtkVisPipelineItem* parentItem = dynamic_cast<VtkVisPipelineItem*>(this->parentItem()); while (parentItem) { @@ -75,7 +73,6 @@ void VtkVisImageItem::Initialize(vtkRenderer* renderer) else parentItem = dynamic_cast<VtkVisPipelineItem*>(parentItem->parentItem()); } -// } // Set active scalar to the desired one from VtkAlgorithmProperties // or to match those of the parent. @@ -117,3 +114,13 @@ int VtkVisImageItem::callVTKWriter(vtkAlgorithm* algorithm, const std::string &f std::cout << "VtkVisPipelineItem::writeToFile() - Unknown data type..." << std::endl; return 0; } + +void VtkVisImageItem::setTranslation(double x, double y, double z) const +{ + _transformFilter->SetOriginTranslation(x,y,z); +} + +vtkAlgorithm* VtkVisImageItem::transformFilter() const +{ + return _transformFilter; +} \ No newline at end of file diff --git a/VtkVis/VtkVisImageItem.h b/VtkVis/VtkVisImageItem.h index 481bc91f36c..827d87a3d37 100644 --- a/VtkVis/VtkVisImageItem.h +++ b/VtkVis/VtkVisImageItem.h @@ -11,19 +11,22 @@ #include "VtkVisPipelineItem.h" class vtkAlgorithm; +class vtkImageChangeInformation; class vtkPointSet; -class QVtkDataSetMapper; class vtkProp3D; class vtkRenderer; -class VtkAlgorithmProperties; + class vtkOsgActor; + +class VtkAlgorithmProperties; class VtkCompositeFilter; /** - * \brief An item in the VtkVisPipeline containing a graphic object to be visualized. + * \brief An item in the VtkVisPipeline containing an image to be visualized. * - * Any VTK-object (source-items, filter-items, etc.) need to be put into a VtkPipelineItem - * to be assigned a mapper, an actor and its visualization properties (colour, etc.). + * Any vtkImageAlgorithm object is represented by a VtkVisImageItem to be assigned a mapper, + * an actor and its visualization properties. + * \sa VtkVisPipelineItem */ class VtkVisImageItem : public VtkVisPipelineItem { @@ -43,11 +46,17 @@ public: /// the item and sets the item's properties. void Initialize(vtkRenderer* renderer); + void setTranslation(double x, double y, double z) const; + + vtkAlgorithm* transformFilter() const; + protected: + /// Selects the appropriate VTK-Writer object and writes the object to a file with the given name. virtual int callVTKWriter(vtkAlgorithm* algorithm, const std::string &filename) const; void setVtkProperties(VtkAlgorithmProperties* vtkProps); private: + vtkImageChangeInformation* _transformFilter; }; #endif // VTKVISIMAGEITEM_H diff --git a/VtkVis/VtkVisPipeline.cpp b/VtkVis/VtkVisPipeline.cpp index 0c12e4878ff..6ed962d5d94 100644 --- a/VtkVis/VtkVisPipeline.cpp +++ b/VtkVis/VtkVisPipeline.cpp @@ -9,7 +9,7 @@ #include "VtkVisPipeline.h" //#include "Model.h" -#include "ConditionModel.h" +#include "ProcessModel.h" #include "GeoTreeModel.h" #include "MeshQualityEquiAngleSkew.h" #include "MeshQualityNormalisedArea.h" @@ -21,6 +21,7 @@ #include "TreeModel.h" #include "VtkAlgorithmProperties.h" #include "VtkCompositeSelectionFilter.h" +#include "VtkCompositeGeoObjectFilter.h" #include "VtkFilterFactory.h" #include "VtkMeshSource.h" #include "VtkTrackedCamera.h" @@ -56,7 +57,7 @@ #include <QTime> VtkVisPipeline::VtkVisPipeline( vtkRenderer* renderer, QObject* parent /*= 0*/ ) - : TreeModel(parent), _renderer(renderer) + : TreeModel(parent), _renderer(renderer), _highlighted_geo_index(QModelIndex()) { QList<QVariant> rootData; rootData << "Object name" << "Visible"; @@ -251,11 +252,9 @@ void VtkVisPipeline::addPipelineItem(StationTreeModel* model, const std::string addPipelineItem(model->vtkSource(name)); } -void VtkVisPipeline::addPipelineItem(ConditionModel* model, - const std::string &name, - FEMCondition::CondType type) +void VtkVisPipeline::addPipelineItem(ProcessModel* model, const FiniteElement::ProcessType pcs_type, const FEMCondition::CondType cond_type) { - addPipelineItem(model->vtkSource(name, type)); + addPipelineItem(model->vtkSource(pcs_type, cond_type)); } void VtkVisPipeline::addPipelineItem(MshModel* model, const QModelIndex &idx) @@ -263,7 +262,7 @@ void VtkVisPipeline::addPipelineItem(MshModel* model, const QModelIndex &idx) addPipelineItem(static_cast<MshItem*>(model->getItem(idx))->vtkSource()); } -void VtkVisPipeline::addPipelineItem(VtkVisPipelineItem* item, const QModelIndex &parent) +QModelIndex VtkVisPipeline::addPipelineItem(VtkVisPipelineItem* item, const QModelIndex &parent) { item->Initialize(_renderer); TreeItem* parentItem = item->parentItem(); @@ -273,8 +272,7 @@ void VtkVisPipeline::addPipelineItem(VtkVisPipelineItem* item, const QModelIndex { QSettings settings("UFZ, OpenGeoSys-5"); if (dynamic_cast<vtkImageAlgorithm*>(item->algorithm()) == NULL) // if not an image - item->setScale(1.0, 1.0, settings.value("globalSuperelevation", - 1.0).toDouble()); + item->setScale(1.0, 1.0, settings.value("globalSuperelevation", 1.0).toDouble()); } int parentChildCount = parentItem->childCount(); @@ -292,9 +290,11 @@ void VtkVisPipeline::addPipelineItem(VtkVisPipelineItem* item, const QModelIndex reset(); emit vtkVisPipelineChanged(); + + return newIndex; } -void VtkVisPipeline::addPipelineItem( vtkAlgorithm* source, +QModelIndex VtkVisPipeline::addPipelineItem( vtkAlgorithm* source, QModelIndex parent /* = QModelindex() */) { TreeItem* parentItem = getItem(parent); @@ -339,7 +339,7 @@ void VtkVisPipeline::addPipelineItem( vtkAlgorithm* source, item = new VtkVisImageItem(source, parentItem, itemData); else item = new VtkVisPointSetItem(source, parentItem, itemData); - this->addPipelineItem(item, parent); + return this->addPipelineItem(item, parent); } void VtkVisPipeline::removeSourceItem(GeoTreeModel* model, @@ -357,14 +357,12 @@ void VtkVisPipeline::removeSourceItem(GeoTreeModel* model, } } -void VtkVisPipeline::removeSourceItem(ConditionModel* model, - const std::string &name, - FEMCondition::CondType type) +void VtkVisPipeline::removeSourceItem(ProcessModel* model, const FiniteElement::ProcessType pcs_type, const FEMCondition::CondType cond_type) { for (int i = 0; i < _rootItem->childCount(); i++) { VtkVisPipelineItem* item = static_cast<VtkVisPipelineItem*>(getItem(index(i, 0))); - if (item->algorithm() == model->vtkSource(name, type)) + if (item->algorithm() == model->vtkSource(pcs_type, cond_type)) { removePipelineItem(index(i, 0)); return; @@ -492,6 +490,7 @@ void VtkVisPipeline::checkMeshQuality(VtkMeshSource* source, MshQualityType::typ parentItem, itemData); this->addPipelineItem(item, this->createIndex(i, 0, item)); + break; } } @@ -514,3 +513,36 @@ void VtkVisPipeline::checkMeshQuality(VtkMeshSource* source, MshQualityType::typ delete checker; } } + +void VtkVisPipeline::highlightGeoObject(const vtkPolyDataAlgorithm* source, int index) +{ + this->removeHighlightedGeoObject(); + int nSources = this->_rootItem->childCount(); + for (int i = 0; i < nSources; i++) + { + VtkVisPipelineItem* parentItem = static_cast<VtkVisPipelineItem*>(_rootItem->child(i)); + if (parentItem->algorithm() == source) + { + QList<QVariant> itemData; + itemData << "Selected GeoObject" << true; + + VtkCompositeFilter* filter = VtkFilterFactory::CreateCompositeFilter( + "VtkCompositeGeoObjectFilter", + parentItem->transformFilter()); + static_cast<VtkCompositeGeoObjectFilter*>(filter)->SetIndex(index); + VtkVisPointSetItem* item = new VtkVisPointSetItem(filter, parentItem, itemData); + QModelIndex parent_index = static_cast<TreeModel*>(this)->index(i, 0, QModelIndex()); + _highlighted_geo_index = this->addPipelineItem(item, parent_index); + break; + } + } +} + +void VtkVisPipeline::removeHighlightedGeoObject() +{ + if (_highlighted_geo_index != QModelIndex()) + { + this->removePipelineItem(_highlighted_geo_index); + _highlighted_geo_index = QModelIndex(); + } +} diff --git a/VtkVis/VtkVisPipeline.h b/VtkVis/VtkVisPipeline.h index 6218aca0798..8fbefb0d561 100644 --- a/VtkVis/VtkVisPipeline.h +++ b/VtkVis/VtkVisPipeline.h @@ -23,12 +23,13 @@ class vtkAlgorithm; class vtkDataSet; class vtkLight; class vtkPointSet; +class vtkPolyDataAlgorithm; class vtkRenderer; class vtkProp3D; class QModelIndex; class QString; class GeoTreeModel; -class ConditionModel; +class ProcessModel; class MshModel; class StationTreeModel; class TreeModel; @@ -85,21 +86,17 @@ public slots: /// \brief Adds the given Model to the pipeline. void addPipelineItem(MshModel* model, const QModelIndex &idx); void addPipelineItem(GeoTreeModel* model, const std::string &name, GEOLIB::GEOTYPE type); - void addPipelineItem(ConditionModel* model, - const std::string &name, - FEMCondition::CondType type); + void addPipelineItem(ProcessModel* model, const FiniteElement::ProcessType pcs_type, FEMCondition::CondType cond_type); void addPipelineItem(StationTreeModel* model, const std::string &name); - void addPipelineItem(VtkVisPipelineItem* item, const QModelIndex &parent); + QModelIndex addPipelineItem(VtkVisPipelineItem* item, const QModelIndex &parent); /// \brief Inserts the vtkAlgorithm as a child of the given QModelIndex to the pipeline. - void addPipelineItem(vtkAlgorithm* source, QModelIndex parent = QModelIndex()); + QModelIndex addPipelineItem(vtkAlgorithm* source, QModelIndex parent = QModelIndex()); /// \brief Removes the given Model (and all attached vtkAlgorithms) from the pipeline. void removeSourceItem(MshModel* model, const QModelIndex &idx); void removeSourceItem(GeoTreeModel* model, const std::string &name, GEOLIB::GEOTYPE type); - void removeSourceItem(ConditionModel* model, - const std::string &name, - FEMCondition::CondType type); + void removeSourceItem(ProcessModel* model, const FiniteElement::ProcessType pcs_type, FEMCondition::CondType cond_type); void removeSourceItem(StationTreeModel* model, const std::string &name); /// \brief Removes the vtkAlgorithm at the given QModelIndex (and all attached @@ -109,6 +106,9 @@ public slots: /// Checks the quality of a mesh and cal a filter to highlight deformed elements. void checkMeshQuality(VtkMeshSource* mesh, MshQualityType::type t); + void highlightGeoObject(const vtkPolyDataAlgorithm* source, int index); + void removeHighlightedGeoObject(); + private: void listArrays(vtkDataSet* dataSet); @@ -118,6 +118,9 @@ private: QMap<vtkProp3D*, QModelIndex> _actorMap; bool _resetCameraOnAddOrRemove; + QModelIndex _highlighted_geo_index; + + signals: /// \brief Is emitted when a pipeline item was added or removed. void vtkVisPipelineChanged() const; diff --git a/VtkVis/VtkVisPipelineItem.cpp b/VtkVis/VtkVisPipelineItem.cpp index 2e889ef8878..cc2fe2cb975 100644 --- a/VtkVis/VtkVisPipelineItem.cpp +++ b/VtkVis/VtkVisPipelineItem.cpp @@ -36,10 +36,8 @@ VtkVisPipelineItem::VtkVisPipelineItem( vtkAlgorithm* algorithm, TreeItem* parentItem, const QList<QVariant> data /*= QList<QVariant>()*/) - : TreeItem(data, - parentItem), _actor(NULL), _algorithm(algorithm), _mapper(NULL), - _renderer(NULL), - _compositeFilter(NULL) + : TreeItem(data, parentItem), _actor(NULL), _algorithm(algorithm), + _renderer(NULL),_compositeFilter(NULL) { VtkVisPipelineItem* visParentItem = dynamic_cast<VtkVisPipelineItem*>(parentItem); if (parentItem->parentItem()) @@ -49,8 +47,7 @@ VtkVisPipelineItem::VtkVisPipelineItem( VtkVisPipelineItem::VtkVisPipelineItem( VtkCompositeFilter* compositeFilter, TreeItem* parentItem, const QList<QVariant> data /*= QList<QVariant>()*/) - : TreeItem(data, parentItem), _actor(NULL), _mapper(NULL), _renderer(NULL), - _compositeFilter(compositeFilter) + : TreeItem(data, parentItem), _actor(NULL), _renderer(NULL), _compositeFilter(compositeFilter) { _algorithm = _compositeFilter->GetOutputAlgorithm(); } @@ -58,7 +55,6 @@ VtkVisPipelineItem::VtkVisPipelineItem( VtkVisPipelineItem::~VtkVisPipelineItem() { _renderer->RemoveActor(_actor); - _mapper->Delete(); _actor->Delete(); delete _compositeFilter; } @@ -140,11 +136,6 @@ vtkProp3D* VtkVisPipelineItem::actor() const return _actor; } -void VtkVisPipelineItem::SetScalarVisibility( bool on ) -{ - _mapper->SetScalarVisibility(on); -} - void VtkVisPipelineItem::setScale(double x, double y, double z) const { (void)x; diff --git a/VtkVis/VtkVisPipelineItem.h b/VtkVis/VtkVisPipelineItem.h index 9067eccebeb..9c07af2e58b 100644 --- a/VtkVis/VtkVisPipelineItem.h +++ b/VtkVis/VtkVisPipelineItem.h @@ -18,15 +18,17 @@ #include <QVariant> class vtkAlgorithm; +class vtkDataSetAttributes; class vtkPointSet; -class QVtkDataSetMapper; class vtkProp3D; class vtkRenderer; -class VtkAlgorithmProperties; +class vtkTransformFilter; +class QVtkDataSetMapper; + class vtkOsgActor; + +class VtkAlgorithmProperties; class VtkCompositeFilter; -class vtkTransformFilter; -class vtkDataSetAttributes; /** * \brief An item in the VtkVisPipeline containing a graphic object to be visualized. @@ -72,9 +74,6 @@ public: // Dummy for implementation in derived classes virtual void SetActiveAttribute(const QString& str) { (void)str; } - /// @brief Returns the mapper - QVtkDataSetMapper* mapper() const { return _mapper; } - /// @brief Returns the composite filter VtkCompositeFilter* compositeFilter() const { return _compositeFilter; } @@ -87,14 +86,24 @@ public: /// @brief Writes this algorithm's vtkDataSet (i.e. vtkPolyData or vtkUnstructuredGrid) to a vtk-file. int writeToFile(const std::string &filename) const; - /// @brief Sets the geometry and data scaling. + /** + * @brief Scales the data in visualisation-space. + * This function is empty and needs to be implemented by derived classes. + */ virtual void setScale(double x, double y, double z) const; - /// @brief Translates the item in vis-space. + /** + * @brief Translates the item in visualisation-space. + * This function is empty and needs to be implemented by derived classes. + */ virtual void setTranslation(double x, double y, double z) const; - // Dummy for implementation in derived classes - virtual vtkTransformFilter* transformFilter() const { return NULL; } + /** + * Returns the transform filter for the object. + * This function needs to be implemented by derived classes. + */ + virtual vtkAlgorithm* transformFilter() const = 0; + /// @brief Sets the geometry and date scaling recursively on all children of /// this item. void setScaleOnChildren(double x, double y, double z) const; @@ -102,14 +111,15 @@ public: protected: vtkProp3D* _actor; vtkAlgorithm* _algorithm; - QVtkDataSetMapper* _mapper; vtkRenderer* _renderer; VtkCompositeFilter* _compositeFilter; + /** + * Selects the appropriate VTK-Writer object and writes the object to a file with the given name. + * This function is empty and needs to be implemented by derived classes. + */ virtual int callVTKWriter(vtkAlgorithm* algorithm, const std::string &filename) const; - void SetScalarVisibility(bool on); - private: }; diff --git a/VtkVis/VtkVisPipelineView.cpp b/VtkVis/VtkVisPipelineView.cpp index e55ab823706..32aae875e09 100644 --- a/VtkVis/VtkVisPipelineView.cpp +++ b/VtkVis/VtkVisPipelineView.cpp @@ -24,7 +24,7 @@ //image to mesh conversion #include "VtkGeoImageSource.h" -#include "VtkMeshConverter.h" +#include "MeshFromRasterDialog.h" #include <vtkDataObject.h> #include <vtkImageData.h> #include <vtkSmartPointer.h> @@ -82,7 +82,7 @@ void VtkVisPipelineView::contextMenuEvent( QContextMenuEvent* event ) isSourceItem = false; // this exception is needed as image object are only displayed in the vis-pipeline addMeshingAction = menu.addAction("Convert Image to Mesh..."); connect(addMeshingAction, SIGNAL(triggered()), this, - SLOT(convertImageToMesh())); + SLOT(showImageToMeshConversionDialog())); } else { @@ -123,9 +123,8 @@ void VtkVisPipelineView::exportSelectedPipelineItemAsVtk() QSettings settings("UFZ", "OpenGeoSys-5"); QModelIndex idx = this->selectionModel()->currentIndex(); QString filename = QFileDialog::getSaveFileName(this, "Export object to vtk-file", - settings.value( - "lastExportedFileDirectory"). - toString(),"(*.*)"); + settings.value("lastExportedFileDirectory").toString(), + "All files (* *.*)"); if (!filename.isEmpty()) { static_cast<VtkVisPipelineItem*>(static_cast<VtkVisPipeline*>(this->model())-> @@ -140,8 +139,7 @@ void VtkVisPipelineView::exportSelectedPipelineItemAsOsg() QSettings settings("UFZ", "OpenGeoSys-5"); QModelIndex idx = this->selectionModel()->currentIndex(); QString filename = QFileDialog::getSaveFileName(this, "Export object to OpenSG file", - settings.value( - "lastExportedFileDirectory"). + settings.value("lastExportedFileDirectory"). toString(), "OpenSG file (*.osb)"); if (!filename.isEmpty()) { @@ -162,32 +160,35 @@ void VtkVisPipelineView::addPipelineFilterItem() emit requestAddPipelineFilterItem(selectionModel()->currentIndex()); } -void VtkVisPipelineView::convertImageToMesh() +void VtkVisPipelineView::showImageToMeshConversionDialog() +{ + MeshFromRasterDialog* dlg = new MeshFromRasterDialog(); + connect(dlg, SIGNAL(setMeshParameters(QString, MshElemType::type, UseIntensityAs::type)), + this, SLOT(constructMeshFromImage(QString, MshElemType::type, UseIntensityAs::type))); + dlg->exec(); +} + +void VtkVisPipelineView::constructMeshFromImage(QString msh_name, MshElemType::type element_type, UseIntensityAs::type intensity_type) { vtkSmartPointer<vtkAlgorithm> algorithm = static_cast<VtkVisPipelineItem*>(static_cast<VtkVisPipeline*>(this->model())-> - getItem(this-> - selectionModel() - ->currentIndex()))->algorithm(); + getItem(this->selectionModel()->currentIndex()))->algorithm(); vtkSmartPointer<VtkGeoImageSource> imageSource = VtkGeoImageSource::SafeDownCast(algorithm); vtkSmartPointer<vtkImageData> image = imageSource->GetOutput(); - - MeshLib::CFEMesh* mesh = VtkMeshConverter::convertImgToMesh(image, - imageSource->getOrigin(), - imageSource->getSpacing()); - // now do something with the mesh (save, display, whatever... ) - std::string msh_name("NewMesh"); - emit meshAdded(mesh, msh_name); + + MeshLib::CFEMesh* mesh = VtkMeshConverter::convertImgToMesh(image, imageSource->getOrigin(), + imageSource->getSpacing(), + element_type, intensity_type); + std::string new_mesh_name(msh_name.toStdString()); + emit meshAdded(mesh, new_mesh_name); } void VtkVisPipelineView::convertVTKToOGSMesh() { vtkSmartPointer<vtkAlgorithm> algorithm = - static_cast<VtkVisPipelineItem*>(static_cast<VtkVisPipeline*>(this->model())-> - getItem(this-> - selectionModel() - ->currentIndex()))->algorithm(); + static_cast<VtkVisPipelineItem*>(static_cast<VtkVisPipeline*>(this->model())->getItem( + this->selectionModel()->currentIndex()))->algorithm(); vtkUnstructuredGrid* grid(NULL); vtkUnstructuredGridAlgorithm* ugAlg = vtkUnstructuredGridAlgorithm::SafeDownCast(algorithm); @@ -195,14 +196,14 @@ void VtkVisPipelineView::convertVTKToOGSMesh() grid = ugAlg->GetOutput(); else { - vtkGenericDataObjectReader* dataReader = vtkGenericDataObjectReader::SafeDownCast( - algorithm); // for old filetypes + // for old filetypes + vtkGenericDataObjectReader* dataReader = vtkGenericDataObjectReader::SafeDownCast(algorithm); if (dataReader) grid = vtkUnstructuredGrid::SafeDownCast(dataReader->GetOutput()); else { - vtkXMLUnstructuredGridReader* xmlReader = - vtkXMLUnstructuredGridReader::SafeDownCast(algorithm); // for new filetypes + // for new filetypes + vtkXMLUnstructuredGridReader* xmlReader = vtkXMLUnstructuredGridReader::SafeDownCast(algorithm); grid = vtkUnstructuredGrid::SafeDownCast(xmlReader->GetOutput()); } } diff --git a/VtkVis/VtkVisPipelineView.h b/VtkVis/VtkVisPipelineView.h index 67590b282e5..e2d28ae33ab 100644 --- a/VtkVis/VtkVisPipelineView.h +++ b/VtkVis/VtkVisPipelineView.h @@ -9,6 +9,7 @@ // ** INCLUDES ** #include <QTreeView> +#include "VtkMeshConverter.h" class QItemSelection; class QAbstractItemModel; @@ -62,7 +63,10 @@ private slots: void addPipelineFilterItem(); /// Calls the conversion method for creating an OGS Mesh from a vtkImageData object. - void convertImageToMesh(); + void constructMeshFromImage(QString msh_name, MshElemType::type element_type, UseIntensityAs::type intensity_type); + + /// Calls the dialog to + void showImageToMeshConversionDialog(); /// Calls the conversion method for making a vtk grid an ogs mesh. void convertVTKToOGSMesh(); diff --git a/VtkVis/VtkVisPointSetItem.cpp b/VtkVis/VtkVisPointSetItem.cpp index b01c5ee15c9..64c68ebaf05 100644 --- a/VtkVis/VtkVisPointSetItem.cpp +++ b/VtkVis/VtkVisPointSetItem.cpp @@ -7,6 +7,8 @@ #include "VtkAlgorithmProperties.h" #include "VtkVisPointSetItem.h" +#include <limits> + #include "QVtkDataSetMapper.h" #include <vtkActor.h> #include <vtkCellData.h> @@ -34,12 +36,13 @@ VtkVisPointSetItem::VtkVisPointSetItem( vtkAlgorithm* algorithm, TreeItem* parentItem, const QList<QVariant> data /*= QList<QVariant>()*/) - : VtkVisPipelineItem(algorithm, parentItem, - data), _transformFilter(NULL), _activeAttribute("") + : VtkVisPipelineItem(algorithm, parentItem, data), _mapper(NULL), + _transformFilter(NULL), _activeAttribute("") { VtkVisPipelineItem* visParentItem = dynamic_cast<VtkVisPipelineItem*>(parentItem); if (parentItem->parentItem()) { + // special case if parent is image but child is not (e.g. Image2BarChartFilter) if (dynamic_cast<vtkImageAlgorithm*>(visParentItem->algorithm())) _algorithm->SetInputConnection(visParentItem->algorithm()->GetOutputPort()); else @@ -56,14 +59,15 @@ VtkVisPointSetItem::VtkVisPointSetItem( VtkVisPointSetItem::VtkVisPointSetItem( VtkCompositeFilter* compositeFilter, TreeItem* parentItem, const QList<QVariant> data /*= QList<QVariant>()*/) - : VtkVisPipelineItem(compositeFilter, parentItem, - data), _transformFilter(NULL), _activeAttribute("") + : VtkVisPipelineItem(compositeFilter, parentItem, data), _mapper(NULL), + _transformFilter(NULL), _activeAttribute("") { } VtkVisPointSetItem::~VtkVisPointSetItem() { _transformFilter->Delete(); + _mapper->Delete(); } void VtkVisPointSetItem::Initialize(vtkRenderer* renderer) @@ -81,7 +85,6 @@ void VtkVisPointSetItem::Initialize(vtkRenderer* renderer) _mapper = QVtkDataSetMapper::New(); _mapper->InterpolateScalarsBeforeMappingOff(); - // Use a special vtkImageActor instead of vtkActor _mapper->SetInputConnection(_transformFilter->GetOutputPort()); _actor = vtkActor::New(); static_cast<vtkActor*>(_actor)->SetMapper(_mapper); @@ -110,8 +113,7 @@ void VtkVisPointSetItem::Initialize(vtkRenderer* renderer) parentItem = NULL; } else - parentItem = - dynamic_cast<VtkVisPipelineItem*>(parentItem->parentItem()); + parentItem = dynamic_cast<VtkVisPipelineItem*>(parentItem->parentItem()); } } @@ -133,6 +135,11 @@ void VtkVisPointSetItem::Initialize(vtkRenderer* renderer) } } +void VtkVisPointSetItem::SetScalarVisibility( bool on ) +{ + _mapper->SetScalarVisibility(on); +} + void VtkVisPointSetItem::setVtkProperties(VtkAlgorithmProperties* vtkProps) { QObject::connect(vtkProps, SIGNAL(ScalarVisibilityChanged(bool)), @@ -222,15 +229,9 @@ void VtkVisPointSetItem::SetActiveAttribute( const QString& name ) vtkPointData* pointData = dataSet->GetPointData(); if(pointData) { - if(setActiveAttributeOnData(pointData, strippedName)) + if(activeAttributeExists(pointData, strippedName)) { - _algorithm->SetInputArrayToProcess( - 0, - 0, - 0, - vtkDataObject:: - FIELD_ASSOCIATION_POINTS, - charName); + _algorithm->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, charName); _mapper->SetScalarModeToUsePointData(); } else @@ -246,15 +247,9 @@ void VtkVisPointSetItem::SetActiveAttribute( const QString& name ) vtkCellData* cellData = dataSet->GetCellData(); if(cellData) { - if(setActiveAttributeOnData(cellData, strippedName)) + if(activeAttributeExists(cellData, strippedName)) { - _algorithm->SetInputArrayToProcess( - 0, - 0, - 0, - vtkDataObject:: - FIELD_ASSOCIATION_CELLS, - charName); + _algorithm->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, charName); _mapper->SetScalarModeToUseCellData(); } else @@ -266,15 +261,16 @@ void VtkVisPointSetItem::SetActiveAttribute( const QString& name ) } } + _activeAttribute = name; _mapper->SetScalarRange(dataSet->GetScalarRange()); this->setLookupTableForActiveScalar(); _mapper->ScalarVisibilityOn(); + //_mapper->Update(); // KR: TODO - this is incredibly slow ... WHY??? - _activeAttribute = name; } } -bool VtkVisPointSetItem::setActiveAttributeOnData(vtkDataSetAttributes* data, std::string& name) +bool VtkVisPointSetItem::activeAttributeExists(vtkDataSetAttributes* data, std::string& name) { bool arrayFound = false; for (int i = 0; i < data->GetNumberOfArrays() && !arrayFound; i++) @@ -306,12 +302,11 @@ void VtkVisPointSetItem::setLookupTableForActiveScalar() vtkProps->SetLookUpTable(GetActiveAttribute(), lut); } else // specific color table + _mapper->SetLookupTable(vtkProps->GetLookupTable(this->GetActiveAttribute())); - _mapper->SetLookupTable(vtkProps->GetLookupTable(this-> - GetActiveAttribute())); - - _mapper->SetScalarRange(_transformFilter->GetOutput()->GetScalarRange()); - //_mapper->Update(); KR: not necessary?! + //_mapper->SetScalarRange(this->_transformFilter->GetOutput()->GetScalarRange()); + _mapper->SetScalarRange(vtkDataSet::SafeDownCast(this->_algorithm->GetOutputDataObject(0))->GetScalarRange()); + //_mapper->Update(); //KR: not necessary?! } } } @@ -327,7 +322,7 @@ void VtkVisPointSetItem::setScale(double x, double y, double z) const if (this->transformFilter()) { vtkTransform* transform = - static_cast<vtkTransform*>(this->transformFilter()->GetTransform()); + static_cast<vtkTransform*>(this->_transformFilter->GetTransform()); double* trans = transform->GetPosition(); transform->Identity(); transform->Scale(x, y, z); @@ -341,7 +336,7 @@ void VtkVisPointSetItem::setTranslation(double x, double y, double z) const if (this->transformFilter()) { vtkTransform* transform = - static_cast<vtkTransform*>(this->transformFilter()->GetTransform()); + static_cast<vtkTransform*>(this->_transformFilter->GetTransform()); double* scale = transform->GetScale(); transform->Identity(); transform->Scale(scale); @@ -350,3 +345,7 @@ void VtkVisPointSetItem::setTranslation(double x, double y, double z) const } } +vtkAlgorithm* VtkVisPointSetItem::transformFilter() const +{ + return _transformFilter; +} \ No newline at end of file diff --git a/VtkVis/VtkVisPointSetItem.h b/VtkVis/VtkVisPointSetItem.h index 843bf61bf9a..90298eca855 100644 --- a/VtkVis/VtkVisPointSetItem.h +++ b/VtkVis/VtkVisPointSetItem.h @@ -11,25 +11,28 @@ #include "VtkVisPipelineItem.h" class vtkAlgorithm; +class vtkDataSetAttributes; class vtkPointSet; -class QVtkDataSetMapper; class vtkProp3D; class vtkRenderer; -class VtkAlgorithmProperties; +class vtkTransformFilter; +class QVtkDataSetMapper; + class vtkOsgActor; + +class VtkAlgorithmProperties; class VtkCompositeFilter; -class vtkTransformFilter; -class vtkDataSetAttributes; /** - * \brief An item in the VtkVisPipeline containing a graphic object to be visualized. + * \brief An item in the VtkVisPipeline containing a point set object to be visualized. * - * Any VTK-object (source-items, filter-items, etc.) need to be put into a VtkPipelineItem - * to be assigned a mapper, an actor and its visualization properties (colour, etc.). + * Any VTK point set object (i.e. vtkUnstructuredGrid- and vtkPolyDataAlgorithm-objects) + * are represented by a VtkVisPointSetItem to be assigned a mapper, an actor and its + * visualization properties (colour, scalar values, etc.). + * \sa VtkVisPipelineItem */ class VtkVisPointSetItem : public VtkVisPipelineItem { -// Q_OBJECT public: /// @brief Constructor for a source/filter object. @@ -50,34 +53,39 @@ public: /// the item and sets the item's properties. void Initialize(vtkRenderer* renderer); - vtkTransformFilter* transformFilter() const { return _transformFilter; } + vtkAlgorithm* transformFilter() const; /// @brief Sets the selected attribute array for the visualisation of the data set. void SetActiveAttribute(const QString& name); + /// @brief Sets the scalar range for the selected data array void SetScalarRange(double min, double max); - /// @brief Sets the geometry and data scaling. + /// @brief Scales the data in visualisation-space. void setScale(double x, double y, double z) const; - /// @brief Translates the item in vis-space. + /// @brief Translates the item in visualisation-space. void setTranslation(double x, double y, double z) const; protected: + QVtkDataSetMapper* _mapper; vtkTransformFilter* _transformFilter; QString _activeAttribute; + /// Selects the appropriate VTK-Writer object and writes the object to a file with the given name. virtual int callVTKWriter(vtkAlgorithm* algorithm, const std::string &filename) const; /// Sets a color lookup table for the current scalar array. void setLookupTableForActiveScalar(); + void SetScalarVisibility(bool on); + /// @brief Sets pre-set properties on vtkActor and on vtkMapper void setVtkProperties(VtkAlgorithmProperties* vtkProps); private: - /// @see SetActiveAttribute() - bool setActiveAttributeOnData(vtkDataSetAttributes* data, std::string& name); + /// Checks if the selected attribute actually exists for the data set + bool activeAttributeExists(vtkDataSetAttributes* data, std::string& name); }; #endif // VTKVISPOINTSETITEM_H diff --git a/VtkVis/VtkVisTabWidget.cpp b/VtkVis/VtkVisTabWidget.cpp index 5b6fac538e2..880fca04054 100644 --- a/VtkVis/VtkVisTabWidget.cpp +++ b/VtkVis/VtkVisTabWidget.cpp @@ -9,9 +9,11 @@ #include "VtkColorByHeightFilter.h" #include "VtkCompositeColorByHeightFilter.h" #include "VtkVisPipelineItem.h" +#include "VtkVisImageItem.h" #include "VtkVisTabWidget.h" #include <vtkActor.h> +#include <vtkImageChangeInformation.h> #include <vtkProperty.h> #include <vtkTransform.h> #include <vtkTransformFilter.h> @@ -54,20 +56,20 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item ) if (item) { _item = item; + transformTabWidget->setEnabled(true); - vtkActor* actor = dynamic_cast<vtkActor*>(_item->actor()); - if (actor) + vtkTransformFilter* transform_filter = dynamic_cast<vtkTransformFilter*>(_item->transformFilter()); + if (transform_filter) // if data set { actorPropertiesGroupBox->setEnabled(true); - transformTabWidget->setEnabled(true); - vtkProperty* vtkProps = actor->GetProperty(); + vtkProperty* vtkProps = static_cast<vtkActor*>(_item->actor())->GetProperty(); diffuseColorPickerButton->setColor(vtkProps->GetDiffuseColor()); visibleEdgesCheckBox->setChecked(vtkProps->GetEdgeVisibility()); edgeColorPickerButton->setColor(vtkProps->GetEdgeColor()); opacitySlider->setValue((int)(vtkProps->GetOpacity() * 100.0)); vtkTransform* transform = - static_cast<vtkTransform*>(_item->transformFilter()->GetTransform()); + static_cast<vtkTransform*>(transform_filter->GetTransform()); if (transform) { double scale[3]; @@ -105,10 +107,22 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item ) } } } - else + else // if image { + const VtkVisImageItem* img = static_cast<VtkVisImageItem*>(_item); actorPropertiesGroupBox->setEnabled(false); - transformTabWidget->setEnabled(false); + vtkImageChangeInformation* transform = static_cast<vtkImageChangeInformation*>(img->transformFilter()); + double trans[3]; + transform->GetOriginTranslation(trans); + this->transX->blockSignals(true); + this->transY->blockSignals(true); + this->transZ->blockSignals(true); + this->transX->setText(QString::number(trans[0])); + this->transY->setText(QString::number(trans[1])); + this->transZ->setText(QString::number(trans[2])); + this->transX->blockSignals(false); + this->transY->blockSignals(false); + this->transZ->blockSignals(false); } this->buildProportiesDialog(item); -- GitLab