<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — Translate CVF graphics to Simply Fortran]]></title>
	<link rel="self" href="http://forums.approximatrix.com/extern.php?action=feed&amp;tid=466&amp;type=atom" />
	<updated>2015-05-26T11:29:43Z</updated>
	<generator>PunBB</generator>
	<id>http://forums.approximatrix.com/viewtopic.php?id=466</id>
		<entry>
			<title type="html"><![CDATA[Re: Translate CVF graphics to Simply Fortran]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=2094#p2094" />
			<content type="html"><![CDATA[<p>Hello Jeff,<br />The problem is allready solved, but I don&#039;t know which code was not correct and after many alterations I cannot trace it back. may be I had some bad declarations....</p><p>Below is the code of my (prelininary) translater from CVF to SF containing move_to and line_to for your info.</p><p>The call to move _to and line_to as described before is done in several routines; for instance in the following:</p><p>Subroutine draw3D_cube(p, maxpnts)<br />use appgraphics <br />Use W_ords_to_pixels<br />Dimension p(maxpnts,3)<br />!.....<br />.....<br />In the first versions I wrote: <br />Call&nbsp; Moveto_w(dble(p(i,1)),dble(p(i,2))), wxy)<br />It did not work and I used:<br />Call&nbsp; Moveto_w(xw,yw,wxy)<br /> ......<br />Now in a new test the first statement works - so the problem is solved.<br />I am more and more contented with SF2 and will recommend it anywhere!<br />Regards, Klaus</p><br /><p>PS<br />For your info the translate module <br />Module W_ords_to_pixels<br />&nbsp; &nbsp; Use AppGraphics<br /> Real*8 xw,xwtot, scale_x<br /> Real*8 yw,ywtot, scale_y<br /> Integer dx,dy, x_offset, y_offset<br /> TYPE wxycoord<br />&nbsp; &nbsp; &nbsp; Real*8 x<br />&nbsp; &nbsp; &nbsp; Real*8 y<br /> end type wxycoord<br /> TYPE (wxycoord)wxy</p><p>contains </p><p>!!!!! ===================== warning ==============================!!!!! a <br />! The pixel window to show graphics has to be opened prior to apply this function !!!!!<br />Function setwindow (origin , x_left, y_up, x_rght, y_bot)&nbsp; &nbsp; ! same as CVF but little changed functionallity!!<br />! i2&nbsp; &nbsp;= setwindow (.TRUE.&nbsp; &nbsp;, x_left, y_up, x_rght, y_bot)&nbsp; ! make this work in module<br />&nbsp; &nbsp; &nbsp; &nbsp; ! make returnvalue =1 if OK, otherwise 0<br />! In this this function a world coordinate system y from top down is not defined and has to return zero (diff from CVF)<br /> integer setwindow<br /> logical origin&nbsp; &nbsp; &nbsp;! to be true for lower left corner and y up warts<br /> Real*8 x_left, y_up, x_rght, y_bot !virtual world corners of the viewport<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ! If negative lower left corner there is an offset to the origin xw,yw = 0.,0.<br /> Real*8 dxw, dyw&nbsp; &nbsp; ! absolute &quot;world&quot;dimensions in xy direction<br /> integer dx, dy<br /> setwindow = 0</p><p>! the window size in world ordinates is defined by the arguments of this routine!!!!!!!!!!!!!!!!!!<br />dxw = x_rght - x_left<br />dyw = y_up - y_bot<br />If(dwx == 0. .or. dwy == 0.)return<br />If( .not. origin) return</p><p>! get the pre-defiened window size of the CURRENT window in pixels x,y may be the max screen or lower defined <br /> dx = getmaxx()<br /> dy = getmaxy()</p><br /><p>IF(dx &gt; 0 .and. dy &gt; 0 )then<br />&nbsp; &nbsp; ! only works in a predefined actual window!<br />&nbsp; &nbsp; &nbsp;xwtot = dxw&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;!&nbsp; May ..tot should be replaced by&nbsp; ..w !!!<br />&nbsp; &nbsp; &nbsp;scale_x = dble(dx)/dxw<br />&nbsp; &nbsp; &nbsp;x_offset= -int(x_left*scale_x)<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp;ywtot = dyw<br />&nbsp; &nbsp; &nbsp;scale_y = dble(dy)/dyw<br />&nbsp; &nbsp; &nbsp;y_offset= -int(y_bot*scale_y)<br />!&nbsp; End subroutine init_world_window<br />setwindow =1 ! does not work with origin in top left<br />End if<br />End function setwindow</p><br /><p>&nbsp; Subroutine Moveto_w(xw,yw,wxy)<br /> !&nbsp; &nbsp;Use W_ords_to_pixels<br />!&nbsp; &nbsp; Use AppGraphics<br />&nbsp; &nbsp; Integer x,y&nbsp; <br />&nbsp; &nbsp; Real*8 xw,yw<br />&nbsp; &nbsp; TYPE (wxycoord)wxy<br />&nbsp; &nbsp; wxy%x = xw<br />&nbsp; &nbsp; wxy%y = yw<br />&nbsp; &nbsp; x= int((xw)*scale_x) + x_offset<br />&nbsp; &nbsp; y= int((ywtot- yw)*scale_y) - y_offset<br />&nbsp; &nbsp; Call moveto (x, y)<br />&nbsp; &nbsp; Call settextxy (x, y)&nbsp; &nbsp; &nbsp; &nbsp;! this is because CVF has no different textpos for outgtext<br />&nbsp; end subroutine Moveto_w<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; <br />&nbsp; Function lineto_w(xw,yw)<br />&nbsp; !&nbsp; Use W_ords_to_pixels<br />&nbsp; &nbsp; Integer x,y <br />&nbsp; &nbsp; Real*8 xw,yw<br />!&nbsp; &nbsp; TYPE (wxycoord)wxy ! neccessary to keep the end point in wxy?? Don&#039;t thinck so !!! <br />!&nbsp; &nbsp; wxy%x = xw<br />!&nbsp; &nbsp; wxy%y = yw<br />&nbsp; &nbsp; lineto_w = 0&nbsp; &nbsp;<br />&nbsp; &nbsp; x= int((xw)*scale_x)&nbsp; + x_offset<br />&nbsp; &nbsp; y= int((ywtot- yw)*scale_y) - y_offset<br />&nbsp; &nbsp; Call lineto (x, y)<br />&nbsp; &nbsp; lineto_w = 1&nbsp; &nbsp;<br />&nbsp; End function lineto_w<br />&nbsp; <br />!++++++++++++++++++++++++++++++++++++++++++++++++++++=<br />! still to do:<br />! Add procedures for all other used graphic function using world coordinates also for graph. text<br />&nbsp; &nbsp; <br />End module W_ords_to_pixels</p>]]></content>
			<author>
				<name><![CDATA[Klaus Asmus]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=3617</uri>
			</author>
			<updated>2015-05-26T11:29:43Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=2094#p2094</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Translate CVF graphics to Simply Fortran]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=2089#p2089" />
			<content type="html"><![CDATA[<p>Klaus,</p><p>I&#039;m not sure I understand you question exactly. Could you also post the code used to implement the <em>lineto_w</em> function so I could compare it to the <em>moveto_w</em> subroutine.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2015-05-22T00:29:52Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=2089#p2089</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Translate CVF graphics to Simply Fortran]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=2088#p2088" />
			<content type="html"><![CDATA[<p>Hello Jeff,<br />Thanks for your code to translate dimensions to pixels prior to use graphics. It&#039;s a good idea to use it for all new code. My proposed solution only is applicable to let CVF source work asap without many changes. <br />However..... my impression is that GNU Fortran accepts less language variation than Compac Fortran. In general it&#039;s better to use the exact standard instead of a individual programming style!<br />It&#039;s a great benefit that Simply Fortran is helping already while typing the code!<br />And from this there rises a new question regarding your above mentioned call line which contains the functions as arguments<br />In the following example <br />Do i = 1,3<br />&nbsp; &nbsp; xw = p(i,1); yw = p(i,2)<br />&nbsp; &nbsp; Call&nbsp; Moveto_w(xw,yw,wxy)&nbsp; &nbsp;!(dble(p(i,1)),dble(p(i,2))), wxy)<br />&nbsp; &nbsp; ii = lineto_w(dble(p(i+5,1)),dble(p(i+5,2)))<br />end do<br />Moveto_w does not accept functions but lineto_w does accept! It was directly shown by typing the statement.<br />Why? Wat happend?<br />By the way, the CVF combination Moveto prior to lineto is because CVF is missing the line between two points</p><p>I&#039;ll be from tomorrow some days out of office,<br />Regards Klaus</p>]]></content>
			<author>
				<name><![CDATA[Klaus Asmus]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=3617</uri>
			</author>
			<updated>2015-05-20T20:03:33Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=2088#p2088</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Translate CVF graphics to Simply Fortran]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=2086#p2086" />
			<content type="html"><![CDATA[<p>Klaus,</p><p>That&#039;s a great bit of code!&nbsp; Having to do it for all the shapes might be hard, but perhaps you could have some functions to handle such things:</p><div class="codebox"><pre><code>! Translate x coordinates
pure function tr_x(wxy) result x
   implicit none
   type(wxycoord), intent(in)::wxy
   integer::x
   x = int(wxy%x*scale_x)+x_offset
end function tr_x

! Translate y coordinates
pure function tr_y(wxy) result y
   implicit none
   type(wxycoord), intent(in)::wxy
   integer::y
   y = int(wxy%y*scale_y)+y_offset
end function tr_y</code></pre></div><p>I apologize if there&#039;s a syntax error above. I didn&#039;t actually test the functions.</p><p>With the above, though, you could do something like:</p><div class="codebox"><pre><code>call line(tr_x(p1), tr_y(p1), tr_x(p2), tr_y(p2))</code></pre></div><p>And it might allow you to avoid having to write a new wrapper subroutine for each and every drawing operation.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2015-05-19T20:39:23Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=2086#p2086</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Translate CVF graphics to Simply Fortran]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=2084#p2084" />
			<content type="html"><![CDATA[<p>Hello Jeff,<br />I made a translate interface between CVF graphics so called&nbsp; &quot;world &quot;ordinates and pixel ordinates as used in AppGraphics. So for me there is no need to make it also in Appgraphics now.The interface makes it possible to use the same&nbsp; calls to graphics as in CVF:<br /> Subroutine Moveto_w(xw,yw,wxy) ! Name and arguments same as CVF<br /> !&nbsp; &nbsp;Use W_ords_to_pixels<br />!&nbsp; &nbsp; Use AppGraphics<br />&nbsp; &nbsp; Integer x,y&nbsp; <br />&nbsp; &nbsp; Real*8 xw,yw<br />&nbsp; &nbsp; TYPE (wxycoord)wxy<br />&nbsp; &nbsp; wxy%x = xw<br />&nbsp; &nbsp; wxy%y = yw<br />&nbsp; &nbsp; x= int((xw)*scale_x) + x_offset<br />&nbsp; &nbsp; y= int((ywtot- yw)*scale_y) - y_offset<br />&nbsp; &nbsp; Call moveto (x, y)<br />&nbsp; &nbsp; Call settextxy (x, y)&nbsp; &nbsp; &nbsp; &nbsp;! this is because CVF has no different textpos for outgtext<br />&nbsp; end subroutine Moveto_w</p><p>I am sure that it will save much time to convert all my software to Simply Fortran from CVF!<br />Still to do: a lot of other procedures like circles, arcs, ellipse, rectangles&nbsp; and so on.<br />But due to other activities a have to stop after some weeks with SF and may be I can restart end of august if there comes no other job....<br />Klaus</p>]]></content>
			<author>
				<name><![CDATA[Klaus Asmus]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=3617</uri>
			</author>
			<updated>2015-05-19T12:48:22Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=2084#p2084</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Translate CVF graphics to Simply Fortran]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=2073#p2073" />
			<content type="html"><![CDATA[<p>I am using CVF66 for many years and creates a lot of programs. CVF is no more working with windows &gt; XP and it became Intel Visual Fortran; but IVF is no option for me for many reasons. <br />I am lucky to have Simply Fortran with AppGraphics now but there is a little problem: AppGraphis is using pixel coordinates with the origin left up and my programs in CVF are using so called &quot;world&quot; coordinates with the origin left down. Further CVF routines, of course, looks different from Appgraphics (as well from any other graphic lib). <br />I decided (and just started) to build a module which is calling AppGraphics routines by the (nearly) unchanged old CVF graphics routines.&nbsp; I am sure that it will avoid a lot of work translating all the CVF graphics in stead of rewriting statement by statement!<br />Are there more (ex-)CVF-users with the same problem?</p>]]></content>
			<author>
				<name><![CDATA[Klaus Asmus]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=3617</uri>
			</author>
			<updated>2015-05-15T09:19:27Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=2073#p2073</id>
		</entry>
</feed>
