/* * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; namespace ElmSharp { /// /// The EvasMap is an opaque handle to map points. /// public class EvasMap { IntPtr _evasMap; bool _ownership; /// /// Creates and initializes a new instance of the EvasMap class. /// /// The number of points in the map public EvasMap(int count) { _evasMap = Interop.Evas.evas_map_new(count); _ownership = true; } internal EvasMap(IntPtr handle) { _evasMap = handle; _ownership = false; } /// /// Destructor for the EvasMap class. /// ~EvasMap() { if (_ownership) { Interop.Evas.evas_map_free(_evasMap); } } internal IntPtr Handle { get { return _evasMap; } } /// /// Gets or sets the flag of the object move synchronization for map rendering. /// public bool IsMoveSync { get { return Interop.Evas.evas_map_util_object_move_sync_get(_evasMap); } set { Interop.Evas.evas_map_util_object_move_sync_set(_evasMap, value); } } /// /// Populates source and destination map points to exactly match the object. /// /// The object to use unmapped geometry to populate map coordinates public void PopulatePoints(EvasObject obj) { Interop.Evas.evas_map_util_points_populate_from_object_full(_evasMap, obj, 0); } /// /// Populates source and destination map points to exactly match the object. /// /// The object to use unmapped geometry to populate map coordinates /// /// The point Z coordinate hint (pre-perspective transform)This value is used for all four points. /// public void PopulatePoints(EvasObject obj, int z) { Interop.Evas.evas_map_util_points_populate_from_object_full(_evasMap, obj, z); } /// /// Populates the source and destination map points to match the given geometry. /// /// The geometry value contains X coordinate,Y coordinate,the width and height to use to calculate second and third points /// The Z coordinate hint (pre-perspective transform) This value is used for all four points. public void PopulatePoints(Rect geometry, int z) { Interop.Evas.evas_map_util_points_populate_from_geometry(_evasMap, geometry.X, geometry.Y, geometry.Width, geometry.Height, z); } /// /// Rotate the map /// /// The abount of degrees from 0.0 to 360.0 to rotate /// rotation's center horizontal position. /// rotation's center vertical position. public void Rotate(double degrees, int cx, int cy) { Interop.Evas.evas_map_util_rotate(_evasMap, degrees, cx, cy); } /// /// Rotates the map around 3 axes in 3D. /// /// The amount of degrees from 0.0 to 360.0 to rotate around X axis /// The amount of degrees from 0.0 to 360.0 to rotate around Y axis /// The amount of degrees from 0.0 to 360.0 to rotate around Z axis /// The rotation's center horizontal position /// The rotation's center vertical position /// The rotation's center depth position public void Rotate3D(double dx, double dy, double dz, int cx, int cy, int cz) { Interop.Evas.evas_map_util_3d_rotate(_evasMap, dx, dy, dz, cx, cy, cz); } /// /// Changes the map point's coordinate. /// /// The index of point to change ,this must be smaller than map size. /// 3D Point coordinate public void SetPointCoordinate(int idx, Point3D point) { Interop.Evas.evas_map_point_coord_set(_evasMap, idx, point.X, point.Y, point.Z); } /// /// Gets the map point's coordinate. /// /// The index of point to change ,this must be smaller than map size. /// The coordinates of the given point in the map. public Point3D GetPointCoordinate(int idx) { Point3D point; Interop.Evas.evas_map_point_coord_get(_evasMap, idx, out point.X, out point.Y, out point.Z); return point; } /// /// Changes the map to apply the given zooming. /// /// The horizontal zoom to use /// The vertical zoom to use /// The zooming center horizontal position /// The zooming center vertical position public void Zoom(double x, double y, int cx, int cy) { Interop.Evas.evas_map_util_zoom(_evasMap, x, y, cx, cy); } } }