1 # Copyright (C) 2010-2016 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # This case corresponds to: /visu/ScalarMap/G2 case
21 # Create Scalar Map for field of the the given MED file for 10 timestamps%
25 from paravistest import datadir, pictureext, get_picture_dir, compare_view_to_ref_image
26 from pvsimple import GetActiveSource, GetRenderView, Render, OpenDataFile
27 from presentations import ScalarMapOnField, hide_all, EntityType, PrsTypeEnum,reset_view,process_prs_for_test
29 picturedir = get_picture_dir("ScalarMap/G2")
31 theFileName = datadir + "Bug829_resu_mode.med"
32 print " --------------------------------- "
33 print "file ", theFileName
34 print " --------------------------------- "
36 """Build presentations of the given types for all fields of the given file."""
37 #print "Import %s..." % theFileName.split('/')[-1],
38 result = OpenDataFile(theFileName)
39 proxy = GetActiveSource()
41 raise RuntimeError, "Error: can't import file."
44 aView = GetRenderView()
49 aFieldEntity = EntityType.NODE
50 aFieldName = "MODES___DEPL____________________"
51 #create Scalar Map presentations for 10 timestamps
54 aPrs = ScalarMapOnField(proxy, aFieldEntity,aFieldName , i)
56 raise RuntimeError, "Presentation is None!!!"
57 #display only current scalar map
62 prs_type = PrsTypeEnum.SCALARMAP
64 # Get name of presentation type
65 prs_name = PrsTypeEnum.get_name(prs_type)
66 f_prs_type = prs_name.replace(' ', '').upper()
67 # Construct image file name
68 base_name = aFieldName + "_" + str(i) + "_" + f_prs_type + "." + pictureext
69 pic_name = os.path.join(picturedir, base_name)
71 # Show and record the presentation
72 process_prs_for_test(aPrs, aView, pic_name)
75 current_dir = os.path.dirname(os.path.realpath(__file__))
76 baseline = os.path.join(current_dir, "_refs", base_name)
77 compare_view_to_ref_image(aView, baseline, threshold=1)