Image Region

Image Region - ⛔ Extends SMath Studio with an Image Region. - Сообщения

#21 Опубликовано: 12.10.2013 10:49:50
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Wrote

Still there is another, more important issue: could you please interpret relative paths with respect to the directory of the current SMath document instead of the current directory? This would create portable documents and enable putting examples in the activebook help system.


I can't do that. More precisely, I don't know how to do it, because SMath Studio does not provide such information. That's why I added CurrentDirectory() function. There is another way to change the current folder. Open the document and then save it via the Save As option. In this case, SMath Studio will change the current path. The path must be changed when the file is opened, but it doesn't. You have to ask Andrey to implement this feature.
Russia ☭ forever, Viacheslav N. Mezentsev
#22 Опубликовано: 12.10.2013 11:25:11
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

I don't know, how Davide managed to do this, but the DataExchange plugin somehow manages to handle relative paths with respect to the current document (despite the help text mentioning the current dir as default path).

In the attached screen shot you see a document, where a formula is exported using a relative path. The file is created in the directory of the currently open SMath document, even if that is not the current system directory (as can be seen in the CurrentDirectory() output).

May be the approach is not available for custom regions. Then a separate function like "DocumentDirectory()" would help, just as the function "SettingsDirectory()" from CustomFunctions, which is used to build the hyperlink targets in the activebook plugin index.
dir.PNG
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 пользователям понравился этот пост
#23 Опубликовано: 12.10.2013 12:37:25
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Updated. Thank you, Martin. I have looked how he does it. SMath Studio explicitly transmits information about the path of the currently opened document (store.FileName), but it is available only at the time of its evaluation.
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Martin Kraska 12.10.2013 12:50:00
#24 Опубликовано: 12.10.2013 12:51:59
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

Wrote

... but it is available only at the time of its evaluation.


Great, thanks. Seems to work. However, I do not understand what limitation is implied by your statement.

Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#25 Опубликовано: 12.10.2013 17:32:48
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

Would it be possible to size the region according to the image size? Perhaps as an option.

I'd also propose to provide sort of image scaling and clipping, with mouse interaction consistent to the xy plot region, i.e.
- zoom by mouse wheel
- move by dragging the image
- resize by dragging the boundary resizing markers
- double click to reset to default (according to feature request above)
This might be sensible only for display of images from files.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#26 Опубликовано: 13.10.2013 00:50:24
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Wrote

Wrote

... but it is available only at the time of its evaluation.


Great, thanks. Seems to work. However, I do not understand what limitation is implied by your statement.


This was remark for developers.

Wrote

Would it be possible to size the region according to the image size? Perhaps as an option.

I'd also propose to provide sort of image scaling and clipping, with mouse interaction consistent to the xy plot region, i.e.
- zoom by mouse wheel
- move by dragging the image
- resize by dragging the boundary resizing markers
- double click to reset to default (according to feature request above)
This might be sensible only for display of images from files.


Ok, I'll think about it too. As for svg images, you can change the size of this type of images, but only if the dimensions are not specified in the file. Try these svg-files.
svg.zip (5 КиБ) скачан 67 раз(а).
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Radovan Omorjan 13.10.2013 03:02:00
#27 Опубликовано: 13.10.2013 03:14:46
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

I tried your svg pictures uni. You are right, they can be resized but keeping their aspect ratio.
I suppose there is not a way to respect their aspect ratio by dragging the resizing either of the dragging markers (just asking). Actually, we can make it fit - if we want - by dragging the individual markers separately.

Regards,
Radovan
svgimages.png
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#28 Опубликовано: 13.10.2013 05:51:21
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

Wrote

As for svg images, you can change the size of this type of images, but only if the dimensions are not specified in the file.


Thanks, this works. In my example, I just had to removing this: width="65.29mm" height="52.71mm"
svg.PNG
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#29 Опубликовано: 13.10.2013 08:22:58
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: Moderator

Wrote

Updated. Added support for svg.

[albumimg]318[/albumimg] [albumimg]319[/albumimg]



Great feature, thank you Viacheslav

If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#30 Опубликовано: 14.10.2013 10:48:24
sergio

sergio

115 сообщений из 329 понравились пользователям.

Группа: User


I tried the method suggested by Martin, It works fine with Jpgfdraw files (save as SVG) but not with Inkscape file (save as SVG or Pure SVG)
sergio
#31 Опубликовано: 25.01.2014 08:58:21
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

Is it possible, to evaluate the expression in the placeholder of the image region?

Then we would have a neat way to display Maxima generated images using the Draw2D() and Draw3D() functions as described here.

These functions return the file name of the generated image.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#32 Опубликовано: 05.02.2014 09:11:13
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

There is an svg rendering problem in the image region. The attached file displays differently in TpX, IE and SMath/Image region. Look at the rightmost line in the diagrams. The only correct rendering is by TpX. Of course, I cannot guarantee that gnuplot produces correct svg code. The gnuplot input files produced by Maxima are correct.
gnuplot_input.zip (1 КиБ) скачан 57 раз(а).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#33 Опубликовано: 05.02.2014 11:01:06
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello Martin,

Hmm...I might missed something, but I can not see the plots in the SMath "Diffusion.sm" file. I expected to see them (as usual) but the regions are empty and the *.svg files are not in the active directory (dir variable). See the picture and the log file please.

Regards,
Radovan

