View previous topic :: View next topic |
Author |
Message |
walleye3313
Joined: 04 Jun 2005 Posts: 28
|
Posted: Mon Mar 27, 2006 5:29 pm Post subject: error message, need some help |
|
|
David,
i have gotten the following:
Error in CreateCompatibleBitmap=0x00000008, Size 802x616744
i suspect there is a size issue, can you fill me in on the error and any limitations that i need to work around?
thanks
jerry |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2311 Location: Vicksburg, Mississippi
|
Posted: Mon Mar 27, 2006 7:42 pm Post subject: |
|
|
Holy cow! Just when I think I've seen it all...
Do you really want a bitmap 616,744 pixels tall??? If so and you don't mind me asking, what in the world are you up to?
The error code 8 maps to "Not enough storage is available to process this command." Not a big surprise, as a bitmap that size on a 24-bit display requires 1,483,886,064 bytes (roughly 1.4 Gb). On NT4 the maximum size is 48Mb. I couldn't find any limitations on 2000 or XP (but didn't spend a lot of time looking). The problem is likely that you simply don't have enough memory. _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
walleye3313
Joined: 04 Jun 2005 Posts: 28
|
Posted: Mon Mar 27, 2006 8:33 pm Post subject: |
|
|
LOL,
i had a hunch it was something like that!
now i have an idea where to look in the code. i used the DPM to get the corners of the plot and then use the distance between the corners to size the bitmap. must be an error in the formula or something unexpected in the data, this data came from down near the equator and in the eastern hemisphere.
glad i could make you smile!
thanks
jerry |
|
Back to top |
|
|
walleye3313
Joined: 04 Jun 2005 Posts: 28
|
Posted: Mon Mar 27, 2006 8:49 pm Post subject: |
|
|
i don't see the problem, here is the code i'm using:
Code: | ' try to get the metrics without drawing the plot
If (hBitmap <> 0) Then
ret = DeleteObject(hBitmap)
hBitmap = 0
End If
If DocNum <> 0 Then
ret = DPlot_Command(DocNum, "[FileClose()]")
End If
DocNum = DPlot_Plot(d, 0&, Node(0, 0), cmds)
If (DocNum > 0) Then
DPM.SIZE = Len(DPM)
hBitmap = DPlot_GetBitmapEx(DocNum, 400, 400, DPM)
' NOTE: If we want to get Z values from the document (HasMetrics=3), we CANNOT close it.
' ret = DPlot_Command(DocNum, "[FileClose()]")
HasMetrics = 3 ' NOTE: This won't work for 3D, since we can't get X and Y from mouse position
End If
Debug.Print "DPM", DPM.xlo, DPM.ylo, DPM.xhi, DPM.yhi
'Stop
' end of try for metrics
Picture1.ScaleWidth = Abs(DPM.xhi - DPM.xlo) ' adjust this to make picture1 the right size
Picture1.ScaleHeight = Abs(DPM.yhi - DPM.ylo)
ret = GetClientRect(Picture1.hwnd, rcPic)
If (hBitmap <> 0) Then
ret = DeleteObject(hBitmap)
hBitmap = 0
End If
If DocNum <> 0 Then
ret = DPlot_Command(DocNum, "[FileClose()]")
End If
DocNum = DPlot_Plot(d, 0&, Node(0, 0), cmds)
If (DocNum > 0) Then
DPM.SIZE = Len(DPM)
hBitmap = DPlot_GetBitmapEx(DocNum, Picture1.ScaleWidth, Picture1.ScaleHeight, DPM)
' NOTE: If we want to get Z values from the document (HasMetrics=3), we CANNOT close it.
' ret = DPlot_Command(DocNum, "[FileClose()]")
HasMetrics = 3 ' NOTE: This won't work for 3D, since we can't get X and Y from mouse position
End If
Call Picture1_Paint |
if i toggle in a breakpoint at the line DPM.SIZE=Len(DPM) and i mouse over Picture1.ScaleWidth i get 41, and Picture1.ScaleHeight is 170. which seem like reasonable sizes for bitmaps. do you see anything that might be the problem?
the error hits on the line hBitmap= of course.
on the bright side it seem to work with all of the western hemisphere data i have used, maybe i need to start on an "eastern hemisphere edition"
thanks
jerry |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2311 Location: Vicksburg, Mississippi
|
Posted: Mon Mar 27, 2006 10:47 pm Post subject: |
|
|
I can't explain why you'd get this:
Quote: | if i toggle in a breakpoint at the line DPM.SIZE=Len(DPM) and i mouse over Picture1.ScaleWidth i get 41, and Picture1.ScaleHeight is 170. |
but this:
Quote: | Picture1.ScaleWidth = Abs(DPM.xhi - DPM.xlo)
Picture1.ScaleHeight = Abs(DPM.yhi - DPM.ylo) |
for sure isn't what you mean to do. Those values are in data space, not pixels. So depending on what you're plotting xhi-xlo might be much less than 1 or it might be 10 million. Instead you want hll, hur, vll, vur. Keep in mind that those are the pixel values of the corners of the plot, though - not the extents of the entire plot. So this still may not be quite what you have in mind. _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
walleye3313
Joined: 04 Jun 2005 Posts: 28
|
Posted: Tue Mar 28, 2006 10:20 am Post subject: |
|
|
Quote: | Keep in mind that those are the pixel values of the corners of the plot, though - not the extents of the entire plot. So this still may not be quite what you have in mind. |
i don't know what you mean by "not the extents of the entire plot." do you mean that it give the corners of the plot but not the entire bitmap? i just tried that out, yes the bitmap IS bigger than the plot! when i say plot i mean the actual portion of the plane that is being represented, rather than the bitmap.
what i am trying to do is request a plot of the right size (in pixels) so that when i display the plot on the screen:
1. i know the scale of the bitmap (in meters per pixel) the fact that the bitmap is bigger than the plotted area will not matter because it is all colored white and so it will be ignored
2. i know the coordinates of the upper left pixel, or some other pixel, so that i can scan the pixels and know "where" i am at on the plane.
3. the scale for x is the same as the scale for y such as provided by [ContourScales(1,1,1)]
Quote: | Keep in mind that those are the pixel values of the corners of the plot |
what do you mean by pixel values? would hll tell me how many pixels in from the left edge of the bitmap the lower left corner of the plot is and similarly for the rest? if so that will allow me to get a scale of the bitmap and i can re-scale it to give the resolution i need for the output.
i don't think we have figured out where the error came from, but i'm not worried about the error anymore because i don't think i have the scale right just yet.
thanks
jerry |
|
Back to top |
|
|
walleye3313
Joined: 04 Jun 2005 Posts: 28
|
Posted: Tue Mar 28, 2006 10:28 am Post subject: |
|
|
Ok, i posted that so you could read what some of my thinking has been.
so if i use the hll, vll etc, to determine the pixel locations of the corners of the plot then is there a way to get the x and y values of the same corners? (or can i force them to be some x and y values that i want by using [ManualScale(xlo,ylo,xhi,yhi |,zlo,zhi | )] so that i can then match up the pixel locations to x,y pairs and scale from there, I THINK THAT MAY BE THE ANSWER!)
if so then i can determine the scale of the plot and resize as needed to give me ~1 meter per pixel and to get the ocordinates of each pixel. i do see that the bitmap is larger than the plot but that won't be an issue in terms of final data because the hll, etc. will allow me to be sure not to look outside of the actual plot.
thanks for rabling through this with me.
jerry
edit:
suppose i do this:
call the plot once to get the DPM.xhi, etc.
then replot using [ManualScale(DPM.xlo,DPM.ylo,DPM.xhi,DPM.yhi )]
i should then get a plot where the lower left corner coordinates in pixels (hll,vll) is the location of (DPM.xlo,DPM.ylo) and likewise for the upper left. and i can scale from there for any pixel. i could also then determine the scale in meters per pixel using [(DPM.xhi-DPM.xlo)/(hur-hll)]. |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2311 Location: Vicksburg, Mississippi
|
Posted: Tue Mar 28, 2006 11:09 am Post subject: |
|
|
While you can do this:
Quote: | suppose i do this:
call the plot once to get the DPM.xhi, etc.
then replot using [ManualScale(DPM.xlo,DPM.ylo,DPM.xhi,DPM.yhi )] |
... it shouldn't be necessary. You're setting the corner coordinates to their current values. No change, in other words.
Only that's not always quite right because we're talking two different devices. So nevermind. Yes, that will work.
Quote: | i could also then determine the scale in meters per pixel using [(DPM.xhi-DPM.xlo)/(hur-hll)]. |
I know you know, but just so somebody else doesn't read this and get the wrong idea: the above is true because your X and Y values are in meters. _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
walleye3313
Joined: 04 Jun 2005 Posts: 28
|
Posted: Tue Mar 28, 2006 12:11 pm Post subject: |
|
|
Maybe I finally get it, sometimes i need things to be painfully obvious,
I'll play around with this some more and see what happens, i'l try using the metrics to scale and see of the results are what i expect.
thanks again,
jerry |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|