-
Notifications
You must be signed in to change notification settings - Fork 65
Issue 587 projected ticks #1144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
d08c888
927cb75
328014c
25c1216
64ee86a
fff3631
c8cf011
4b8da1a
6c1abd4
0a927d1
1342dc2
4ce0967
8a62e74
62792f9
5e77431
f22a375
5f296b7
80e54d2
a9bd712
85befa3
8df53e6
6c80bca
6f301d8
543db38
8c091e7
7052e68
31fd1fc
3f14c64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -434,13 +434,13 @@ def plot(self,data1,data2,template,gtype,gname,bg,*args,**kargs): | |
| returned.update(self.plot3D(data1,data2,tpl,gm,ren,**kargs)) | ||
| elif gtype in ["text"]: | ||
| if tt.priority!=0: | ||
| if not (None,None,None) in self._renderers.keys(): | ||
| ren = self.createRenderer() | ||
| self.renWin.AddRenderer(ren) | ||
| self.setLayer(ren,1) | ||
| self._renderers[(None,None,None)]=ren | ||
| else: | ||
| ren = self._renderers[(None,None,None)] | ||
| #if not (None,None,None) in self._renderers.keys(): | ||
| ren = self.createRenderer() | ||
| self.renWin.AddRenderer(ren) | ||
| self.setLayer(ren,1) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like this will have no effect, as the same call is made a few lines later with tt.priority for the layer. Which is correct?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes we can take this one out, it's left-over from debugging stages. |
||
| # self._renderers[(None,None,None)]=ren | ||
| #else: | ||
| # ren = self._renderers[(None,None,None)] | ||
| returned["vtk_backend_text_actors"] = vcs2vtk.genTextActor(ren,to=to,tt=tt) | ||
| self.setLayer(ren,tt.priority) | ||
| elif gtype=="line": | ||
|
|
@@ -1631,66 +1631,77 @@ def fitToViewport(self,Actor,vp,wc=None,geo=None): | |
| else: | ||
| Xrg=[float(wc[0]),float(wc[1])] | ||
| Yrg=[float(wc[2]),float(wc[3])] | ||
| if Yrg[0]>Yrg[1]: | ||
| #Yrg=[Yrg[1],Yrg[0]] | ||
| #T.RotateY(180) | ||
| Yrg=[Yrg[1],Yrg[0]] | ||
| flipY = True | ||
| else: | ||
| flipY = False | ||
| if Xrg[0]>Xrg[1]: | ||
| Xrg=[Xrg[1],Xrg[0]] | ||
| flipX=True | ||
| else: | ||
| flipX=False | ||
|
|
||
| if geo is not None: | ||
| pt = vtk.vtkPoints() | ||
| pt.SetNumberOfPoints(1) | ||
| Xrg2 = [1.e20,-1.e20] | ||
| Yrg2 = [1.e20,-1.e20] | ||
| Npts=50. | ||
| for x in numpy.arange(Xrg[0],Xrg[1],(Xrg[1]-Xrg[0])/Npts): | ||
| for y in numpy.arange(Yrg[0],Yrg[1],(Yrg[1]-Yrg[0])/Npts): | ||
| pt.SetPoint(0,x,y,0) | ||
| pts = vtk.vtkPoints() | ||
| geo.TransformPoints(pt,pts) | ||
| b = pts.GetBounds() | ||
| xm,xM,ym,yM=b[:4] | ||
| if xm!=-numpy.inf: | ||
| Xrg2[0]=min(Xrg2[0],xm) | ||
| if xM!=numpy.inf: | ||
| Xrg2[1]=max(Xrg2[1],xM) | ||
| if ym!=-numpy.inf: | ||
| Yrg2[0]=min(Yrg2[0],ym) | ||
| if yM!=numpy.inf: | ||
| Yrg2[1]=max(Yrg2[1],yM) | ||
| Xrg=Xrg2 | ||
| Yrg=Yrg2 | ||
| sc = self.renWin.GetSize() | ||
| wRatio = float(sc[0])/float(sc[1]) | ||
| dRatio = (Xrg[1]-Xrg[0])/(Yrg[1]-Yrg[0]) | ||
| vRatio = float(vp[1]-vp[0])/float(vp[3]-vp[2]) | ||
|
|
||
| wc_used = (float(Xrg[0]),float(Xrg[1]),float(Yrg[0]),float(Yrg[1])) | ||
| sc = self.renWin.GetSize() | ||
|
|
||
| if wRatio>1.: #landscape orientated window | ||
| yScale = 1. | ||
| xScale = vRatio*wRatio/dRatio | ||
| else: | ||
| xScale = 1. | ||
| yScale = dRatio/(vRatio*wRatio) | ||
| ## Ok now we know scaling and vp, let's see if we did this already. | ||
| if (vp,xScale,yScale) in self._renderers.keys(): | ||
| # Ok at this point this is all the info we need | ||
| # we can determine if it's a unique renderer or not | ||
| # let's see if we did this already. | ||
| if (vp,wc_used,sc) in self._renderers.keys(): | ||
| #yep already have one, we will use this Renderer | ||
| Renderer = self._renderers[(vp,xScale,yScale)] | ||
| Renderer,xScale,yScale = self._renderers[(vp,wc_used,sc)] | ||
| didRenderer = True | ||
| else: | ||
| Renderer = self.createRenderer() | ||
| self.renWin.AddRenderer(Renderer) | ||
| self._renderers[(vp,xScale,yScale)]=Renderer | ||
| Renderer.SetViewport(vp[0],vp[2],vp[1],vp[3]) | ||
| didRenderer = False | ||
|
|
||
| if Yrg[0]>Yrg[1]: | ||
| #Yrg=[Yrg[1],Yrg[0]] | ||
| #T.RotateY(180) | ||
| Yrg=[Yrg[1],Yrg[0]] | ||
| flipY = True | ||
| else: | ||
| flipY = False | ||
| if Xrg[0]>Xrg[1]: | ||
| Xrg=[Xrg[1],Xrg[0]] | ||
| flipX=True | ||
| else: | ||
| flipX=False | ||
|
|
||
| if geo is not None: | ||
| pt = vtk.vtkPoints() | ||
| pt.SetNumberOfPoints(1) | ||
| Xrg2 = [1.e20,-1.e20] | ||
| Yrg2 = [1.e20,-1.e20] | ||
| if geo.GetDestinationProjection().GetName() in ["aeqd",]: | ||
| ## These need more precision to compute actual range | ||
| Npts=250. | ||
| print "Yes doing the long one" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this in master?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. absolutely! 😜 |
||
| else: | ||
| Npts=50. | ||
| for x in numpy.arange(Xrg[0],Xrg[1],(Xrg[1]-Xrg[0])/Npts): | ||
| for y in numpy.arange(Yrg[0],Yrg[1],(Yrg[1]-Yrg[0])/Npts): | ||
| pt.InsertNextPoint(x,y,0) | ||
| pts = vtk.vtkPoints() | ||
| geo.TransformPoints(pt,pts) | ||
| b = pts.GetBounds() | ||
| xm,xM,ym,yM=b[:4] | ||
| if xm!=-numpy.inf: | ||
| Xrg2[0]=min(Xrg2[0],xm) | ||
| if xM!=numpy.inf: | ||
| Xrg2[1]=max(Xrg2[1],xM) | ||
| if ym!=-numpy.inf: | ||
| Yrg2[0]=min(Yrg2[0],ym) | ||
| if yM!=numpy.inf: | ||
| Yrg2[1]=max(Yrg2[1],yM) | ||
| Xrg=Xrg2 | ||
| Yrg=Yrg2 | ||
| wRatio = float(sc[0])/float(sc[1]) | ||
| dRatio = (Xrg[1]-Xrg[0])/(Yrg[1]-Yrg[0]) | ||
| vRatio = float(vp[1]-vp[0])/float(vp[3]-vp[2]) | ||
|
|
||
|
|
||
| if wRatio>1.: #landscape orientated window | ||
| yScale = 1. | ||
| xScale = vRatio*wRatio/dRatio | ||
| else: | ||
| xScale = 1. | ||
| yScale = dRatio/(vRatio*wRatio) | ||
| self._renderers[(vp,wc_used,sc)] = Renderer,xScale,yScale | ||
|
|
||
| T = vtk.vtkTransform() | ||
| T.Scale(xScale,yScale,1.) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to save this?