by abenedik
13. October 2009 23:13
The Ab3d.PowerToys library is a collection of classes and utilities that simplify programming with 3D in WPF. With Ab3d.PowerToys programming with 3D was never easier!
The following are the main parts of the library:
- Cameras
- Camera Controllers
- Mouse Event Manager 3D
The library defines a few new Cameras that can be used instead of the current WPF's cameras. The main difference between Ab3d Cameras and WPF cameras is that Ab3d Cameras does not use Vectors to define the LookDirection, but instead use angles in degrees to define it. This is much more natural. For example if you want to look at the scene a little bit from the right and from above, you just define the Heading to be 30 and Attitude to be -45. You can also define the Distance from the scene. The most important Ab3d Cameras are: SceneCamera, FirstPersonCamera and ThirdPersonCamera. All the Ab3d Cameras with their properties can be seen on the class diagram.
Camera Controllers are used to control the camera. The MouseCameraController can be used to change the angle and distance of the camera with the mouse. This way it is very simple to rotate the camera around. The CameraControlPanel shows nice buttons to rotate the camera and move the camera closer or farther away. There is also a CameraPreviewPanel that graphically shows at which angle the camera is looking at the object or scene.
The following code demonstarates that with only a few lines of xaml a WPF application can use a camera that is showing the whole scene (SceneCamera) and can be rotated by the mouse (MouseCameraController) or by nice buttons (CameraControlPanel). There is also a preview of the camera that is showing from which angle the camera is looking at the scene. Also if the WindGeneratorModel model does not contain a light, a camera light is automatically added to the scene and it is iluminating the scene from the camera's position (ShowCameraLight="Auto").
<Window x:Class="Ab3d.PowerToys.Samples.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cameras="clr-namespace:Ab3d.Cameras;assembly=Ab3d.PowerToys"
xmlns:ab3d="clr-namespace:Ab3d.Controls;assembly=Ab3d.PowerToys">
<Grid>
<Viewport3D Name="MainViewport3D">
<ModelVisual3D Content="{StaticResource WindGeneratorModel}"/>
</Viewport3D>
<cameras:SceneCamera Name="SceneCamera1"
Heading="30"
Attitude="-30"
Distance="3" IsDistancePercent="True"
IsDynamicTarget="True"
ShowCameraLight="Auto"/>
<ab3d:MouseCameraController TargetCameraName="SceneCamera1"
IsMouseWheelZoomEnabled="True"/>
<ab3d:CameraControlPanel TargetCameraName="SceneCamera1"
VerticalAlignment="Bottom"
HorizontalAlignment="Left"/>
<ab3d:CameraPreviewPanel TargetCameraName="SceneCamera1"
Width="100" Height="100"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"/>
</Grid>
</Window>
The EventManager3D class is a helper class that enables user to simply subscribe to mouse events on 3D objects. The following mouse events are supported: MouseEnter, MouseLeave, MouseDown, MouseUp, MouseClick, BeginMouseDrag, MouseDrag, EndMouseDrag (MouseDoubleClick is not in available in beta). This way you do not need to do the complicated 3D hit testing any more. You can simply subscribe to mouse events. This way you the code is much simpler and better organized.
The following code shows a sample used of EventManager3D:
EventSource3D eventSource;
EventManager3D eventManager;
eventManager = new EventManager3D(MainViewport);
eventSource = new EventSource3D();
eventSource.TargetObject = myButton3D;
eventSource.MouseClick += new MouseButton3DEventHandler(myButton3D_MouseClick);
eventManager.RegisterEventSource3D(eventSource);
eventSource = new EventSource3D();
eventSource.TargetObject = myMovableObject3D;
eventSource.BeginMouseDrag += new Mouse3DEventHandler(myMovableObject3D_BeginMouseDrag);
eventSource.MouseDrag += new MouseDrag3DEventHandler(myMovableObject3D_MouseDrag);
eventSource.EndMouseDrag += new Mouse3DEventHandler(myMovableObject3D_EndMouseDrag);
eventManager.RegisterEventSource3D(eventSource);
Beta notice:
The current version of Ab3d.PowerToys is in beta. That means that it is not yet features complete and not fully tested.
Roadmap:
- Beta 1 - 13th October 2009
- Beta 2 - end of October 2009
- Release Candidate - middle of November 2009
- Release - start of December 2009
The Ab3d.PowerToys beta 1 and the samples can be downloaded from my Downloads page.
by abenedik
22. September 2009 04:17
To make the ZoomPanel control even better a few methods were added to the new version:
FitToWidth, FitToLimitsWidth, FitToHeight, FitToLimitsHeight.
The methods can be very usefull when the ZoomPanel is used to show the documents. The new methods are demonstrated in the improved version of Documents Brower sample (see image below).
The new version v2.1.3551 can be downloaded from my Downloads page.
by abenedik
14. September 2009 22:55
The ZoomPanel control has been improved to work correctly with Wpf Browser applications running in Internet Zone.
The cause of the problem was a real surprise - the Assembly.GetName() method requires FileIoPermissions - in Internet Zone this is not allowed :(
The new version v2.0.3544 can be downloaded from my Downloads page.
by abenedik
30. July 2009 21:02
I have just added two interesting Use case samples to ZoomPanel samples.
Besides Painter sample thare are now also Documents Browser and Image Browser samples.
Documents Browser sample shows how to create a WPF application to browser documents that were scaned or recieved by fax. The list of documents is read from Documents.xml file. The documents data are than binded to a ListBox and an Image control. The Image control is enclosed into a ZoomPanel to add zooming and panning support to the document browser.
Image Browser sample shows how to create a simple Image Browser application in WPF. The application also uses the ZoomPanel control to enable users to observe the details of the shown images.
Painter sample shows how simple is to add zooming and panning to a drawing application. The implemented zooming is same or even better as in some of the best professional drawing applications.
Also the Feedback page in the samples application is now fixed - it will not send your feedback to localhost any more :)
All the new samples are available with the ZoomPanel package that can be downloaded from my Downloads page.
If you already have the new ZoomPanel control and would just like to get the new samples, they can be downloaded here: ZoomPanelSamples.zip.
And one last note:
The price for the ZoomPanel is still only $69.00 for a single developer license. It is also possible to buy full source code of the library.
by abenedik
21. July 2009 17:50
The ZoomPanel control can add animated zooming and panning to any WPF application. With the new version many new features were added to make it the ultimate Zoom Panel control for every zooming scenario.
The following video shows how easy is to add professional zooming and panning to a sample drawing application.
Here is the complete list of new features:
- Added IScrollInfo support - possibility to use ZoomPanel inside ScrollViewer.
- Added posibility to limit the zoom area with ViewboxLimits, ViewboxMinSize and IsViewboxLimited properties.
- When animating images the scale quality is lowered to increase the frame rate.
- Added support for custom or dynamic zoom content - for example for showing maps - RegisterCustomContentProvider and UnregisterCustomContentProvider.
- Added a new ZoomPanel.SetViewboxNow method - the value is of Viewbox is immediately changed regardless of IsAnimated property.
- Added a new ZoomPanel.ResetNow method - immediate reset of viewbox.
- Added ResetToLimits and ResetToLimitsNow methods.
- Added PreviewViewboxChangedEvent and ViewboxChangedEvent - in PreviewViewboxChangedEvent subscriber can prevent or change the changed Viewbox.
- Added IsResetToLimits to ZoomController - if true the reset button on ZoomController resets the ZoomPanel to limits.
The samples that come with ZoomPanel have also been greatly improved. They demonstrate all the aspects of the controls and classes available with the library.
To make the use of the ZoomPanel even simpler the package also includes a detailed help file.
More about the new ZoomPanel can be seen on ZoomPanel page.
The new version can be downloaded from my Downloads page.
by abenedik
19. June 2009 20:33
The biggest improvement of the new Ab2d.ReaderSvg is added support for svg patterns. This feature has been requested by many users because svg patterns are commonly used by svg file created with Microsoft Visio. Another big improvement is support for complex strokes and pens - now also LinearGradientBrush, RadialGradientBrush, VisualBrush are supported.
Here is the whole list of changes:
- Added support for all types of svg patterns:
before only TexturePatterns were supported, now other types of patterns are supported as well. All patterns are now converted into VisualBrush.
NOTE: Silverlight does not support VisualBrush - Red brush is used instead.
- Added support for complex Strokes and Pens - before Strokes and Pens can be only SolidColorBrush. Now also other types of Brushes are supported (LinearGradientBrush, RadialGradientBrush, VisualBrush, etc.).
- Fixed using opacity on some svg elements.
- Improved support for RadialGradient when gradientTransform was used.
- Fixed getting the size of the root svg element when only width or only height is specified (when AutoSize is false).
- Fixed using Ab2d.ReaderSvg inside WinForms applications.
- Fixed licensing problems when used on 64-bit OS.
The new version can be downloaded from my Downloads page.
After downloading just install the new version over the previous version (no need to uninstall).
by abenedik
18. May 2009 20:32
Licensing model and prices are going to changes on 1st June 2009.
All the products except ZoomPanel will be divided into four types:
- Basic Viewer application license will provide basic converter application.
- Professional Viewer application license will provide fully featured converter application.
- Basic library license will contain the conversion library (Reader) with basic functionality that could be used in your own applications. The basic Viewer application will be also included.
- Professional library license will contain fully featured conversion library (Reader) that could be used in your own applications. The Professional Viewer application will be also included.
Examples:
If you will only need to convert a few svg files into xaml for your Silverlight application, you will choose Basic ViewerSvg Application for $79.00.
If you need to read dynamically generated svg files in your WPF application, also need to get object names defined in svg file and other advanced features, the Professional ReaderSvg library for $399.00 will be the best choice.
So the new licensing model is much more flexible. It will be possible to buy basic converter applications for much lower price and complete converter solution with library for higher price.
The preview of the new licensing model with detailed features information can be seen on the new purchase page.
Until the 1st June 2009, all the purchases can be still done on the current purchase page. On the 1st June 2009 the page will be upgraded to support new licensing model.
IMPORTANT NOTE:
The owners of the current licenses could still use all the features of the pro library license and could also get all the updated just as having the pro library license.
This means that if you need the pro library license, now it is the best time to buy the library because you will get the pro library features for much lower price. But if you only need a simple converter application, it is worth waiting until the 1st June.
Finally, I would also like to invite you to sign up to receive tweets from my Twitter profile for the latest news concerning tools and libraries on www.ab4d.com.
d2219c85-2e48-4abb-9db0-9a0865e70572|0|.0
Tags:
General