EDIT: Strange , I managed somehow to get those bargraphs - right bars were decreseing ( by moveing dir:= ). On the third one I saw th problem at the end - but can not reproduce anymore. Still empty regions???
EDIT2: It seems that Maxima restart and few recalculations will bring the plots (second picture)
Diffusion-1.png
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#34 Опубликовано: 05.02.2014 12:05:53
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Updated. SMath Studio 0.96.5146 required.

h0.01 - if you remove this then you'll get the right result.

<g style="fill:none; color:red; stroke:currentColor; stroke-width:8.00; stroke-linecap:butt; stroke-linejoin:miter">
	<path stroke='rgb(  0,   0, 255)'  d='M41.9,126.0 L41.9,24.5 M54.4,126.0 L54.4,24.7 M66.8,126.0 L66.8,25.0 M79.3,126.0 L79.3,25.5 
		M91.7,126.0 L91.7,26.2 M104.2,126.0 L104.2,27.1 M116.6,126.0 L116.6,28.1 M129.1,126.0 L129.1,29.4 
		M141.5,126.0 L141.5,31.0 M154.0,126.0 L154.0,32.7 M166.4,126.0 L166.4,34.7 M178.8,126.0 L178.8,37.0 
		M191.3,126.0 L191.3,39.5 M203.7,126.0 L203.7,42.3 M216.2,126.0 L216.2,45.3 M228.6,126.0 L228.6,48.5 
		M241.1,126.0 L241.1,52.0 M253.5,126.0 L253.5,55.7 M266.0,126.0 L266.0,59.5 M278.4,126.0 L278.4,63.5 
		M290.9,126.0 L290.9,67.6 M303.3,126.0 L303.3,71.7 M315.8,126.0 L315.8,75.8 M328.2,126.0 L328.2,80.0 
		M340.7,126.0 L340.7,84.1 M353.1,126.0 L353.1,88.0 M365.6,126.0 L365.6,91.9 M378.0,126.0 L378.0,95.5 
		M390.5,126.0 L390.5,99.0 M402.9,126.0 L402.9,102.3 M415.4,126.0 L415.4,105.3 M427.8,126.0 L427.8,108.0 
		M440.3,126.0 L440.3,110.6 M452.7,126.0 L452.7,112.8 M465.1,126.0 L465.1,114.8 M477.6,126.0 L477.6,116.6 
		M490.0,126.0 L490.0,118.1 M502.5,126.0 L502.5,119.4 M514.9,126.0 L514.9,120.5 M527.4,126.0 L527.4,121.4 
		M539.8,126.0 L539.8,122.0 M552.3,126.0 L552.3,122.6 M564.7,126.0 L564.7,122.9 M577.2,126.0 L577.2,123.0 
		 '/></g>

P.S. Now the background is not removed.
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Martin Kraska 05.02.2014 12:33:00
#35 Опубликовано: 05.02.2014 12:28:18
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

There might be some issues which I did not yet mention.

1. this all applies to SMath 0.96.4909, as the image region is (was) not yet available for the new build (updated Maxima is available on SVN, but still in testing)
2. There might be a timing/robustness issue, it is a bit risky to use identical file names for different plots in the sheet. I changed the sheet such that you get different file names. The images should be produced upon opening or recalculating the sheet.

@uni: Thanks for the update. I confirm that removing h0.01 from wherever in the svg file mitigates the problem (in the old and in the new ImageRegion version). What does h0.01 say? Perhaps that can be avoided by particular plot settings? Just like with the scaling, where it proved possible to get scalable svgs without regexping the svg file.
Another question: Is that a gnuplot bug which I should report there or is this a problem of the image region (and of the IE)?
diffusion.PNG
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#36 Опубликовано: 05.02.2014 12:45:18
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Цитата

What does h0.01 say?



8.3.4 The "lineto" commands

Perhaps this is a bug in the SharpVectors library that I use.
Russia ☭ forever, Viacheslav N. Mezentsev
#37 Опубликовано: 05.02.2014 13:06:15
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

Wrote

Perhaps this is a bug in the SharpVectors library that I use.



I do not know why gnuplot draws a very short horizontal line at the top of the last blue vertical bar. This might be a bug but should essentially be invisible with butt line ends.
The IE rendering and the image region show this horizontal line much too long.
On top of this, the image region somehow wrongly joines the horizontal and the vertical line.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#38 Опубликовано: 05.02.2014 13:33:05
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

I asked a question on the support forum: Is this a bug?
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Davide Carpi 05.02.2014 14:50:00
#39 Опубликовано: 05.02.2014 14:45:29
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: Moderator

Wrote

Another question: Is that a gnuplot bug which I should report there or is this a problem of the image region (and of the IE)?


I've noticed the same issues both in chrome and firefox... so, is a bug in the image or in all the major browers :-p
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#40 Опубликовано: 05.02.2014 17:22:32
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: Moderator

Here is my post to a gnuplot forum.

EDIT: and here is the response, saying that the horizontal line was a fix for viewer problems in the past but should not be visible. There is no fast way to fix the problem.


There are some posts in the group, saying that most viewers render svg wrongly, but that would be no reason to modify the svg export, as it is the fault of the viewers.



Alternativly, Maxima/Gnuplot could export eps or pdf. Uni, if you can display that in a scalable way, then I could possibly switch to that terminal. I attached two corresponding files (had to zip the eps, because such attachments are not allowed in the forum)
myfile.zip (4 КиБ) скачан 55 раз(а).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений