几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】rendering On Existing Mfc Device Conte (http://www.dimcax.com/hust/showthread.php?t=18422)

yang686526 2009-05-07 02:57 PM

【转帖】rendering On Existing Mfc Device Conte
 
rendering on existing mfc device context

rendering on existing mfc device context
hi,
i say that i'm a newbie...
i need to render a dwg file in an mfc application on an mfv view.
the problem is that the application is existing and the dwg rendering engine is a plugin, than i cannot change view type subclassing it from a dwgdirect view class.
all i need is to know to which dwgdirect class have to pass my actual dc to render the file...
i hope to have been clear....
thank you in advance
walter

myzhar
# 3rd february 2006, 07:27 am

moderator join date: mar 2002
posts: 2,994
you can pass dc to wingdi device via its properties.
the device (and their properties) usage is illustrated in odamfcapp sample.
sergey slezkin

sslezkin
# 3rd february 2006, 07:59 am

registered user join date: feb 2006
location: pisa
posts: 69


ok, i read all the code of the example and of the device and i noticed that drawing is done using win32 commands (lineto, polygon, ecc).
the thing i want to know is if there is a way to render without using win32...

myzhar
# 3rd february 2006, 08:08 am

softdev join date: jun 2002
location: st'petersburg, russia
posts: 522

yes, there is a way to render without using win32.
see odvectorizeex sample.
sincerely yours,
george udov

george udov
# 3rd february 2006, 08:42 am

registered user join date: feb 2006
location: pisa
posts: 69


in example odvectorizeex (if i'm not wrong) a simple "string output device" is created, ok?
i noticed that al the drawing procedures are created like output streaming.
the example can be very useful to understand device creation
than the focus point of my question:
are there graphic rendering function in dwgdesign library?
excuse all these question, but i began working with library since 2 days and initial doubts are a lot
thank you again
walter

myzhar
# 6th february 2006, 03:54 am

softdev join date: jun 2002
location: st'petersburg, russia
posts: 522

could you, please, describe your problem with more details?
1. do you need to use dwgdirect rendering in mfc application, or in non-win32 application? note, that mfc is just a wrapper around win32 api.
2. "i cannot change view type subclassing it from a dwgdirect view class" - i cannot understand this. odamfcapp sample is mfc application that uses dwgdirect rendering - it does it with success. what is your problem?
sincerely yours,
george udov

george udov
# 6th february 2006, 04:19 am

registered user join date: feb 2006
location: pisa
posts: 69

sorry for my english
1) my application is mfc, but i would understand if dwglibrary has is own drawing routine such to use them on an existing image.
2) my problem is that i cannot create a new mfc view derivating it from dwgdirect class because i'm creating a plug in and rendering view just exists.
at the end all i need is a way to render on an existing image using existing dwgdirect routines...
i hope my explaination is better...
thank you
walter

myzhar
# 6th february 2006, 04:23 am

softdev join date: jun 2002
location: st'petersburg, russia
posts: 522

then question is - what is "existing image"?
do you have existing hdc?
sincerely yours,
george udov

george udov
# 6th february 2006, 04:57 am

registered user join date: feb 2006
location: pisa
posts: 69

i can write directly on existing hdc or on a bitmap that is then copied on hdc.
there is no difference. the problem is only understand which method is better.

myzhar
# 6th february 2006, 05:05 am

softdev join date: jun 2002
location: st'petersburg, russia
posts: 522

then you should create wingdi odgsdevice object, call setuplayoutviews, propagate your hdc to this odgsdevice, and then call odgsdevice::update().
if clearing your image by odgsdevice::update() before rendering dwg is not an issue for you, then you can use winopengl renderer.
if you does have hwnd for rendering window, then you also can use windirectx renderer.
sincerely yours,
george udov

george udov
# 6th february 2006, 05:14 am

registered user join date: feb 2006
location: pisa
posts: 69

ok, then if i have an existing background image the better method is to use wiggdi odgsdevice object and propagate my hdc.
do you think that looking for wingdi code added to odamfcapp would be a good method to learn how to do this?
which are the basic steps?
thank you a lot again
walter

myzhar
# 6th february 2006, 06:18 am

softdev join date: jun 2002
location: st'petersburg, russia
posts: 522

method cdwgviewer::createdevice() (dwgviewer.cpp) solves same task. it creates odgsdevice, then propagates there existing hdc, then calls setupactivelayoutviews().
after this, you can call m_pdevice->update(). it will render the drawing onto existing hdc that you propagated.
sincerely yours,
george udov

george udov
# 6th february 2006, 06:41 am

registered user join date: feb 2006
location: pisa
posts: 69

quote:
originally posted by george udov
method cdwgviewer::createdevice() (dwgviewer.cpp) solves same task.
i'm trying to see how it works, but i cannot link odamfcapp... in every configuration i get an unresolved external on odrxmodule that i cannot resolve...
do you know which library file includes it?
myzhar
==============
ing. walter lucetti
geomind srl
pisa - italy
==============

myzhar
# 6th february 2006, 07:09 am

registered user join date: feb 2006
location: pisa
posts: 69

i resolved all unresolved external but this:
odamfcapp error lnk2001: unresolved external symbol "class odrxmodule * __cdecl odrxcreatemoduleobject_for_bitmapmodule(char const *)" (?odrxcreatemoduleobject_for_bitmapmodule@@yapavod rxmodule@@pbd@z)
i don't find the library related with that
myzhar
==============
ing. walter lucetti
geomind srl
pisa - italy
==============

myzhar
# 6th february 2006, 08:06 am

registered user join date: feb 2006
location: pisa
posts: 69

ok, i solved the problem...
i missed winbitmap lib.
now i hope to be able to use wingdi
thank you for all help
greetings,
myzhar
==============
ing. walter lucetti
geomind srl
pisa - italy
==============

myzhar
page 1 of 21

none
? | ?
thread tools



display modes
linear mode


search this thread

rate this thread
excellent
good
average
bad
terrible

posting rules
you may post new threads
you may post replies
you may post attachments
you may edit your posts
is on
are on
code is off
html code is off
forum jump
user control panel private messages subscriptions who's online search forums forums home general topics news questions and remarks business issues industry commentary general software issues documentation issues future directions dwg libraries dwgdirect.net dwgdirect, c++ version dwgdirectx, activex version adtdirect/c3ddirect opendwg toolkit/viewkit dgn libraries dgndirect, c++ version (2.x+) dgndirect libraries (legacy 0.99xx)
all times are gmt -7. the time now is 11:35 pmfff">.
- - -
copyright ?2000 - 2009, jelsoft enterprises ltd.
copyright 1998-2008 open design alliance inc.
you can pass dc to wingdi device via its properties.
the device (and their properties) usage is illustrated in odamfcapp sample.
sergey slezkin


ok, i read all the code of the example and of the device and i noticed that drawing is done using win32 commands (lineto, polygon, ecc).
the thing i want to know is if there is a way to render without using win32...

yes, there is a way to render without using win32.
see odvectorizeex sample.
sincerely yours,
george udov


in example odvectorizeex (if i'm not wrong) a simple "string output device" is created, ok?
i noticed that al the drawing procedures are created like output streaming.
the example can be very useful to understand device creation
than the focus point of my question:
are there graphic rendering function in dwgdesign library?
excuse all these question, but i began working with library since 2 days and initial doubts are a lot
thank you again
walter

could you, please, describe your problem with more details?
1. do you need to use dwgdirect rendering in mfc application, or in non-win32 application? note, that mfc is just a wrapper around win32 api.
2. "i cannot change view type subclassing it from a dwgdirect view class" - i cannot understand this. odamfcapp sample is mfc application that uses dwgdirect rendering - it does it with success. what is your problem?
sincerely yours,
george udov

sorry for my english
1) my application is mfc, but i would understand if dwglibrary has is own drawing routine such to use them on an existing image.
2) my problem is that i cannot create a new mfc view derivating it from dwgdirect class because i'm creating a plug in and rendering view just exists.
at the end all i need is a way to render on an existing image using existing dwgdirect routines...
i hope my explaination is better...
thank you
walter

then question is - what is "existing image"?
do you have existing hdc?
sincerely yours,
george udov

i can write directly on existing hdc or on a bitmap that is then copied on hdc.
there is no difference. the problem is only understand which method is better.

then you should create wingdi odgsdevice object, call setuplayoutviews, propagate your hdc to this odgsdevice, and then call odgsdevice::update().
if clearing your image by odgsdevice::update() before rendering dwg is not an issue for you, then you can use winopengl renderer.
if you does have hwnd for rendering window, then you also can use windirectx renderer.
sincerely yours,
george udov

ok, then if i have an existing background image the better method is to use wiggdi odgsdevice object and propagate my hdc.
do you think that looking for wingdi code added to odamfcapp would be a good method to learn how to do this?
which are the basic steps?
thank you a lot again
walter

method cdwgviewer::createdevice() (dwgviewer.cpp) solves same task. it creates odgsdevice, then propagates there existing hdc, then calls setupactivelayoutviews().
after this, you can call m_pdevice->update(). it will render the drawing onto existing hdc that you propagated.
sincerely yours,
george udov

quote:
originally posted by george udov
method cdwgviewer::createdevice() (dwgviewer.cpp) solves same task.
i'm trying to see how it works, but i cannot link odamfcapp... in every configuration i get an unresolved external on odrxmodule that i cannot resolve...
do you know which library file includes it?
myzhar
==============
ing. walter lucetti
geomind srl
pisa - italy
==============

i resolved all unresolved external but this:
odamfcapp error lnk2001: unresolved external symbol "class odrxmodule * __cdecl odrxcreatemoduleobject_for_bitmapmodule(char const *)" (?odrxcreatemoduleobject_for_bitmapmodule@@yapavod rxmodule@@pbd@z)
i don't find the library related with that
myzhar
==============
ing. walter lucetti
geomind srl
pisa - italy
==============

ok, i solved the problem...
i missed winbitmap lib.
now i hope to be able to use wingdi
thank you for all help
greetings,
myzhar
==============
ing. walter lucetti
geomind srl
pisa - italy
==============


所有的时间均为北京时间。 现在的时间是 04:25 PM.