├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── RulerControl.sln ├── RulerControl.v11.suo ├── RulerControl ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── RulerControl.cs ├── RulerControl.csproj ├── Themes │ └── Generic.xaml ├── bin │ └── Debug │ │ ├── RulerControl.dll │ │ └── RulerControl.pdb └── obj │ └── Debug │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ ├── GeneratedInternalTypeHelper.g.cs │ ├── GeneratedInternalTypeHelper.g.i.cs │ ├── RulerControl.Properties.Resources.resources │ ├── RulerControl.csproj.FileListAbsolute.txt │ ├── RulerControl.csproj.GenerateResource.Cache │ ├── RulerControl.csprojResolveAssemblyReference.cache │ ├── RulerControl.dll │ ├── RulerControl.g.resources │ ├── RulerControl.pdb │ ├── RulerControl_MarkupCompile.cache │ ├── RulerControl_MarkupCompile.i.cache │ ├── RulerControl_MarkupCompile.i.lref │ ├── RulerControl_MarkupCompile.lref │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs │ └── Themes │ └── Generic.baml ├── RulerControlTest ├── App.config ├── App.xaml ├── App.xaml.cs ├── CG.cs ├── Edge.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── RulerControlTest.csproj ├── bin │ └── Debug │ │ ├── RulerControl.dll │ │ ├── RulerControl.pdb │ │ ├── RulerControlTest.exe │ │ ├── RulerControlTest.exe.config │ │ ├── RulerControlTest.pdb │ │ ├── RulerControlTest.vshost.exe │ │ ├── RulerControlTest.vshost.exe.config │ │ └── RulerControlTest.vshost.exe.manifest ├── comcomputationalGeometry.cs ├── derya.cs └── obj │ └── Debug │ ├── App.g.cs │ ├── App.g.i.cs │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ ├── MainWindow.baml │ ├── MainWindow.g.cs │ ├── MainWindow.g.i.cs │ ├── RulerControlTest.Properties.Resources.resources │ ├── RulerControlTest.csproj.FileListAbsolute.txt │ ├── RulerControlTest.csproj.GenerateResource.Cache │ ├── RulerControlTest.csprojResolveAssemblyReference.cache │ ├── RulerControlTest.exe │ ├── RulerControlTest.g.resources │ ├── RulerControlTest.pdb │ ├── RulerControlTest_MarkupCompile.cache │ ├── RulerControlTest_MarkupCompile.i.cache │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs │ └── Window1.g.i.cs └── Screenshots ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png └── 8.png /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # ========================= 18 | # Operating System Files 19 | # ========================= 20 | 21 | # OSX 22 | # ========================= 23 | 24 | .DS_Store 25 | .AppleDouble 26 | .LSOverride 27 | 28 | # Icon must ends with two \r. 29 | Icon 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Özcan Zafer AYAN 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WPF RulerControl and Convex Polygon Generating Project 2 | = 3 | Ruler control developed for WPF Applications. And generating convex polygon for Computional Geometry course. 4 | 5 | Screenshots: 6 | 7 | * Starting window: 8 | ![alt tag](https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/master/Screenshots/1.png) 9 | 10 | * 5 points added with using mouse button: 11 | ![alt tag](https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/master/Screenshots/2.png) 12 | 13 | * Red dot isnt inside new polygon: 14 | ![alt tag](https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/master/Screenshots/3.png) 15 | 16 | * Some steps skipped and go to final step: 17 | ![alt tag](https://github.com/ozcanzaferayan/RulerControlForWPF/blob/master/Screenshots/8.png) 18 | -------------------------------------------------------------------------------- /RulerControl.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RulerControl", "RulerControl\RulerControl.csproj", "{FBBD400B-7794-4538-9521-53B29F2416F1}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RulerControlTest", "RulerControlTest\RulerControlTest.csproj", "{5FC1C74A-7E6B-4ED3-B68F-C5D98D15271F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {FBBD400B-7794-4538-9521-53B29F2416F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {FBBD400B-7794-4538-9521-53B29F2416F1}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {FBBD400B-7794-4538-9521-53B29F2416F1}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {FBBD400B-7794-4538-9521-53B29F2416F1}.Release|Any CPU.Build.0 = Release|Any CPU 18 | {5FC1C74A-7E6B-4ED3-B68F-C5D98D15271F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {5FC1C74A-7E6B-4ED3-B68F-C5D98D15271F}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {5FC1C74A-7E6B-4ED3-B68F-C5D98D15271F}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {5FC1C74A-7E6B-4ED3-B68F-C5D98D15271F}.Release|Any CPU.Build.0 = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RulerControl.v11.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl.v11.suo -------------------------------------------------------------------------------- /RulerControl/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("RulerControl")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("RulerControl")] 15 | [assembly: AssemblyCopyright("Copyright © 2013")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly:ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /RulerControl/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18051 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace RulerControl.Properties { 12 | 13 | 14 | /// 15 | /// A strongly-typed resource class, for looking up localized strings, etc. 16 | /// 17 | // This class was auto-generated by the StronglyTypedResourceBuilder 18 | // class via a tool like ResGen or Visual Studio. 19 | // To add or remove a member, edit your .ResX file then rerun ResGen 20 | // with the /str option, or rebuild your VS project. 21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 24 | internal class Resources { 25 | 26 | private static global::System.Resources.ResourceManager resourceMan; 27 | 28 | private static global::System.Globalization.CultureInfo resourceCulture; 29 | 30 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 31 | internal Resources() { 32 | } 33 | 34 | /// 35 | /// Returns the cached ResourceManager instance used by this class. 36 | /// 37 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 38 | internal static global::System.Resources.ResourceManager ResourceManager { 39 | get { 40 | if ((resourceMan == null)) { 41 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RulerControl.Properties.Resources", typeof(Resources).Assembly); 42 | resourceMan = temp; 43 | } 44 | return resourceMan; 45 | } 46 | } 47 | 48 | /// 49 | /// Overrides the current thread's CurrentUICulture property for all 50 | /// resource lookups using this strongly typed resource class. 51 | /// 52 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 53 | internal static global::System.Globalization.CultureInfo Culture { 54 | get { 55 | return resourceCulture; 56 | } 57 | set { 58 | resourceCulture = value; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /RulerControl/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /RulerControl/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18051 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace RulerControl.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /RulerControl/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /RulerControl/RulerControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using System.ComponentModel; 16 | 17 | namespace RulerControl 18 | { 19 | /// 20 | /// Follow steps 1a or 1b and then 2 to use this custom control in a XAML file. 21 | /// 22 | /// Step 1a) Using this custom control in a XAML file that exists in the current project. 23 | /// Add this XmlNamespace attribute to the root element of the markup file where it is 24 | /// to be used: 25 | /// 26 | /// xmlns:MyNamespace="clr-namespace:RulerControl" 27 | /// 28 | /// 29 | /// Step 1b) Using this custom control in a XAML file that exists in a different project. 30 | /// Add this XmlNamespace attribute to the root element of the markup file where it is 31 | /// to be used: 32 | /// 33 | /// xmlns:MyNamespace="clr-namespace:RulerControl;assembly=RulerControl" 34 | /// 35 | /// You will also need to add a project reference from the project where the XAML file lives 36 | /// to this project and Rebuild to avoid compilation errors: 37 | /// 38 | /// Right click on the target project in the Solution Explorer and 39 | /// "Add Reference"->"Projects"->[Select this project] 40 | /// 41 | /// 42 | /// Step 2) 43 | /// Go ahead and use your control in the XAML file. 44 | /// 45 | /// 46 | /// 47 | /// 48 | /// 49 | #region Enumerations 50 | public enum enumOrientation { Horizontal, Vertical } 51 | #endregion 52 | 53 | [TemplatePart(Name = "trackLine", Type = typeof(Line))] 54 | public class RulerControl : Control 55 | { 56 | #region MouseMoveRoutedEvent 57 | public static readonly RoutedEvent MouseMoveEvent = EventManager.RegisterRoutedEvent( 58 | "MouseMove", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(RulerControl)); 59 | 60 | public event RoutedEventHandler MouseMove 61 | { 62 | add { AddHandler(MouseMoveEvent, value); } 63 | remove { RemoveHandler(MouseMoveEvent, value); } 64 | } 65 | #endregion 66 | 67 | #region DepencyProperty OrientationProperty 68 | public static readonly DependencyProperty OrientationProperty = 69 | DependencyProperty.Register("DisplayMode", typeof(enumOrientation), typeof(RulerControl), 70 | new UIPropertyMetadata(enumOrientation.Horizontal)); 71 | 72 | public enumOrientation Orientation 73 | { 74 | get { return (enumOrientation)base.GetValue(OrientationProperty); } 75 | set { this.SetValue(OrientationProperty, value); } 76 | } 77 | #endregion 78 | #region DepencyProperty MajorIntervalProperty 79 | public static readonly DependencyProperty MajorIntervalProperty = 80 | DependencyProperty.Register("MajorIntervalProperty", typeof(int), typeof(RulerControl), 81 | new UIPropertyMetadata(100)); 82 | 83 | public int MajorInterval 84 | { 85 | get { return (int)base.GetValue(MajorIntervalProperty); } 86 | set { this.SetValue(MajorIntervalProperty, value); } 87 | } 88 | #endregion 89 | #region DepencyProperty MarkLengthProperty 90 | public static readonly DependencyProperty MarkLengthProperty = 91 | DependencyProperty.Register("MarkLengthProperty", typeof(int), typeof(RulerControl), 92 | new UIPropertyMetadata(20)); 93 | 94 | public int MarkLength 95 | { 96 | get { return (int)base.GetValue(MarkLengthProperty); } 97 | set { this.SetValue(MarkLengthProperty, value); } 98 | } 99 | #endregion 100 | #region DepencyProperty MiddleMarkLengthProperty 101 | public static readonly DependencyProperty MiddleMarkLengthProperty = 102 | DependencyProperty.Register("MiddleMarkLengthProperty", typeof(int), typeof(RulerControl), 103 | new UIPropertyMetadata(10)); 104 | 105 | public int MiddleMarkLength 106 | { 107 | get { return (int)base.GetValue(MiddleMarkLengthProperty); } 108 | set { this.SetValue(MiddleMarkLengthProperty, value); } 109 | } 110 | #endregion 111 | #region DepencyProperty LittleMarkLengthProperty 112 | public static readonly DependencyProperty LittleMarkLengthProperty = 113 | DependencyProperty.Register("LittleMarkLengthProperty", typeof(int), typeof(RulerControl), 114 | new UIPropertyMetadata(5)); 115 | 116 | public int LittleMarkLength 117 | { 118 | get { return (int)base.GetValue(LittleMarkLengthProperty); } 119 | set { this.SetValue(LittleMarkLengthProperty, value); } 120 | } 121 | #endregion 122 | #region DepencyProperty StartValueProperty 123 | public static readonly DependencyProperty StartValueProperty = 124 | DependencyProperty.Register("StartValueProperty", typeof(double), typeof(RulerControl), 125 | new UIPropertyMetadata(0.0)); 126 | 127 | public double StartValue 128 | { 129 | get { return (double)base.GetValue(StartValueProperty); } 130 | set { this.SetValue(StartValueProperty, value); } 131 | } 132 | #endregion 133 | Point mousePosition; 134 | Pen mouseTrackPen = new Pen(new SolidColorBrush(Colors.Black), 1); 135 | Line mouseVerticalTrackLine; 136 | Line mouseHorizontalTrackLine; 137 | 138 | static RulerControl() 139 | { 140 | DefaultStyleKeyProperty.OverrideMetadata(typeof(RulerControl), new FrameworkPropertyMetadata(typeof(RulerControl))); 141 | } 142 | 143 | protected override void OnRender(DrawingContext drawingContext) 144 | { 145 | RenderOptions.SetEdgeMode(this, EdgeMode.Aliased); 146 | double psuedoStartValue = StartValue; 147 | #region Horizontal Ruler 148 | if (this.Orientation == enumOrientation.Horizontal) 149 | { 150 | for (int i = 0; i < this.ActualWidth / MajorInterval; i++) 151 | { 152 | var ft = new FormattedText((psuedoStartValue * MajorInterval).ToString(), System.Globalization.CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, new Typeface("Tahoma"), 10, Brushes.Black); 153 | drawingContext.DrawText(ft, new Point(i * MajorInterval, 0)); 154 | drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Red), 1), new Point(i * MajorInterval, MarkLength), new Point(i * MajorInterval,0)); 155 | drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Green), 1), 156 | new Point(i * MajorInterval + (MajorInterval / 2), MiddleMarkLength), 157 | new Point(i * MajorInterval + (MajorInterval / 2), 0)); 158 | for (int j = 1; j < 10; j++) 159 | { 160 | if (j == 5) 161 | { 162 | continue; 163 | } 164 | drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Blue), 1), 165 | new Point(i * MajorInterval + (((MajorInterval * j) / 10)), LittleMarkLength), 166 | new Point(i * MajorInterval + (((MajorInterval * j) / 10)), 0)); 167 | } 168 | psuedoStartValue++; 169 | } 170 | } 171 | #endregion 172 | #region Vertical Ruler 173 | else 174 | { 175 | psuedoStartValue = StartValue; 176 | for (int i = 0; i < this.ActualHeight / MajorInterval; i++) 177 | { 178 | var ft = new FormattedText((psuedoStartValue * MajorInterval).ToString(), System.Globalization.CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, new Typeface("Tahoma"), 10, Brushes.Black); 179 | drawingContext.DrawText(ft, new Point(0, i * MajorInterval)); 180 | drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Red), 1), new Point(MarkLength, i * MajorInterval), new Point(0, i * MajorInterval)); 181 | drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Red), 1), new Point(MarkLength, i * MajorInterval), new Point(0, i * MajorInterval)); 182 | drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Green), 1), 183 | new Point(MiddleMarkLength, i * MajorInterval + (MajorInterval / 2)), 184 | new Point(0, i * MajorInterval + (MajorInterval / 2))); 185 | for (int j = 1; j < 10; j++) 186 | { 187 | if (j==5) 188 | { 189 | continue; 190 | } 191 | drawingContext.DrawLine(new Pen(new SolidColorBrush(Colors.Blue), 1), 192 | new Point(LittleMarkLength, i * MajorInterval + (((MajorInterval*j) / 10))), 193 | new Point(0, i * MajorInterval + (((MajorInterval*j) / 10)))); 194 | } 195 | psuedoStartValue++; 196 | } 197 | } 198 | #endregion 199 | 200 | } 201 | protected override void OnMouseMove(MouseEventArgs e) 202 | { 203 | 204 | } 205 | public void RaiseHorizontalRulerMoveEvent(MouseEventArgs e) 206 | { 207 | Point mousePoint = e.GetPosition(this); 208 | mouseHorizontalTrackLine.X1 = mouseHorizontalTrackLine.X2 = mousePoint.X; 209 | } 210 | public void RaiseVerticalRulerMoveEvent(MouseEventArgs e) 211 | { 212 | Point mousePoint = e.GetPosition(this); 213 | mouseVerticalTrackLine.Y1 = mouseVerticalTrackLine.Y2 = mousePoint.Y; 214 | } 215 | public override void OnApplyTemplate() 216 | { 217 | base.OnApplyTemplate(); 218 | mouseVerticalTrackLine = GetTemplateChild("verticalTrackLine") as Line; 219 | mouseHorizontalTrackLine = GetTemplateChild("horizontalTrackLine") as Line; 220 | mouseVerticalTrackLine.Visibility = Visibility.Visible; 221 | mouseHorizontalTrackLine.Visibility = Visibility.Visible; 222 | 223 | } 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /RulerControl/RulerControl.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {FBBD400B-7794-4538-9521-53B29F2416F1} 8 | library 9 | Properties 10 | RulerControl 11 | RulerControl 12 | v4.5 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 4.0 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | MSBuild:Compile 52 | Designer 53 | 54 | 55 | Code 56 | 57 | 58 | 59 | 60 | Code 61 | 62 | 63 | True 64 | True 65 | Resources.resx 66 | 67 | 68 | True 69 | Settings.settings 70 | True 71 | 72 | 73 | ResXFileCodeGenerator 74 | Resources.Designer.cs 75 | 76 | 77 | SettingsSingleFileGenerator 78 | Settings.Designer.cs 79 | 80 | 81 | 82 | 83 | 90 | -------------------------------------------------------------------------------- /RulerControl/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 |  5 | 20 | 21 | -------------------------------------------------------------------------------- /RulerControl/bin/Debug/RulerControl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/bin/Debug/RulerControl.dll -------------------------------------------------------------------------------- /RulerControl/bin/Debug/RulerControl.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/bin/Debug/RulerControl.pdb -------------------------------------------------------------------------------- /RulerControl/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /RulerControl/obj/Debug/GeneratedInternalTypeHelper.g.cs: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /RulerControl/obj/Debug/GeneratedInternalTypeHelper.g.i.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34014 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace XamlGeneratedNamespace { 12 | 13 | 14 | /// 15 | /// GeneratedInternalTypeHelper 16 | /// 17 | [System.Diagnostics.DebuggerNonUserCodeAttribute()] 18 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] 19 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] 20 | public sealed class GeneratedInternalTypeHelper : System.Windows.Markup.InternalTypeHelper { 21 | 22 | /// 23 | /// CreateInstance 24 | /// 25 | protected override object CreateInstance(System.Type type, System.Globalization.CultureInfo culture) { 26 | return System.Activator.CreateInstance(type, ((System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic) 27 | | (System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.CreateInstance)), null, null, culture); 28 | } 29 | 30 | /// 31 | /// GetPropertyValue 32 | /// 33 | protected override object GetPropertyValue(System.Reflection.PropertyInfo propertyInfo, object target, System.Globalization.CultureInfo culture) { 34 | return propertyInfo.GetValue(target, System.Reflection.BindingFlags.Default, null, null, culture); 35 | } 36 | 37 | /// 38 | /// SetPropertyValue 39 | /// 40 | protected override void SetPropertyValue(System.Reflection.PropertyInfo propertyInfo, object target, object value, System.Globalization.CultureInfo culture) { 41 | propertyInfo.SetValue(target, value, System.Reflection.BindingFlags.Default, null, null, culture); 42 | } 43 | 44 | /// 45 | /// CreateDelegate 46 | /// 47 | protected override System.Delegate CreateDelegate(System.Type delegateType, object target, string handler) { 48 | return ((System.Delegate)(target.GetType().InvokeMember("_CreateDelegate", (System.Reflection.BindingFlags.InvokeMethod 49 | | (System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)), null, target, new object[] { 50 | delegateType, 51 | handler}, null))); 52 | } 53 | 54 | /// 55 | /// AddEventHandler 56 | /// 57 | protected override void AddEventHandler(System.Reflection.EventInfo eventInfo, object target, System.Delegate handler) { 58 | eventInfo.AddEventHandler(target, handler); 59 | } 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /RulerControl/obj/Debug/RulerControl.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/obj/Debug/RulerControl.Properties.Resources.resources -------------------------------------------------------------------------------- /RulerControl/obj/Debug/RulerControl.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControl\bin\Debug\RulerControl.dll 2 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControl\bin\Debug\RulerControl.pdb 3 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControl\obj\Debug\RulerControl.csprojResolveAssemblyReference.cache 4 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControl\obj\Debug\GeneratedInternalTypeHelper.g.cs 5 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControl\obj\Debug\RulerControl_MarkupCompile.cache 6 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControl\obj\Debug\RulerControl_MarkupCompile.lref 7 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControl\obj\Debug\Themes\Generic.baml 8 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControl\obj\Debug\RulerControl.g.resources 9 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControl\obj\Debug\RulerControl.Properties.Resources.resources 10 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControl\obj\Debug\RulerControl.csproj.GenerateResource.Cache 11 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControl\obj\Debug\RulerControl.dll 12 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControl\obj\Debug\RulerControl.pdb 13 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\bin\Debug\RulerControl.dll 14 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\bin\Debug\RulerControl.pdb 15 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\RulerControl.csprojResolveAssemblyReference.cache 16 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\GeneratedInternalTypeHelper.g.cs 17 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\RulerControl_MarkupCompile.cache 18 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\RulerControl_MarkupCompile.lref 19 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\Themes\Generic.baml 20 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\RulerControl.g.resources 21 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\RulerControl.Properties.Resources.resources 22 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\RulerControl.csproj.GenerateResource.Cache 23 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\RulerControl.dll 24 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\RulerControl.pdb 25 | -------------------------------------------------------------------------------- /RulerControl/obj/Debug/RulerControl.csproj.GenerateResource.Cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/obj/Debug/RulerControl.csproj.GenerateResource.Cache -------------------------------------------------------------------------------- /RulerControl/obj/Debug/RulerControl.csprojResolveAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/obj/Debug/RulerControl.csprojResolveAssemblyReference.cache -------------------------------------------------------------------------------- /RulerControl/obj/Debug/RulerControl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/obj/Debug/RulerControl.dll -------------------------------------------------------------------------------- /RulerControl/obj/Debug/RulerControl.g.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/obj/Debug/RulerControl.g.resources -------------------------------------------------------------------------------- /RulerControl/obj/Debug/RulerControl.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/obj/Debug/RulerControl.pdb -------------------------------------------------------------------------------- /RulerControl/obj/Debug/RulerControl_MarkupCompile.cache: -------------------------------------------------------------------------------- 1 | RulerControl 2 | 3 | 4 | library 5 | C# 6 | .cs 7 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\ 8 | RulerControl 9 | none 10 | false 11 | DEBUG;TRACE 12 | 13 | 1-731644535 14 | 15 | 41087470586 16 | 12-1401562060 17 | Themes\Generic.xaml; 18 | 19 | False 20 | 21 | -------------------------------------------------------------------------------- /RulerControl/obj/Debug/RulerControl_MarkupCompile.i.cache: -------------------------------------------------------------------------------- 1 | RulerControl 2 | 3 | 4 | library 5 | C# 6 | .cs 7 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\ 8 | RulerControl 9 | none 10 | false 11 | DEBUG;TRACE 12 | 13 | 1-731644535 14 | 15 | 8-870023224 16 | 12-1401562060 17 | Themes\Generic.xaml; 18 | 19 | True 20 | 21 | -------------------------------------------------------------------------------- /RulerControl/obj/Debug/RulerControl_MarkupCompile.i.lref: -------------------------------------------------------------------------------- 1 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\GeneratedInternalTypeHelper.g.i.cs 2 | 3 | FC:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\Themes\Generic.xaml;; 4 | 5 | -------------------------------------------------------------------------------- /RulerControl/obj/Debug/RulerControl_MarkupCompile.lref: -------------------------------------------------------------------------------- 1 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\obj\Debug\GeneratedInternalTypeHelper.g.cs 2 | 3 | FC:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControl\Themes\Generic.xaml;; 4 | 5 | -------------------------------------------------------------------------------- /RulerControl/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs -------------------------------------------------------------------------------- /RulerControl/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs -------------------------------------------------------------------------------- /RulerControl/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs -------------------------------------------------------------------------------- /RulerControl/obj/Debug/Themes/Generic.baml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControl/obj/Debug/Themes/Generic.baml -------------------------------------------------------------------------------- /RulerControlTest/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /RulerControlTest/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RulerControlTest/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace RulerControlTest 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /RulerControlTest/CG.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Shapes; 8 | using System.Windows.Media; 9 | 10 | namespace CG 11 | { 12 | public enum TwoLines { COLLINEAR, PARALLEL, SKEW, SKEW_CROSS, SKEW_NO_CROSS }; 13 | public enum Rotation { CLOCKWISE, COUNTERCLOCKWISE }; 14 | public enum TopologyOrientation { LEFT, RIGHT, BEHIND, BEYOND, ORIGIN, DESTINATION, BETWEEN }; 15 | public class PointByMe 16 | { 17 | 18 | public double x; 19 | public double y; 20 | override public string ToString() 21 | { 22 | string s = 23 | " " + 24 | "x : " + this.x + " " + 25 | "y : " + this.y + "\n" + 26 | "length : " + this.length() + "\n" + 27 | "polarAngle: " + this.polarAngle(); 28 | //+"\n"+"------------------"; 29 | return s; 30 | } 31 | 32 | public PointByMe(double _x, double _y) 33 | { 34 | x = _x; 35 | y = _y; 36 | } 37 | public PointByMe(PointByMe p) 38 | { 39 | this.x = p.x; 40 | this.y = p.y; 41 | } 42 | public static PointByMe operator +(PointByMe obj1, PointByMe obj2) 43 | { 44 | return (new PointByMe(obj1.x + obj2.x, obj1.y + obj2.y)); 45 | } 46 | 47 | public static PointByMe operator -(PointByMe obj1, PointByMe obj2) 48 | { 49 | return (new PointByMe(obj1.x - obj2.x, obj1.y - obj2.y)); 50 | } 51 | 52 | public static PointByMe operator *(double obj1, PointByMe obj2) 53 | { 54 | return (new PointByMe(obj1 * obj2.x, obj1 * obj2.y)); 55 | } 56 | 57 | public static Boolean operator ==(PointByMe a, PointByMe b) 58 | { 59 | return ((a.x == b.x && a.y == b.y)); 60 | 61 | } 62 | public static Boolean operator !=(PointByMe a, PointByMe b) 63 | { 64 | return !(a == b); 65 | } 66 | 67 | public static bool operator <(PointByMe a, PointByMe b) 68 | { 69 | return ( 70 | (a.x < b.x && a.y < b.y) 71 | ); 72 | } 73 | public static bool operator >(PointByMe a, PointByMe b) 74 | { 75 | return ( 76 | (a.x > b.x && a.y > b.y) 77 | ); 78 | } 79 | public int CompareTo(PointByMe obj) 80 | { 81 | 82 | if (this < obj) 83 | return -1; 84 | else if (this == obj) 85 | return 0; 86 | else return 1; 87 | //throw new NotImplementedException(); 88 | } 89 | public TopologyOrientation classify(PointByMe p0, PointByMe p1) 90 | { 91 | PointByMe p2 = this; 92 | PointByMe a = p1 - p0; 93 | PointByMe b = p2 - p0; 94 | double SignedArea = a.x * b.y - b.x * a.y; 95 | if (SignedArea > 0.0) 96 | return TopologyOrientation.LEFT; 97 | else if (SignedArea < 0.0) 98 | return TopologyOrientation.RIGHT; 99 | else if (a.x * b.x < 0.0 || (a.y * b.y < 0.0)) // zıt işaretli ters yönde , biri eşit olabilir 100 | return TopologyOrientation.BEHIND; 101 | else if (a.length() < b.length()) 102 | return TopologyOrientation.BEYOND; 103 | else if (p0 == p2) 104 | return TopologyOrientation.ORIGIN; 105 | else if (p1 == p2) 106 | return TopologyOrientation.DESTINATION; 107 | else 108 | return TopologyOrientation.BETWEEN; 109 | 110 | 111 | } 112 | public TopologyOrientation classify(Edge e) 113 | { 114 | return classify(e.org, e.dest); 115 | //return TopologyOrientation.Left; 116 | } 117 | public double polarAngle() 118 | { 119 | if ((x == 0.0) && (y == 0.0)) 120 | return -1.0; 121 | else if (x == 0.0) 122 | return ((y > 0.0) ? 90 : 270); 123 | double theta = Math.Atan(y / x); // in radians 124 | theta *= 360 / (2 * Math.PI); // convert to degrees 125 | if (x > 0.0) // quadrants 1 and 4 126 | return ((y >= 0.0) ? theta : 360 + theta); 127 | else // quadrants 2 and 3 128 | return (180 + theta); 129 | } 130 | public double length() 131 | { 132 | return Math.Sqrt(x * x + y * y); 133 | } 134 | public double distance(Edge obj1) 135 | { 136 | return 0.0; 137 | } 138 | public override int GetHashCode() 139 | { 140 | return base.GetHashCode(); 141 | } 142 | public override bool Equals(object obj) 143 | { 144 | return base.Equals(obj); 145 | } 146 | //public override string ToString() 147 | //{ 148 | // return base.ToString(); 149 | //} 150 | 151 | 152 | 153 | } 154 | 155 | public class Vertex : PointByMe 156 | { 157 | 158 | private Vertex _next; 159 | private Vertex _prev; 160 | public Vertex(double d1, double d2) 161 | : base(d1, d2) 162 | { 163 | _next = this; 164 | _prev = this; 165 | 166 | 167 | } 168 | public Vertex(PointByMe point) : base(point) { 169 | _next = this; 170 | _prev = this; 171 | } 172 | Vertex next() { return _next; } 173 | Vertex prev() { return _prev; } 174 | private Vertex baseinsert(Vertex b) 175 | { 176 | Vertex c = new Vertex(0,0); 177 | c=_next; 178 | b._next = c; 179 | b._prev = this; 180 | _next = b; 181 | c._prev = b; 182 | return b; 183 | 184 | } 185 | private Vertex baseremove() 186 | { 187 | _prev._next = _next; 188 | _next._prev = _prev; 189 | _next = _prev = this; 190 | return this; 191 | } 192 | private void basesplice(Vertex b) 193 | { 194 | Vertex a = this;// new Vertex(this.point()); 195 | Vertex an = a._next;// new Vertex(0, 0); 196 | //an = this._next; 197 | Vertex bn= b._next; 198 | //Vertex bn = new Vertex(0, 0); 199 | a._next = bn; 200 | b._next = an; 201 | an._prev = b; 202 | bn._prev = a; 203 | } 204 | public Vertex cw() 205 | { 206 | return this._next; 207 | 208 | } 209 | public Vertex ccw() 210 | { 211 | return this._prev; 212 | 213 | } 214 | public Vertex neighbor(Rotation rotation) 215 | { 216 | return (rotation == Rotation.CLOCKWISE) ? cw() : ccw(); 217 | 218 | } 219 | 220 | public PointByMe point() 221 | { 222 | return (PointByMe)this; 223 | } 224 | public Vertex insert(Vertex v) 225 | { 226 | return baseinsert(v); 227 | } 228 | public Vertex remove() 229 | { 230 | return baseremove(); 231 | } 232 | public void splice(Vertex b) 233 | { 234 | basesplice(b); 235 | } 236 | public Vertex split(Vertex b){ 237 | Vertex bp=b.ccw().insert(new Vertex(b.point())); 238 | insert(new Vertex(point())); 239 | splice(bp); 240 | return bp; 241 | } 242 | 243 | 244 | 245 | } 246 | 247 | public class Edge 248 | { 249 | public PointByMe org; 250 | public PointByMe dest; 251 | public Edge(PointByMe _org, PointByMe _dest) 252 | { 253 | org = _org; 254 | dest = _dest; 255 | } 256 | public Edge() 257 | { 258 | org = new PointByMe(0.0, 0.0); 259 | dest = new PointByMe(1.0, 0.0); 260 | } 261 | public Edge rot() 262 | { 263 | PointByMe m = 0.5 * (org + dest); 264 | PointByMe v = dest - org; 265 | PointByMe n = new PointByMe(v.y, -(v.x)); 266 | org = m - 0.5 * n; 267 | dest = m + 0.5 * n; 268 | return this; 269 | } 270 | public Edge flip() 271 | { 272 | return this.rot().rot(); 273 | } 274 | PointByMe point(double t) 275 | { 276 | return (new PointByMe(org + t * (dest - org))); 277 | } 278 | TwoLines intersect(Edge e, ref double t) 279 | { 280 | PointByMe a = org; 281 | PointByMe b = dest; 282 | PointByMe c = e.org; 283 | PointByMe d = e.dest; 284 | PointByMe n = new PointByMe((d - c).y, (c - d).x); 285 | double denom = n.x * (b - a).x + n.y * (b - a).y; //dotProduct(n, b-a); 286 | if (denom == 0.0) 287 | { 288 | TopologyOrientation aclass = org.classify(e); 289 | if ((aclass == TopologyOrientation.LEFT) || (aclass == TopologyOrientation.RIGHT)) 290 | return TwoLines.PARALLEL; 291 | else 292 | return TwoLines.COLLINEAR; 293 | } 294 | double num = n.x * (a - c).x + n.y * (a - c).y; //dotProduct(n, b-a); 295 | t = -num / denom; 296 | return TwoLines.SKEW; 297 | } 298 | 299 | //int cross(Edge&, double&); 300 | public bool isVertical() 301 | { 302 | return (org.x == dest.x); 303 | } 304 | double slope() 305 | { 306 | if (org.x != dest.x) 307 | return (dest.y - org.y) / (dest.x - org.x); 308 | return Double.MaxValue; 309 | } 310 | double y(double x) 311 | { 312 | return slope() * (x - org.x) + org.y; 313 | } 314 | 315 | } 316 | public class Polygon 317 | { 318 | private Vertex _v; 319 | private int _size; 320 | private void resize() 321 | { 322 | if (_v.Equals(null)) 323 | _size = 0; 324 | else 325 | { 326 | Vertex v = _v.cw(); 327 | for (_size=1;v!=_v ; ++_size,v=v.cw()) 328 | { 329 | 330 | } 331 | } 332 | 333 | } 334 | public Polygon() 335 | { 336 | _v = null; 337 | _size = 0; 338 | } 339 | public Polygon(Polygon p) 340 | { 341 | _size = p._size; 342 | if (_size == 0) 343 | { 344 | _v = null; 345 | 346 | } 347 | else 348 | { 349 | _v = new Vertex(p.point()); 350 | } 351 | for (int i = 1; i < _size; i++) 352 | { 353 | p.advance(Rotation.CLOCKWISE); 354 | _v=_v.insert(p.v()); 355 | } 356 | p.advance(Rotation.CLOCKWISE); 357 | _v = _v.cw(); 358 | 359 | } 360 | public Polygon(Vertex v) 361 | { 362 | _v = v; 363 | resize(); 364 | } 365 | 366 | public Vertex v() 367 | { 368 | return _v; 369 | } 370 | public int size() 371 | { 372 | return _size; 373 | } 374 | public PointByMe point() 375 | { 376 | return _v.point(); 377 | } 378 | public Edge edge() 379 | { 380 | return new Edge(point(), _v.cw().point()); 381 | } 382 | 383 | public Vertex cw() 384 | { 385 | return _v = _v.neighbor(Rotation.CLOCKWISE); 386 | } 387 | public Vertex ccw() 388 | { 389 | return _v = _v.neighbor(Rotation.CLOCKWISE); 390 | } 391 | public Vertex neighbor(Rotation rotation) 392 | { 393 | return _v.neighbor(rotation); 394 | } 395 | public Vertex advance(Rotation rotation) 396 | { 397 | return _v=_v.neighbor(rotation); 398 | } 399 | public Vertex setV(Vertex v) 400 | { 401 | return _v = v; 402 | } 403 | public Vertex insert(PointByMe p) 404 | { 405 | if (_size++ == 0) 406 | { 407 | _v = new Vertex(p); 408 | } 409 | else 410 | { 411 | _v = _v.insert(new Vertex(p)); 412 | } 413 | return _v; 414 | } 415 | public void remove() { 416 | Vertex v = _v; 417 | _v = (--_size == 0) ? null : _v.ccw(); 418 | _v.remove(); 419 | } 420 | public Polygon split(Vertex b) 421 | { 422 | Vertex bp = _v.split(b); 423 | resize(); 424 | return new Polygon(bp); 425 | } 426 | } 427 | public static class utility 428 | { 429 | static PointByMe originPt; 430 | public static System.Windows.Shapes.Rectangle getRectangle(PointByMe p, PointByMe org) 431 | { 432 | //x = myList.ElementAt(selected_list_index_current).x + origin.x; //(double)Convert.ToInt32(e.GetPosition(myCanvas).X); 433 | //y = -(myList.ElementAt(selected_list_index_current).y) + origin.y; //(double)Convert.ToInt32(e.GetPosition(myCanvas).Y); 434 | double x = p.x + org.x; 435 | double y = p.y + org.y; 436 | 437 | Rectangle myRectangle = new Rectangle(); 438 | 439 | myRectangle.Width = 10; 440 | myRectangle.Height = 10; 441 | myRectangle.Fill = new SolidColorBrush(Colors.Red); 442 | //myRectangle.ToolTip = myList.ElementAt(selected_list_index_current).ToString(); 443 | //myCanvas.Children.Add(myRectangle); 444 | //Canvas.SetLeft(myRectangle, x); 445 | //Canvas.SetTop(myRectangle, y); 446 | return myRectangle; 447 | } 448 | 449 | public static PointByMe reversePoint(PointByMe point) 450 | { 451 | PointByMe origin = new PointByMe(0, 0); 452 | point.y = -point.y; 453 | point = point + origin; 454 | return new PointByMe(point.x, point.y); 455 | } 456 | 457 | public static PointByMe leastPoint(PointByMe org, System.Collections.Generic.List l) 458 | { 459 | PointByMe bestP = l.ElementAt(1); 460 | PointByMe testP = new PointByMe(0, 0); 461 | for (int i = 1; i < l.Count; i++) 462 | { 463 | testP = l.ElementAt(i); 464 | //if (bestP == testP) continue; 465 | if ( 466 | (testP - org).length() < (bestP - org).length() 467 | ) 468 | bestP = testP; 469 | } 470 | return bestP; 471 | } 472 | 473 | public static bool pointInConvexPolygon(PointByMe s, Polygon p) // Edge sınıfına ihtiyaç var 474 | { 475 | //throw new InvalidOperationException("Implement edilmedi"); 476 | if (p.size() == 1) return (s == p.point()); 477 | if (p.size() == 2) 478 | { 479 | TopologyOrientation c = s.classify(p.edge()); 480 | return ((c == TopologyOrientation.BETWEEN) || (c == TopologyOrientation.ORIGIN) | (c == TopologyOrientation.DESTINATION)); 481 | } 482 | Vertex org = p.v(); 483 | for (int i = 0; i < p.size(); i++, p.advance(Rotation.CLOCKWISE)) 484 | { 485 | if (s.classify(p.edge()) == TopologyOrientation.LEFT) 486 | { 487 | p.setV(org); 488 | return false; 489 | } 490 | } 491 | return true; 492 | } 493 | 494 | static PointByMe somePoint; 495 | //public static Polygon insertionHull(List s) 496 | //{ 497 | // List myListG = new List(); 498 | // Polygon p = new Polygon(); 499 | // p.insert(s.ElementAt(0)); 500 | // for (int i = 1; i < s.Count; i++) 501 | // { 502 | // if (pointInConvexPolygon(s.ElementAt(i), p)) 503 | // { 504 | // continue; 505 | // } 506 | // somePoint = s.ElementAt(i); 507 | // leastVertex(p, closestToPolygonCmp(s.ElementAt(i), p.v().point())); 508 | // supportingLine(s.ElementAt(i), p, TopologyOrientation.LEFT); 509 | // Vertex l = p.v(); 510 | // supportingLine(s.ElementAt(i), p, TopologyOrientation.RIGHT); 511 | // p.insert(s.ElementAt(i)); 512 | // } 513 | // return p; 514 | //} 515 | public static void supportingLine(PointByMe s, Polygon p, TopologyOrientation side) 516 | { 517 | 518 | for (int i = 0; i < p.size(); i++, p.cw()) 519 | if(p.point().y>0) p.point().y=-p.point().y; 520 | 521 | //if (side == TopologyOrientation.LEFT) side = TopologyOrientation.RIGHT; // kitaptan farklı 522 | // else side = TopologyOrientation.LEFT; 523 | Rotation rotation; 524 | if (side == CG.TopologyOrientation.LEFT) 525 | rotation = Rotation.CLOCKWISE; 526 | else 527 | rotation = Rotation.COUNTERCLOCKWISE; 528 | //TopologyOrientation rotation = (side == TopologyOrientation.LEFT) ? Rotation.CLOCKWISE : Rotation.COUNTERCLOCKWISE; 529 | //int rotation = (side == (int)TopologyOrientation.LEFT) ? (int)Rotation.CLOCKWISE : (int)Rotation.COUNTERCLOCKWISE; 530 | Vertex av = p.v(); 531 | PointByMe ap = p.point(); 532 | Vertex bv = p.neighbor((Rotation)rotation); 533 | PointByMe bp = p.neighbor((Rotation)rotation).point(); 534 | TopologyOrientation c = bp.classify(s, ap); 535 | //MessageBox.Show(@"\ntest edilen değerler : a ve aktif vertex "+ap.x+ 536 | // "\n diğer vertex(henüz taşıma olmadı) b : "+bp.x+ 537 | // " \n closest yani test edilen : "+s.x+ 538 | // "\ntest sonucu : ",c.ToString()); 539 | String s11 = ""; 540 | s11+=ap.x.ToString()+" "+ap.y.ToString()+" "; 541 | s11+=bp.x.ToString()+" "+bp.y.ToString()+" "; 542 | s11+=s.x.ToString()+" "+s.y.ToString()+" "; 543 | s11+= bp.classify(s, ap).ToString() + " "; 544 | //MessageBox.Show(s11); 545 | while ((bp.classify(s, ap) == side) || (c == TopologyOrientation.BEYOND) || (c == TopologyOrientation.BETWEEN)) 546 | { 547 | //MessageBox.Show("\na b ve s test sonusu doğrudur, advance oldu ..."); 548 | s11 = ""; 549 | s11 += ap.x.ToString() + " " + ap.y.ToString() + " "; 550 | s11 += bp.x.ToString() + " " + bp.y.ToString() + " "; 551 | s11 += s.x.ToString() + " " + s.y.ToString() + " "; 552 | s11 += bp.classify(s, ap).ToString() + " "; 553 | //MessageBox.Show(s11); 554 | p.advance((Rotation)rotation); 555 | //if (side == TopologyOrientation.LEFT) p.cw(); 556 | // else p.ccw(); 557 | 558 | av = p.v(); 559 | ap = p.point(); 560 | bv = p.neighbor((Rotation)rotation); 561 | bp = p.neighbor((Rotation)rotation).point(); 562 | c = ap.classify(s, bp); 563 | //MessageBox.Show(@"\nYeni değeler... \ntest edilen değerler : a ve aktif vertex " + ap.x + 564 | //"\n diğer vertex(henüz taşıma olmadı) b : " + bp.x + 565 | //" \n closest yani test edilen : " + s.x + 566 | //"\ntest sonucu : ", c.ToString()); 567 | 568 | } 569 | } 570 | 571 | static int polarCmp(PointByMe p, PointByMe q) 572 | { 573 | PointByMe vp = p - originPt; 574 | PointByMe vq = q - originPt; 575 | double pPolar = vp.polarAngle(); 576 | double qPolar = vq.polarAngle(); 577 | if (pPolar < qPolar) return -1; 578 | if (pPolar > qPolar) return 1; 579 | if (vp.length() < vq.length()) return -1; 580 | if (vp.length() > vq.length()) return 1; 581 | return 0; 582 | } 583 | 584 | public static Vertex leastVertex(Polygon p1) 585 | { 586 | Vertex bestV = p1.v(); 587 | p1.advance(Rotation.CLOCKWISE); 588 | for (int i = 1; i < p1.size(); p1.advance(Rotation.CLOCKWISE), i++) 589 | { 590 | if (p1.v().point().polarAngle() < bestV.point().polarAngle()) 591 | { 592 | bestV = p1.v(); 593 | } 594 | } 595 | p1.setV(bestV); 596 | return bestV; 597 | } 598 | 599 | //public static double closestToPolygonCmp(PointByMe a, PointByMe b) 600 | //{ 601 | // //double distA = (somePoint - a).length(); 602 | // //double distB = (somePoint - b).length(); 603 | // //if (distA < distB) return -1; 604 | // //else if (distA > distB) return 1; 605 | // //return 0; 606 | 607 | // double l = Math.Sqrt(Math.Pow((a.x - b.x), 2) + Math.Pow((a.y - b.y), 2)); 608 | // return l; 609 | //} 610 | 611 | //internal static void pointToConvexPolygon(Polygon myPoligon, LinkedList sortedPolygon, LinkedList sortedEllipseList, Dispatcher dis, System.Windows.Controls.Canvas canvas) 612 | //{ 613 | // List list = new List(); 614 | // List lineList = new List(); 615 | // #region ilk 3 nokta ile polygon 616 | // for (int i = 0; i < 3; i++) 617 | // { 618 | // list.Add(sortedPolygon.ElementAt(i)); 619 | // dis.BeginInvoke(new Action(() => 620 | // { sortedEllipseList.ElementAt(i).Fill = new SolidColorBrush(Colors.Red); })); 621 | // Thread.Sleep(1000); 622 | 623 | // dis.BeginInvoke(new Action(() => 624 | // { 625 | // Line l = new Line(); 626 | // PointByMe p1 = new PointByMe(list.ElementAt(0).x, list.ElementAt(0).y); 627 | // PointByMe p2 = new PointByMe(list.ElementAt(i - 1).x, list.ElementAt(i - 1).y); 628 | // p1 = utility.reversePoint(p1); 629 | // p2 = utility.reversePoint(p2); 630 | // l.X1 = p1.x; 631 | // l.Y1 = p1.y; 632 | // l.X2 = p2.x; 633 | // l.Y2 = p2.y; 634 | // l.VerticalAlignment = System.Windows.VerticalAlignment.Center; 635 | // l.Stroke = System.Windows.Media.Brushes.LightYellow; 636 | 637 | // l.StrokeThickness = 2; 638 | // canvas.Children.Add(l); 639 | // lineList.Add(l); 640 | // })); 641 | // } 642 | // Thread.Sleep(1000); 643 | // dis.BeginInvoke(new Action(() => 644 | // { 645 | // Line l = new Line(); 646 | // PointByMe p1 = new PointByMe(list.ElementAt(2).x, list.ElementAt(2).y); 647 | // PointByMe p2 = new PointByMe(list.ElementAt(1).x, list.ElementAt(1).y); 648 | // p1 = utility.reversePoint(p1); 649 | // p2 = utility.reversePoint(p2); 650 | // l.X1 = p1.x; 651 | // l.Y1 = p1.y; 652 | // l.X2 = p2.x; 653 | // l.Y2 = p2.y; 654 | // l.VerticalAlignment = System.Windows.VerticalAlignment.Center; 655 | // l.Stroke = System.Windows.Media.Brushes.LightYellow; 656 | 657 | // l.StrokeThickness = 2; 658 | // canvas.Children.Add(l); 659 | // lineList.Add(l); 660 | // })); 661 | // Thread.Sleep(1000); 662 | // #endregion 663 | 664 | // for (int i = 3; i < myPoligon.size(); i++) 665 | // { 666 | // list.Add(sortedPolygon.ElementAt(i)); 667 | // } 668 | // //for (int i = 0; i < list.Count; i++) 669 | // //{ 670 | // // if (pointInConvexPolygon(list.ElementAt(i), myPoligon)) 671 | // // { 672 | // // continue; 673 | // // } 674 | // // else 675 | // // { 676 | // // somePoint = list.ElementAt(i); 677 | // // leastVertex(myPoligon, closestToPolygonCmp(list.ElementAt(i), myPoligon.v().point())); 678 | // // supportingLine(list.ElementAt(i), myPoligon, (int)TopologyOrientation.LEFT); 679 | // // Vertex l = myPoligon.v(); 680 | // // supportingLine(list.ElementAt(i), myPoligon, (int)TopologyOrientation.RIGHT); 681 | // // myPoligon.insert(list.ElementAt(i)); 682 | // // } 683 | // //} 684 | // for (int i = 3; i < list.Count(); i++) 685 | // { 686 | // for (int j = 0; j < i; j++) 687 | // { 688 | // PointByMe point = list.ElementAt(i); 689 | // PointByMe po = list.ElementAt(j); 690 | // PointByMe po1 = list.ElementAt(j + 1); 691 | // PointByMe enYakin = po; 692 | // if (!pointInConvexPolygon(point, myPoligon)) 693 | // { 694 | // if (closestToPolygonCmp(point, po) > closestToPolygonCmp(point, po1)) 695 | // { 696 | // enYakin = po1; 697 | // int temp = pointIndex(list.ElementAt(i), sortedPolygon); 698 | // Thread.Sleep(1000); 699 | // dis.BeginInvoke(new Action(() => 700 | // { sortedEllipseList.ElementAt(temp).Fill = new SolidColorBrush(Colors.Green); })); 701 | // Thread.Sleep(1000); 702 | // dis.BeginInvoke(new Action(() => 703 | // { 704 | // Line myLine = new Line(); 705 | // PointByMe point1 = new PointByMe(point.x, point.y); 706 | // PointByMe point2 = new PointByMe(enYakin.x, enYakin.y); 707 | // point1 = utility.reversePoint(point1); 708 | // point2 = utility.reversePoint(point2); 709 | // myLine.X1 = point1.x; 710 | // myLine.Y1 = point1.y; 711 | // myLine.X2 = point2.x; 712 | // myLine.Y2 = point2.y; 713 | // myLine.VerticalAlignment = System.Windows.VerticalAlignment.Center; 714 | // myLine.Stroke = System.Windows.Media.Brushes.LightYellow; 715 | 716 | // myLine.StrokeThickness = 2; 717 | // canvas.Children.Add(myLine); 718 | 719 | // lineList.Add(myLine); 720 | // canvas.Children.Remove(lineList.ElementAt(i)); 721 | 722 | // })); 723 | // Thread.Sleep(1000); 724 | // dis.BeginInvoke(new Action(() => 725 | // { sortedEllipseList.ElementAt(temp).Fill = new SolidColorBrush(Colors.Red); })); 726 | // //list.RemoveAt(0); 727 | // } 728 | // } 729 | // } 730 | // } 731 | //} 732 | public static int pointIndex(PointByMe point, LinkedList list) 733 | { 734 | for (int i = 0; i < list.Count; i++) 735 | { 736 | if (list.ElementAt(i) == point) 737 | { 738 | return i; 739 | } 740 | } 741 | return -1; 742 | } 743 | } 744 | } 745 | -------------------------------------------------------------------------------- /RulerControlTest/Edge.cs: -------------------------------------------------------------------------------- 1 | //using System; 2 | //using System.Collections.Generic; 3 | //using System.Linq; 4 | //using System.Text; 5 | //using System.Threading.Tasks; 6 | //using ConvexHullAlgorithm; 7 | -------------------------------------------------------------------------------- /RulerControlTest/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /RulerControlTest/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using CG; 16 | 17 | namespace RulerControlTest 18 | { 19 | /// 20 | /// Interaction logic for MainWindow.xaml 21 | /// 22 | public partial class MainWindow : Window 23 | { 24 | public Vector windowOrigin = new Vector(0, 0); 25 | ToolTip cursorToolTip; 26 | CG.Polygon mmP = new CG.Polygon(); 27 | LinkedList sortedEllipseList; 28 | LinkedList sortedPolygon; 29 | CG.Polygon myPoligon = new CG.Polygon(); 30 | public static PointByMe origin = new PointByMe(0, 0); 31 | System.Collections.Generic.List ellipseList = new System.Collections.Generic.List(); 32 | 33 | public MainWindow() 34 | { 35 | InitializeComponent(); 36 | cursorToolTip = new ToolTip(); 37 | myCanvas.ToolTip = cursorToolTip; 38 | 39 | } 40 | 41 | #region 42 | private void btnPointToConvexPolygon_Click(object sender, RoutedEventArgs e) 43 | { 44 | //sortedPolygon = myPoligon.sortByxPolygon(); 45 | 46 | 47 | //PointByMe p0 = new PointByMe(182,-291); mmP.insert(p0); 48 | //PointByMe p1 = new PointByMe(348,-116); mmP.insert(p1); 49 | //PointByMe p2 = new PointByMe(585,-191); mmP.insert(p2); 50 | //PointByMe p3 = new PointByMe(425,-95); mmP.insert(p3); 51 | //PointByMe p4 = new PointByMe(351,-276); mmP.insert(p4); 52 | 53 | //for(int i=0;i0) MessageBox.Show("şu an point x değeri :"+myPoligon.point().x.ToString()); 71 | 72 | // myPoligon.insert(myPoint); 73 | // // cw() testi için bu döngü 74 | // //for (int i = 0; i < myPoligon.size(); i++, myPoligon.cw()) //.advance(CG.Rotation.CLOCKWISE)) 75 | // //{ 76 | // // MessageBox.Show("i:"+ i + "\n"+ myPoligon.size() + "\n" +myPoligon.v().x.ToString() + "\n" +myPoligon.v().point().x.ToString()); 77 | // //} 78 | 79 | 80 | // myCanvas.Children.Add(ellipse); 81 | // } 82 | //derya.drawPoligon(mmP,myCanvas); 83 | //MessageBox.Show("noktalar çizildi mi?"); 84 | 85 | //myPoligon = mmP; 86 | //sortedEllipseList = sortByxEllipse(ellipseList); 87 | btnPointToConvexPolygon.IsEnabled = false; 88 | 89 | MessageBox.Show(" gönderilen poligon size " + myPoligon.size() + " \n"); 90 | myPoligon.cw(); 91 | 92 | CG.Polygon pp = ConvexHullAlgorithm.derya.convex_Uret(myPoligon, Dispatcher, myCanvas); 93 | 94 | string polygonToMessageBox = ""; 95 | for (int i = 0; i < pp.size(); i++, pp.cw()) 96 | { 97 | polygonToMessageBox += "(" + pp.point().x + "," + pp.point().y + ")\n"; 98 | } 99 | MessageBox.Show("Oluşan poligon size : " + pp.size() + "\n" + polygonToMessageBox); 100 | 101 | 102 | 103 | } 104 | #endregion 105 | 106 | private LinkedList sortByxEllipse(List ellipseList) 107 | { 108 | Ellipse firstEllipse = ellipseList.ElementAt(0); 109 | LinkedList sortedList = new LinkedList(); 110 | sortedList.AddFirst(firstEllipse); 111 | for (int i = 1; i < ellipseList.Count; i++) 112 | { 113 | LinkedListNode current = sortedList.First; 114 | while (Canvas.GetLeft(current.Value) < Canvas.GetLeft(ellipseList.ElementAt(i))) 115 | { 116 | if (current == sortedList.Last) 117 | { 118 | sortedList.AddAfter(current, ellipseList.ElementAt(i)); 119 | break; 120 | } 121 | current = current.Next; 122 | } 123 | 124 | if (Canvas.GetLeft(current.Value) > Canvas.GetLeft(ellipseList.ElementAt(i))) 125 | { 126 | sortedList.AddBefore(current, ellipseList.ElementAt(i)); 127 | } 128 | } 129 | return sortedList; 130 | } 131 | 132 | private void Window_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e) 133 | { 134 | //double x = (double)Convert.ToInt32(e.GetPosition(coordinateCanvas).X); 135 | //double y = (double)Convert.ToInt32(e.GetPosition(coordinateCanvas).Y); 136 | //Ellipse ellipse = new Ellipse(); 137 | //ellipse.Width = 10; 138 | //ellipse.Height = 10; 139 | //ellipse.Fill = new SolidColorBrush(Colors.White); 140 | //ellipse.Stroke = new SolidColorBrush(Colors.Black); 141 | //ellipse.StrokeThickness = 1; 142 | //#region Tooltip oluşturma 143 | //Vector myPoint = new Vector(x, y); 144 | //myPoint.Y = myPoint.Y; 145 | //ellipse.ToolTip = "(" + myPoint.X + "," + myPoint.Y + ")"; 146 | //#endregion 147 | 148 | //coordinateCanvas.Children.Add(ellipse); 149 | //Canvas.SetLeft(ellipse, x); 150 | //Canvas.SetTop(ellipse, y); 151 | //Canvas.SetZIndex(ellipse, 1); 152 | //ellipseDictionary.Add(new Vector(x + 3, y + 3)); 153 | //if (ellipseDictionary.Count > 1) 154 | //{ 155 | // Line l = new Line(); 156 | // l.Stroke = new SolidColorBrush(Colors.Gray); 157 | // l.StrokeThickness = 1; 158 | // l.X1 = ellipseDictionary[ellipseDictionary.Count - 2].X; 159 | // l.X2 = ellipseDictionary[ellipseDictionary.Count - 1].X; 160 | // l.Y1 = ellipseDictionary[ellipseDictionary.Count - 2].Y; 161 | // l.Y2 = ellipseDictionary[ellipseDictionary.Count - 1].Y; 162 | // coordinateCanvas.Children.Add(l); 163 | // Canvas.SetZIndex(l, 0); 164 | 165 | //} 166 | } 167 | 168 | private void Window_MouseMove_1(object sender, MouseEventArgs e) 169 | { 170 | Point myPoint = e.GetPosition(myCanvas); 171 | windowOrigin.X = myCanvas.ActualWidth / 2; 172 | windowOrigin.Y = myCanvas.ActualHeight / 2; 173 | cursorToolTip.HorizontalOffset = myPoint.X - 200; 174 | cursorToolTip.VerticalOffset = myPoint.Y - 200; 175 | cursorToolTip.Content = "(" + (myPoint.X) + ", -" + myPoint.Y + ")"; 176 | horizontalRuler.RaiseHorizontalRulerMoveEvent(e); 177 | verticalRuler.RaiseVerticalRulerMoveEvent(e); 178 | } 179 | 180 | private void myCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) 181 | { 182 | double x = (double)Convert.ToInt32(e.GetPosition(myCanvas).X); 183 | double y = (double)Convert.ToInt32(e.GetPosition(myCanvas).Y); 184 | Ellipse ellipse = new Ellipse(); 185 | ellipse.Width = 10; 186 | ellipse.Height = 10; 187 | ellipse.ToolTip = "(" + x + "," + y + ")"; 188 | ellipse.Fill = new SolidColorBrush(Colors.White); 189 | ellipse.StrokeThickness = 1; 190 | 191 | PointByMe myPoint = new PointByMe(x, y); 192 | myPoint = myPoint - origin; 193 | myPoint.y = -(myPoint.y); 194 | ellipse.ToolTip = "(" + myPoint.x + "," + myPoint.y + ")"; 195 | 196 | //myPoligon.advance(Rotation.CLOCKWISE); 197 | ////if(myPoligon!=null) 198 | // if(myPoligon.size()>0) MessageBox.Show("şu an point x değeri :"+myPoligon.point().x.ToString()); 199 | 200 | myPoligon.insert(myPoint); 201 | // cw() testi için bu döngü 202 | //for (int i = 0; i < myPoligon.size(); i++, myPoligon.cw()) //.advance(CG.Rotation.CLOCKWISE)) 203 | //{ 204 | // MessageBox.Show("i:"+ i + "\n"+ myPoligon.size() + "\n" +myPoligon.v().x.ToString() + "\n" +myPoligon.v().point().x.ToString()); 205 | //} 206 | 207 | 208 | myCanvas.Children.Add(ellipse); 209 | Canvas.SetLeft(ellipse, x); 210 | Canvas.SetTop(ellipse, y); 211 | ellipseList.Add(ellipse); 212 | 213 | myListBox.Items.Add(myPoint); 214 | } 215 | 216 | private void Window_MouseMove(object sender, MouseEventArgs e) 217 | { 218 | //Point myPoint = e.GetPosition(this); 219 | //cursorToolTip.HorizontalOffset = myPoint.X; 220 | //cursorToolTip.VerticalOffset = myPoint.Y; 221 | //windowOrigin.X = myCanvas.ActualWidth / 2; 222 | //windowOrigin.Y = myCanvas.ActualHeight / 2; 223 | //myPoint.Y = myPoint.Y; 224 | //cursorToolTip.Content = "(" + myPoint.X + "," + myPoint.Y + ")"; 225 | //horizontalRuler.RaiseHorizontalRulerMoveEvent(e); 226 | //verticalRuler.RaiseVerticalRulerMoveEvent(e); 227 | } 228 | 229 | 230 | } 231 | } 232 | -------------------------------------------------------------------------------- /RulerControlTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("RulerControlTest")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("RulerControlTest")] 15 | [assembly: AssemblyCopyright("Copyright © 2013")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /RulerControlTest/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18051 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace RulerControlTest.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RulerControlTest.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /RulerControlTest/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /RulerControlTest/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18051 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace RulerControlTest.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /RulerControlTest/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /RulerControlTest/RulerControlTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {5FC1C74A-7E6B-4ED3-B68F-C5D98D15271F} 8 | WinExe 9 | Properties 10 | RulerControlTest 11 | RulerControlTest 12 | v4.5 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | AnyCPU 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 4.0 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | MSBuild:Compile 54 | Designer 55 | 56 | 57 | MSBuild:Compile 58 | Designer 59 | 60 | 61 | App.xaml 62 | Code 63 | 64 | 65 | 66 | 67 | 68 | 69 | MainWindow.xaml 70 | Code 71 | 72 | 73 | 74 | 75 | Code 76 | 77 | 78 | True 79 | True 80 | Resources.resx 81 | 82 | 83 | True 84 | Settings.settings 85 | True 86 | 87 | 88 | ResXFileCodeGenerator 89 | Resources.Designer.cs 90 | 91 | 92 | SettingsSingleFileGenerator 93 | Settings.Designer.cs 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | {fbbd400b-7794-4538-9521-53b29f2416f1} 103 | RulerControl 104 | 105 | 106 | 107 | 114 | -------------------------------------------------------------------------------- /RulerControlTest/bin/Debug/RulerControl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/bin/Debug/RulerControl.dll -------------------------------------------------------------------------------- /RulerControlTest/bin/Debug/RulerControl.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/bin/Debug/RulerControl.pdb -------------------------------------------------------------------------------- /RulerControlTest/bin/Debug/RulerControlTest.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/bin/Debug/RulerControlTest.exe -------------------------------------------------------------------------------- /RulerControlTest/bin/Debug/RulerControlTest.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /RulerControlTest/bin/Debug/RulerControlTest.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/bin/Debug/RulerControlTest.pdb -------------------------------------------------------------------------------- /RulerControlTest/bin/Debug/RulerControlTest.vshost.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/bin/Debug/RulerControlTest.vshost.exe -------------------------------------------------------------------------------- /RulerControlTest/bin/Debug/RulerControlTest.vshost.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /RulerControlTest/bin/Debug/RulerControlTest.vshost.exe.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /RulerControlTest/comcomputationalGeometry.cs: -------------------------------------------------------------------------------- 1 | //using System; 2 | //using System.Collections.Generic; 3 | //using System.Linq; 4 | //using System.Text; 5 | //using System.Threading; 6 | //using System.Threading.Tasks; 7 | //using System.Windows.Media; 8 | //using System.Windows.Shapes; 9 | //using System.Windows.Threading; 10 | 11 | //namespace ConvexHullAlgorithm 12 | //{ 13 | 14 | // public enum TwoLines { COLLINEAR, PARALLEL, SKEW, SKEW_CROSS, SKEW_NO_CROSS }; 15 | // public enum Rotation { CLOCKWISE, COUNTERCLOCKWISE }; 16 | // public enum TopologyOrientation { LEFT, RIGHT, BEHIND, BEYOND, ORIGIN, DESTINATION, BETWEEN }; 17 | 18 | // // BU UÇ CLASS I YAZALIM BERABER ......... 19 | // public class PointByMe 20 | // { 21 | 22 | // public double x; 23 | // public double y; 24 | // override public string ToString() 25 | // { 26 | // string s = 27 | // " " + 28 | // "x : " + this.x + " " + 29 | // "y : " + this.y + "\n" + 30 | // "length : " + this.length() + "\n" + 31 | // "polarAngle: " + this.polarAngle(); 32 | // //+"\n"+"------------------"; 33 | // return s; 34 | // } 35 | 36 | // public PointByMe(double _x, double _y) 37 | // { 38 | // x = _x; 39 | // y = _y; 40 | // } 41 | // public PointByMe(PointByMe p) 42 | // { 43 | // this.x = p.x; 44 | // this.y = p.y; 45 | // } 46 | // public static PointByMe operator +(PointByMe obj1, PointByMe obj2) 47 | // { 48 | // return (new PointByMe(obj1.x + obj2.x, obj1.y + obj2.y)); 49 | // } 50 | 51 | // public static PointByMe operator -(PointByMe obj1, PointByMe obj2) 52 | // { 53 | // return (new PointByMe(obj1.x - obj2.x, obj1.y - obj2.y)); 54 | // } 55 | 56 | // public static PointByMe operator *(double obj1, PointByMe obj2) 57 | // { 58 | // return (new PointByMe(obj1 * obj2.x, obj1 * obj2.y)); 59 | // } 60 | 61 | // public static Boolean operator ==(PointByMe a, PointByMe b) 62 | // { 63 | // return ((a.x == b.x && a.y == b.y)); 64 | 65 | // } 66 | // public static Boolean operator !=(PointByMe a, PointByMe b) 67 | // { 68 | // return !(a == b); 69 | // } 70 | 71 | // public static bool operator <(PointByMe a, PointByMe b) 72 | // { 73 | // return ( 74 | // (a.x < b.x && a.y < b.y) 75 | // ); 76 | // } 77 | // public static bool operator >(PointByMe a, PointByMe b) 78 | // { 79 | // return ( 80 | // (a.x > b.x && a.y > b.y) 81 | // ); 82 | // } 83 | // public int CompareTo(PointByMe obj) 84 | // { 85 | 86 | // if (this < obj) 87 | // return -1; 88 | // else if (this == obj) 89 | // return 0; 90 | // else return 1; 91 | // //throw new NotImplementedException(); 92 | // } 93 | // public TopologyOrientation classify(PointByMe p0, PointByMe p1) 94 | // { 95 | // PointByMe p2 = this; 96 | // PointByMe a = p1 - p0; 97 | // PointByMe b = p2 - p0; 98 | // double SignedArea = a.x * b.y - b.x * a.y; 99 | // if (SignedArea > 0.0) 100 | // return TopologyOrientation.LEFT; 101 | // else if (SignedArea < 0.0) 102 | // return TopologyOrientation.RIGHT; 103 | // else if (a.x * b.x < 0.0 || (a.y * b.y < 0.0)) // zıt işaretli ters yönde , biri eşit olabilir 104 | // return TopologyOrientation.BEHIND; 105 | // else if (a.length() < b.length()) 106 | // return TopologyOrientation.BEYOND; 107 | // else if (p0 == p2) 108 | // return TopologyOrientation.ORIGIN; 109 | // else if (p1 == p2) 110 | // return TopologyOrientation.DESTINATION; 111 | // else 112 | // return TopologyOrientation.BETWEEN; 113 | 114 | 115 | // } 116 | // public TopologyOrientation classify(Edge e) 117 | // { 118 | // return classify(e.org, e.dest); 119 | // //return TopologyOrientation.Left; 120 | // } 121 | // public double polarAngle() 122 | // { 123 | // if ((x == 0.0) && (y == 0.0)) 124 | // return -1.0; 125 | // else if (x == 0.0) 126 | // return ((y > 0.0) ? 90 : 270); 127 | // double theta = Math.Atan(y / x); // in radians 128 | // theta *= 360 / (2 * Math.PI); // convert to degrees 129 | // if (x > 0.0) // quadrants 1 and 4 130 | // return ((y >= 0.0) ? theta : 360 + theta); 131 | // else // quadrants 2 and 3 132 | // return (180 + theta); 133 | // } 134 | // public double length() 135 | // { 136 | // return Math.Sqrt(x * x + y * y); 137 | // } 138 | // public double distance(Edge obj1) 139 | // { 140 | // return 0.0; 141 | // } 142 | // public override int GetHashCode() 143 | // { 144 | // return base.GetHashCode(); 145 | // } 146 | // public override bool Equals(object obj) 147 | // { 148 | // return base.Equals(obj); 149 | // } 150 | // //public override string ToString() 151 | // //{ 152 | // // return base.ToString(); 153 | // //} 154 | 155 | 156 | 157 | // } 158 | // public class Vertex : PointByMe 159 | // { 160 | // private LinkedListNode current; 161 | // static public LinkedList list; 162 | 163 | 164 | // public Vertex v() 165 | // { 166 | 167 | // return current.Value; 168 | // } 169 | // public Vertex insert(PointByMe point) 170 | // { 171 | // if (list == null) 172 | // { 173 | 174 | // current = new LinkedListNode(new Vertex(point)); 175 | // list = new LinkedList(); 176 | // list.AddFirst(current); 177 | // return current.Value; 178 | 179 | // } 180 | // else 181 | // { 182 | 183 | // current.List.AddAfter(current, new Vertex(point)); 184 | // return current.Next.Value; 185 | // } 186 | 187 | 188 | // } 189 | 190 | 191 | // public Vertex(double x, double y) 192 | // : base(x, y) 193 | // { 194 | 195 | // } 196 | 197 | 198 | // public Vertex(PointByMe point) 199 | // : base(point) 200 | // { 201 | 202 | // } 203 | 204 | // public PointByMe point() 205 | // { 206 | // return this; 207 | // } 208 | // public Vertex remove() 209 | // { 210 | // current = current.Next; 211 | // Vertex temp = current.Previous.Value; 212 | // list.Remove(current.Previous); 213 | 214 | // return temp; 215 | // } 216 | 217 | // public Vertex split(Vertex b) 218 | // { 219 | // Vertex v = cw(); 220 | // while (v != b) 221 | // { 222 | // list.Remove(list.Find(v)); 223 | // v = cw(); 224 | // } 225 | // return current.Value; 226 | // } 227 | // public Vertex neighbor(Rotation rotation) 228 | // { 229 | // return ((rotation == Rotation.CLOCKWISE) ? cw() : ccw()); 230 | // } 231 | // public Vertex cw() 232 | // { 233 | // if (current.Next == null) 234 | // { 235 | // return list.First.Value; 236 | 237 | // } 238 | 239 | // return current.Next.Value; 240 | // } 241 | // public Vertex ccw() 242 | // { 243 | // if (current.Previous == null) 244 | // { 245 | // return list.Last.Value; 246 | 247 | // } 248 | // return current.Previous.Value; 249 | // } 250 | 251 | // public Vertex advance(Rotation rotation) 252 | // { 253 | // if (rotation == Rotation.CLOCKWISE) 254 | // { 255 | // if (current.Next != null) 256 | // { 257 | // current = current.Next; 258 | 259 | // } 260 | // else 261 | // { 262 | // current = current.List.First; 263 | // } 264 | // } 265 | // else 266 | // { 267 | // if (current.Previous != null) 268 | // { 269 | // current = current.Previous; 270 | 271 | // } 272 | // else 273 | // { 274 | // current = current.List.Last; 275 | // } 276 | // } 277 | // return current.Value; 278 | 279 | // } 280 | 281 | 282 | 283 | // internal void find(Vertex vertex) 284 | // { 285 | // current = list.Find(vertex); 286 | // } 287 | // } 288 | // public class Edge 289 | // { 290 | // public PointByMe org; 291 | // public PointByMe dest; 292 | // public Edge(PointByMe _org, PointByMe _dest) 293 | // { 294 | // org = _org; 295 | // dest = _dest; 296 | // } 297 | // public Edge() 298 | // { 299 | // org = new PointByMe(0.0, 0.0); 300 | // dest = new PointByMe(1.0, 0.0); 301 | // } 302 | // public Edge rot() 303 | // { 304 | // PointByMe m = 0.5 * (org + dest); 305 | // PointByMe v = dest - org; 306 | // PointByMe n = new PointByMe(v.y, -(v.x)); 307 | // org = m - 0.5 * n; 308 | // dest = m + 0.5 * n; 309 | // return this; 310 | // } 311 | // public Edge flip() 312 | // { 313 | // return this.rot().rot(); 314 | // } 315 | // PointByMe point(double t) 316 | // { 317 | // return (new PointByMe(org + t * (dest - org))); 318 | // } 319 | // TwoLines intersect(Edge e, ref double t) 320 | // { 321 | // PointByMe a = org; 322 | // PointByMe b = dest; 323 | // PointByMe c = e.org; 324 | // PointByMe d = e.dest; 325 | // PointByMe n = new PointByMe((d - c).y, (c - d).x); 326 | // double denom = n.x * (b - a).x + n.y * (b - a).y; //dotProduct(n, b-a); 327 | // if (denom == 0.0) 328 | // { 329 | // TopologyOrientation aclass = org.classify(e); 330 | // if ((aclass == TopologyOrientation.LEFT) || (aclass == TopologyOrientation.RIGHT)) 331 | // return TwoLines.PARALLEL; 332 | // else 333 | // return TwoLines.COLLINEAR; 334 | // } 335 | // double num = n.x * (a - c).x + n.y * (a - c).y; //dotProduct(n, b-a); 336 | // t = -num / denom; 337 | // return TwoLines.SKEW; 338 | // } 339 | 340 | // //int cross(Edge&, double&); 341 | // public bool isVertical() 342 | // { 343 | // return (org.x == dest.x); 344 | // } 345 | // double slope() 346 | // { 347 | // if (org.x != dest.x) 348 | // return (dest.y - org.y) / (dest.x - org.x); 349 | // return Double.MaxValue; 350 | // } 351 | // double y(double x) 352 | // { 353 | // return slope() * (x - org.x) + org.y; 354 | // } 355 | 356 | // } 357 | // public class Polygon 358 | // { 359 | 360 | // Vertex _v; 361 | 362 | // public Polygon() 363 | // { 364 | // _v = new Vertex(0, 0); 365 | 366 | // } 367 | 368 | // public Vertex v() 369 | // { 370 | // return _v.v(); 371 | // } 372 | // public int size() 373 | // { 374 | // return Vertex.list.Count; 375 | // } 376 | // public PointByMe point() 377 | // { 378 | // return v(); 379 | // } 380 | 381 | // public Edge edge() 382 | // { 383 | // return new Edge(_v.point(), _v.cw()); 384 | // } 385 | // public Vertex cw() 386 | // { 387 | // return _v.cw(); 388 | // } 389 | // public Vertex ccw() 390 | // { 391 | // return _v.ccw(); 392 | // } 393 | // public Vertex advance(Rotation rotation) 394 | // { 395 | // return _v.advance(rotation); 396 | // } 397 | // public Vertex neighbor(Rotation rotation) 398 | // { 399 | // return _v.neighbor(rotation); 400 | // } 401 | // public Vertex insert(PointByMe point) 402 | // { 403 | 404 | // return _v.insert(point); 405 | // } 406 | // public Vertex remove() 407 | // { 408 | // return _v.remove(); 409 | // } 410 | // public Vertex setV(Vertex vertex) 411 | // { 412 | // _v.find(vertex); 413 | // return vertex; 414 | // } 415 | // public Vertex split(Vertex vertex) 416 | // { 417 | // return _v.split(vertex); 418 | // } 419 | // } 420 | // public static class utility 421 | // { 422 | // static PointByMe originPt; 423 | // public static System.Windows.Shapes.Rectangle getRectangle(PointByMe p, PointByMe org) 424 | // { 425 | // //x = myList.ElementAt(selected_list_index_current).x + origin.x; //(double)Convert.ToInt32(e.GetPosition(myCanvas).X); 426 | // //y = -(myList.ElementAt(selected_list_index_current).y) + origin.y; //(double)Convert.ToInt32(e.GetPosition(myCanvas).Y); 427 | // double x = p.x + org.x; 428 | // double y = p.y + org.y; 429 | 430 | // Rectangle myRectangle = new Rectangle(); 431 | 432 | // myRectangle.Width = 10; 433 | // myRectangle.Height = 10; 434 | // myRectangle.Fill = new SolidColorBrush(Colors.Red); 435 | // //myRectangle.ToolTip = myList.ElementAt(selected_list_index_current).ToString(); 436 | // //myCanvas.Children.Add(myRectangle); 437 | // //Canvas.SetLeft(myRectangle, x); 438 | // //Canvas.SetTop(myRectangle, y); 439 | // return myRectangle; 440 | // } 441 | 442 | // public static PointByMe reversePoint(PointByMe point) 443 | // { 444 | // point.y = -point.y; 445 | // point = point + MainWindow.origin; 446 | // return new PointByMe(point.x, point.y); 447 | // } 448 | 449 | // public static PointByMe leastPoint(PointByMe org, System.Collections.Generic.List l) 450 | // { 451 | // PointByMe bestP = l.ElementAt(1); 452 | // PointByMe testP = new PointByMe(0, 0); 453 | // for (int i = 1; i < l.Count; i++) 454 | // { 455 | // testP = l.ElementAt(i); 456 | // //if (bestP == testP) continue; 457 | // if ( 458 | // (testP - org).length() < (bestP - org).length() 459 | // ) 460 | // bestP = testP; 461 | // } 462 | // return bestP; 463 | // } 464 | 465 | // public static bool pointInConvexPolygon(PointByMe s, Polygon p) // Edge sınıfına ihtiyaç var 466 | // { 467 | // //throw new InvalidOperationException("Implement edilmedi"); 468 | // if (p.size() == 1) return (s == p.point()); 469 | // if (p.size() == 2) 470 | // { 471 | // TopologyOrientation c = s.classify(p.edge()); 472 | // return ((c == TopologyOrientation.BETWEEN) || (c == TopologyOrientation.ORIGIN) | (c == TopologyOrientation.DESTINATION)); 473 | // } 474 | // Vertex org = p.v(); 475 | // for (int i = 0; i < p.size(); i++, p.advance(Rotation.CLOCKWISE)) 476 | // { 477 | // if (s.classify(p.edge()) == TopologyOrientation.LEFT) 478 | // { 479 | // p.setV(org); 480 | // return false; 481 | // } 482 | // } 483 | // return true; 484 | // } 485 | 486 | // static PointByMe somePoint; 487 | // //public static Polygon insertionHull(List s) 488 | // //{ 489 | // // List myListG = new List(); 490 | // // Polygon p = new Polygon(); 491 | // // p.insert(s.ElementAt(0)); 492 | // // for (int i = 1; i < s.Count; i++) 493 | // // { 494 | // // if (pointInConvexPolygon(s.ElementAt(i), p)) 495 | // // { 496 | // // continue; 497 | // // } 498 | // // somePoint = s.ElementAt(i); 499 | // // leastVertex(p, closestToPolygonCmp(s.ElementAt(i), p.v().point())); 500 | // // supportingLine(s.ElementAt(i), p, TopologyOrientation.LEFT); 501 | // // Vertex l = p.v(); 502 | // // supportingLine(s.ElementAt(i), p, TopologyOrientation.RIGHT); 503 | // // p.insert(s.ElementAt(i)); 504 | // // } 505 | // // return p; 506 | // //} 507 | // public static void supportingLine(PointByMe s, Polygon p, TopologyOrientation side) 508 | // { 509 | // Rotation rotation; 510 | // if (side == ConvexHullAlgorithm.TopologyOrientation.LEFT) 511 | // rotation = Rotation.CLOCKWISE; 512 | // else 513 | // rotation = Rotation.COUNTERCLOCKWISE; 514 | // //TopologyOrientation rotation = (side == TopologyOrientation.LEFT) ? Rotation.CLOCKWISE : Rotation.COUNTERCLOCKWISE; 515 | // //int rotation = (side == (int)TopologyOrientation.LEFT) ? (int)Rotation.CLOCKWISE : (int)Rotation.COUNTERCLOCKWISE; 516 | // Vertex av = p.v(); 517 | // PointByMe ap = p.point(); 518 | // Vertex bv = p.neighbor((Rotation)rotation); 519 | // PointByMe bp = p.neighbor((Rotation)rotation).point(); 520 | // TopologyOrientation c = bp.classify(s, ap); 521 | // while ((c == side) || (c == TopologyOrientation.BEYOND) || (c == TopologyOrientation.BETWEEN)) 522 | // { 523 | // p.advance((Rotation)rotation); 524 | // av = p.v(); 525 | // ap = p.point(); 526 | // bv = p.neighbor((Rotation)rotation); 527 | // bp = p.neighbor((Rotation)rotation).point(); 528 | // c = bp.classify(s, ap); 529 | // } 530 | // } 531 | 532 | // static int polarCmp(PointByMe p, PointByMe q) 533 | // { 534 | // PointByMe vp = p - originPt; 535 | // PointByMe vq = q - originPt; 536 | // double pPolar = vp.polarAngle(); 537 | // double qPolar = vq.polarAngle(); 538 | // if (pPolar < qPolar) return -1; 539 | // if (pPolar > qPolar) return 1; 540 | // if (vp.length() < vq.length()) return -1; 541 | // if (vp.length() > vq.length()) return 1; 542 | // return 0; 543 | // } 544 | 545 | // public static Vertex leastVertex(Polygon p1) 546 | // { 547 | // Vertex bestV = p1.v(); 548 | // p1.advance(Rotation.CLOCKWISE); 549 | // for (int i = 1; i < p1.size(); p1.advance(Rotation.CLOCKWISE), i++) 550 | // { 551 | // if (p1.v().point().polarAngle() < bestV.point().polarAngle()) 552 | // { 553 | // bestV = p1.v(); 554 | // } 555 | // } 556 | // p1.setV(bestV); 557 | // return bestV; 558 | // } 559 | 560 | // //public static double closestToPolygonCmp(PointByMe a, PointByMe b) 561 | // //{ 562 | // // //double distA = (somePoint - a).length(); 563 | // // //double distB = (somePoint - b).length(); 564 | // // //if (distA < distB) return -1; 565 | // // //else if (distA > distB) return 1; 566 | // // //return 0; 567 | 568 | // // double l = Math.Sqrt(Math.Pow((a.x - b.x), 2) + Math.Pow((a.y - b.y), 2)); 569 | // // return l; 570 | // //} 571 | 572 | // //internal static void pointToConvexPolygon(Polygon myPoligon, LinkedList sortedPolygon, LinkedList sortedEllipseList, Dispatcher dis, System.Windows.Controls.Canvas canvas) 573 | // //{ 574 | // // List list = new List(); 575 | // // List lineList = new List(); 576 | // // #region ilk 3 nokta ile polygon 577 | // // for (int i = 0; i < 3; i++) 578 | // // { 579 | // // list.Add(sortedPolygon.ElementAt(i)); 580 | // // dis.BeginInvoke(new Action(() => 581 | // // { sortedEllipseList.ElementAt(i).Fill = new SolidColorBrush(Colors.Red); })); 582 | // // Thread.Sleep(1000); 583 | 584 | // // dis.BeginInvoke(new Action(() => 585 | // // { 586 | // // Line l = new Line(); 587 | // // PointByMe p1 = new PointByMe(list.ElementAt(0).x, list.ElementAt(0).y); 588 | // // PointByMe p2 = new PointByMe(list.ElementAt(i - 1).x, list.ElementAt(i - 1).y); 589 | // // p1 = utility.reversePoint(p1); 590 | // // p2 = utility.reversePoint(p2); 591 | // // l.X1 = p1.x; 592 | // // l.Y1 = p1.y; 593 | // // l.X2 = p2.x; 594 | // // l.Y2 = p2.y; 595 | // // l.VerticalAlignment = System.Windows.VerticalAlignment.Center; 596 | // // l.Stroke = System.Windows.Media.Brushes.LightYellow; 597 | 598 | // // l.StrokeThickness = 2; 599 | // // canvas.Children.Add(l); 600 | // // lineList.Add(l); 601 | // // })); 602 | // // } 603 | // // Thread.Sleep(1000); 604 | // // dis.BeginInvoke(new Action(() => 605 | // // { 606 | // // Line l = new Line(); 607 | // // PointByMe p1 = new PointByMe(list.ElementAt(2).x, list.ElementAt(2).y); 608 | // // PointByMe p2 = new PointByMe(list.ElementAt(1).x, list.ElementAt(1).y); 609 | // // p1 = utility.reversePoint(p1); 610 | // // p2 = utility.reversePoint(p2); 611 | // // l.X1 = p1.x; 612 | // // l.Y1 = p1.y; 613 | // // l.X2 = p2.x; 614 | // // l.Y2 = p2.y; 615 | // // l.VerticalAlignment = System.Windows.VerticalAlignment.Center; 616 | // // l.Stroke = System.Windows.Media.Brushes.LightYellow; 617 | 618 | // // l.StrokeThickness = 2; 619 | // // canvas.Children.Add(l); 620 | // // lineList.Add(l); 621 | // // })); 622 | // // Thread.Sleep(1000); 623 | // // #endregion 624 | 625 | // // for (int i = 3; i < myPoligon.size(); i++) 626 | // // { 627 | // // list.Add(sortedPolygon.ElementAt(i)); 628 | // // } 629 | // // //for (int i = 0; i < list.Count; i++) 630 | // // //{ 631 | // // // if (pointInConvexPolygon(list.ElementAt(i), myPoligon)) 632 | // // // { 633 | // // // continue; 634 | // // // } 635 | // // // else 636 | // // // { 637 | // // // somePoint = list.ElementAt(i); 638 | // // // leastVertex(myPoligon, closestToPolygonCmp(list.ElementAt(i), myPoligon.v().point())); 639 | // // // supportingLine(list.ElementAt(i), myPoligon, (int)TopologyOrientation.LEFT); 640 | // // // Vertex l = myPoligon.v(); 641 | // // // supportingLine(list.ElementAt(i), myPoligon, (int)TopologyOrientation.RIGHT); 642 | // // // myPoligon.insert(list.ElementAt(i)); 643 | // // // } 644 | // // //} 645 | // // for (int i = 3; i < list.Count(); i++) 646 | // // { 647 | // // for (int j = 0; j < i; j++) 648 | // // { 649 | // // PointByMe point = list.ElementAt(i); 650 | // // PointByMe po = list.ElementAt(j); 651 | // // PointByMe po1 = list.ElementAt(j + 1); 652 | // // PointByMe enYakin = po; 653 | // // if (!pointInConvexPolygon(point, myPoligon)) 654 | // // { 655 | // // if (closestToPolygonCmp(point, po) > closestToPolygonCmp(point, po1)) 656 | // // { 657 | // // enYakin = po1; 658 | // // int temp = pointIndex(list.ElementAt(i), sortedPolygon); 659 | // // Thread.Sleep(1000); 660 | // // dis.BeginInvoke(new Action(() => 661 | // // { sortedEllipseList.ElementAt(temp).Fill = new SolidColorBrush(Colors.Green); })); 662 | // // Thread.Sleep(1000); 663 | // // dis.BeginInvoke(new Action(() => 664 | // // { 665 | // // Line myLine = new Line(); 666 | // // PointByMe point1 = new PointByMe(point.x, point.y); 667 | // // PointByMe point2 = new PointByMe(enYakin.x, enYakin.y); 668 | // // point1 = utility.reversePoint(point1); 669 | // // point2 = utility.reversePoint(point2); 670 | // // myLine.X1 = point1.x; 671 | // // myLine.Y1 = point1.y; 672 | // // myLine.X2 = point2.x; 673 | // // myLine.Y2 = point2.y; 674 | // // myLine.VerticalAlignment = System.Windows.VerticalAlignment.Center; 675 | // // myLine.Stroke = System.Windows.Media.Brushes.LightYellow; 676 | 677 | // // myLine.StrokeThickness = 2; 678 | // // canvas.Children.Add(myLine); 679 | 680 | // // lineList.Add(myLine); 681 | // // canvas.Children.Remove(lineList.ElementAt(i)); 682 | 683 | // // })); 684 | // // Thread.Sleep(1000); 685 | // // dis.BeginInvoke(new Action(() => 686 | // // { sortedEllipseList.ElementAt(temp).Fill = new SolidColorBrush(Colors.Red); })); 687 | // // //list.RemoveAt(0); 688 | // // } 689 | // // } 690 | // // } 691 | // // } 692 | // //} 693 | // public static int pointIndex(PointByMe point, LinkedList list) 694 | // { 695 | // for (int i = 0; i < list.Count; i++) 696 | // { 697 | // if (list.ElementAt(i) == point) 698 | // { 699 | // return i; 700 | // } 701 | // } 702 | // return -1; 703 | // } 704 | // } 705 | //} 706 | -------------------------------------------------------------------------------- /RulerControlTest/derya.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Media; 10 | using System.Windows.Shapes; 11 | using System.Windows.Threading; 12 | using CG; 13 | 14 | 15 | namespace ConvexHullAlgorithm 16 | { 17 | class derya 18 | { 19 | 20 | public static List myLineList = new List(); 21 | public static List myEllipseList = new List(); 22 | 23 | public static void drawPoints(PointByMe testPoint, List pnts,System.Windows.Controls.Canvas canvas) 24 | { 25 | canvas.Children.Clear(); 26 | if (myEllipseList.Count > 0) 27 | { 28 | foreach (Ellipse e in myEllipseList) 29 | canvas.Children.Remove(e); 30 | myEllipseList.Clear(); 31 | } 32 | 33 | foreach(PointByMe p in pnts) 34 | { 35 | Ellipse e=new Ellipse(); 36 | e.Width=10; 37 | e.Height=10; 38 | e.Fill=Brushes.White; 39 | Canvas.SetLeft(e, p.x); 40 | Canvas.SetTop(e, -p.y); 41 | canvas.Children.Add(e); 42 | myEllipseList.Add(e); 43 | } 44 | 45 | Ellipse e1 = new Ellipse(); 46 | e1.Width = 10; 47 | e1.Height = 10; 48 | e1.Fill = Brushes.Red; 49 | Canvas.SetLeft(e1, testPoint.x); 50 | Canvas.SetTop(e1, -testPoint.y); 51 | canvas.Children.Add(e1); 52 | myEllipseList.Add(e1); 53 | } 54 | public static void drawPoligon(CG.Polygon mP,System.Windows.Controls.Canvas canvas){ 55 | 56 | if (myLineList.Count > 0) 57 | { 58 | foreach (Line l in myLineList) 59 | canvas.Children.Remove(l); 60 | myLineList.Clear(); 61 | } 62 | // MessageBox.Show("önceki poligon nokta sayısı : " + derya.myLineList.Count + " şu anki poligon nokta sayısı : " + mP.size()); 63 | PointByMe p1;// = new PointByMe(p.v().point().x, p.v().point().y); 64 | PointByMe p2;// = new PointByMe(p.v().cw().point().x, p.cw().point().y); 65 | 66 | for (int i = 0; i < mP.size()+1; i++,mP.cw()) // neden +1 67 | { 68 | Line line = new Line(); 69 | p1 = mP.point(); //, p.v().point().y); 70 | p2 = mP.v().cw().point(); //, p.cw().point().y); 71 | p1 = utility.reversePoint(p1); 72 | p2 = utility.reversePoint(p2); 73 | line.X1 = p1.x; 74 | line.Y1 =Math.Abs(p1.y); 75 | line.X2 = p2.x; 76 | line.Y2 =Math.Abs(p2.y); 77 | line.VerticalAlignment = System.Windows.VerticalAlignment.Center; 78 | line.Stroke = System.Windows.Media.Brushes.LightYellow; 79 | 80 | line.StrokeThickness = 2; 81 | canvas.Children.Add(line); 82 | myLineList.Add(line); 83 | 84 | } 85 | //MessageBox.Show("çizilen poligon doğru mu !!!"); 86 | } 87 | public static string poligonListString(CG.Polygon myPoligon) 88 | { 89 | 90 | string s = "poligon size : " + myPoligon.size(); 91 | s += "\n noktalar : \n**"; 92 | 93 | for (int i = 0; i < myPoligon.size(); i++, myPoligon.cw()) 94 | s += myPoligon.point().x + "**"; 95 | return s; 96 | //MessageBox.Show(s); 97 | } 98 | public static void poligonList(CG.Polygon myPoligon) 99 | { 100 | 101 | string s = "poligon size : " + myPoligon.size(); 102 | s += "\n noktalar : \n**"; 103 | 104 | for (int i = 0; i < myPoligon.size(); i++, myPoligon.cw()) 105 | s += myPoligon.point().x + "**"; 106 | 107 | MessageBox.Show(s); 108 | } 109 | public static int tegetBul_Right(List pl, PointByMe po) 110 | { 111 | double d = double.MaxValue; 112 | PointByMe closestPoint = new PointByMe(0, 0); 113 | foreach (PointByMe temp in pl) 114 | { 115 | if ((temp - po).length() < d) closestPoint = temp; 116 | } 117 | foreach (PointByMe temp in pl) 118 | { 119 | Edge e = new Edge(temp, po); 120 | bool testStatus = true; 121 | foreach (PointByMe temp1 in pl) 122 | { 123 | if (temp1.classify(e) == TopologyOrientation.LEFT) testStatus = false; 124 | } 125 | if (testStatus == true) return pl.IndexOf(temp); 126 | 127 | } 128 | return pl.Count - 1; 129 | } 130 | public static int tegetBul_Left(List pl, PointByMe po) 131 | { 132 | double d = double.MaxValue; 133 | PointByMe closestPoint = new PointByMe(0, 0); 134 | foreach (PointByMe temp in pl) 135 | { 136 | if ((temp - po).length() < d) closestPoint = temp; 137 | } 138 | foreach (PointByMe temp in pl) 139 | { 140 | Edge e = new Edge(temp, po); 141 | bool testStatus = true; 142 | foreach (PointByMe temp1 in pl) 143 | { 144 | if (temp1.classify(e) == TopologyOrientation.RIGHT) testStatus = false; 145 | } 146 | if (testStatus == true) return pl.IndexOf(temp); 147 | } 148 | return pl.Count - 1; 149 | } 150 | public static List teget_Delete(List pl, int l, int r) 151 | { 152 | List newPoligon = new List(); 153 | foreach (PointByMe t in pl) 154 | { 155 | newPoligon.Add(t); 156 | } 157 | newPoligon.RemoveRange(l + 1, r - 1); 158 | return newPoligon; 159 | } 160 | //public static bool pointInConvexPolygon(PointByMe po, List pl) 161 | //{ 162 | // bool status = true; 163 | // for (int i = 0; i < pl.Count - 1; i++) 164 | // { 165 | // Edge e = new Edge(pl[i], pl[i + 1]); 166 | // if (po.classify(e) == TopologyOrientation.LEFT) 167 | // return false; 168 | 169 | // } 170 | // return status; 171 | //} 172 | //public static List convex_Uret(List pl, LinkedList sortedEllipseList, Dispatcher dis, System.Windows.Controls.Canvas canvas) 173 | //{ 174 | // List newPoligon = new List(); 175 | // newPoligon.Add(pl[0]); 176 | // newPoligon.Add(pl[1]); 177 | 178 | // for (int i = 0; i < 2; i++) 179 | // { 180 | // dis.BeginInvoke(new Action(() => 181 | // { sortedEllipseList.ElementAt(i).Fill = new SolidColorBrush(Colors.Red); })); 182 | // Thread.Sleep(500); 183 | // } 184 | // dis.BeginInvoke(new Action(() => 185 | // { 186 | // Line l = new Line(); 187 | // PointByMe p1 = new PointByMe(newPoligon.ElementAt(0).x, newPoligon.ElementAt(0).y); 188 | // PointByMe p2 = new PointByMe(newPoligon.ElementAt(1).x, newPoligon.ElementAt(1).y); 189 | // p1 = utility.reversePoint(p1); 190 | // p2 = utility.reversePoint(p2); 191 | // l.X1 = p1.x; 192 | // l.Y1 = p1.y; 193 | // l.X2 = p2.x; 194 | // l.Y2 = p2.y; 195 | // l.VerticalAlignment = System.Windows.VerticalAlignment.Center; 196 | // l.Stroke = System.Windows.Media.Brushes.LightYellow; 197 | 198 | // l.StrokeThickness = 2; 199 | // canvas.Children.Add(l); 200 | // })); 201 | // Thread.Sleep(500); 202 | 203 | // int l_teget = 0, r_teget = 0; 204 | // //for(int i=2;<) 205 | // for (int i = 2; i < pl.Count; i++) 206 | // { 207 | // PointByMe point = pl[i]; 208 | // if (pointInConvexPolygon(pl[i], newPoligon) == true) continue; 209 | // else 210 | // { 211 | 212 | // for (int i1 = 2; i1 < pl.Count; i1++) 213 | 214 | // l_teget = tegetBul_Left(newPoligon, pl[i1]); 215 | 216 | // for (int i2 = 2; i2 < pl.Count; i2++) 217 | // r_teget = tegetBul_Right(newPoligon, pl[i2]); 218 | 219 | // Thread.Sleep(500); 220 | // dis.BeginInvoke(new Action(() => 221 | // { sortedEllipseList.ElementAt(i).Fill = new SolidColorBrush(Colors.Green); })); 222 | // Thread.Sleep(500); 223 | // dis.BeginInvoke(new Action(() => 224 | // { 225 | // Line l = new Line(); 226 | // PointByMe p1 = new PointByMe(point.x, point.y); 227 | // PointByMe p2 = new PointByMe(pl[l_teget].x, pl[l_teget].y); 228 | // p1 = utility.reversePoint(p1); 229 | // p2 = utility.reversePoint(p2); 230 | // l.X1 = p1.x; 231 | // l.Y1 = p1.y; 232 | // l.X2 = p2.x; 233 | // l.Y2 = p2.y; 234 | // l.VerticalAlignment = System.Windows.VerticalAlignment.Center; 235 | // l.Stroke = System.Windows.Media.Brushes.LightYellow; 236 | 237 | // l.StrokeThickness = 2; 238 | // canvas.Children.Add(l); 239 | // })); 240 | // Thread.Sleep(500); 241 | // dis.BeginInvoke(new Action(() => 242 | // { sortedEllipseList.ElementAt(i).Fill = new SolidColorBrush(Colors.Red); })); 243 | // Thread.Sleep(500); 244 | // dis.BeginInvoke(new Action(() => 245 | // { 246 | // Line l = new Line(); 247 | // PointByMe p1 = new PointByMe(point.x, point.y); 248 | // PointByMe p2 = new PointByMe(pl[r_teget].x, pl[r_teget].y); 249 | // p1 = utility.reversePoint(p1); 250 | // p2 = utility.reversePoint(p2); 251 | // l.X1 = p1.x; 252 | // l.Y1 = p1.y; 253 | // l.X2 = p2.x; 254 | // l.Y2 = p2.y; 255 | // l.VerticalAlignment = System.Windows.VerticalAlignment.Center; 256 | // l.Stroke = System.Windows.Media.Brushes.LightYellow; 257 | 258 | // l.StrokeThickness = 2; 259 | // canvas.Children.Add(l); 260 | // })); 261 | // Thread.Sleep(500); 262 | 263 | // newPoligon.Add(pl[i]); 264 | // //newPoligon = teget_Delete(newPoligon, l_teget, r_teget); 265 | // } 266 | 267 | // } 268 | // return newPoligon; 269 | //} 270 | 271 | public static CG.Polygon convex_Uret(CG.Polygon mP, Dispatcher dis, System.Windows.Controls.Canvas canvas) 272 | { 273 | PointByMe somePoint = new PointByMe(0, 0); 274 | List s = new List(); 275 | CG.Polygon p = new CG.Polygon(); 276 | 277 | 278 | //mP.advance(Rotation.COUNTERCLOCKWISE); 279 | string ss=""; 280 | for (int i = 0; i < mP.size(); i++) 281 | { 282 | if(mP.v().point().y>0) mP.v().point().y = -mP.v().point().y; 283 | s.Add(mP.point()); 284 | ss += mP.v().point().x + " "; 285 | mP.advance(Rotation.CLOCKWISE); 286 | } 287 | 288 | //MessageBox.Show(ss); 289 | p.insert(s[0]);//p.advance(Rotation.CLOCKWISE); 290 | p.insert(s[1]);//p.advance(Rotation.CLOCKWISE); 291 | p.insert(s[2]);//p.advance(Rotation.CLOCKWISE); 292 | 293 | drawPoligon(p, canvas); 294 | //poligonList(p); 295 | 296 | PointByMe temp1 = p.v().point(); 297 | 298 | for (int iiii = 0; iiii < p.size(); iiii++, p.cw()) 299 | if (p.point().y > 0) p.point().y = -p.point().y; 300 | 301 | for (; p.v() != temp1; p.cw()) ; 302 | 303 | for (int i = 3; i < s.Count; i++) 304 | { 305 | 306 | somePoint = s[i]; 307 | canvas.Children.Clear(); 308 | //MessageBox.Show("şu an canvas boş..."); 309 | drawPoints(somePoint,s,canvas); 310 | drawPoligon(p,canvas); 311 | //MessageBox.Show("şu an canvas dolu mu ..."); 312 | if (somePoint.y>0) somePoint.y = -somePoint.y; 313 | // new inside test 314 | bool isInside = true; 315 | temp1 = p.v().point(); // no change on active vertex 316 | for (int i5 = 0; i5 < p.size(); i5++, p.advance(Rotation.CLOCKWISE)) 317 | { 318 | temp1 = p.v().point(); 319 | 320 | for (int iiii = 0; iiii < p.size(); iiii++, p.cw()) 321 | if (p.point().y > 0) p.point().y = -p.point().y; 322 | 323 | for (; p.v() != temp1; p.cw()) ; 324 | 325 | if (s[i].classify(p.edge()) == TopologyOrientation.LEFT) // x e simetri olduğu için tersini aldık 326 | { 327 | isInside = false; 328 | } 329 | } 330 | for (; p.v() != temp1; p.cw()) ; 331 | if (isInside == true) 332 | { 333 | MessageBox.Show("nokta içinde bulundu !!!"); 334 | continue; 335 | } 336 | 337 | MessageBox.Show("nokta içinde değil !!! i değeri " +i); 338 | //if (utility.pointInConvexPolygon(s[i], p)) 339 | //{ 340 | // MessageBox.Show("nokta içeride bulundu noktanın x değeri : " + s[i].x); 341 | // continue; 342 | //} 343 | 344 | //MessageBox.Show("incelenen nokta "+somePoint.x.ToString()); 345 | PointByMe closestVertex = p.point(); 346 | double minLength=(closestVertex-somePoint).length(); 347 | double l1; 348 | 349 | for (int ii = 0; ii < p.size(); ii++,p.cw()) 350 | { 351 | //String sss = "şu an test değeri : " + p.v().x + " mesafe : " + (p.v().point() - somePoint).length() + 352 | //"\nclosest değeri " + closestVertex.x + " \nmesafe : " + (closestVertex - somePoint).length(); 353 | //MessageBox.Show(sss); 354 | temp1 = p.v().point(); 355 | 356 | for (int iiii = 0; iiii < p.size(); iiii++, p.cw()) 357 | if (p.point().y > 0) p.point().y = -p.point().y; 358 | 359 | for(;p.v()!=temp1;p.cw()); 360 | 361 | 362 | l1 = (p.v() - somePoint).length(); 363 | if (l1 < minLength) 364 | { 365 | closestVertex = p.v().point(); 366 | //string str1 = "karşılaştırılan nokta x değeri :" + somePoint.x; 367 | //str1 += "\nbulunan en yakın nokta" + p.v().x; 368 | //MessageBox.Show("güncelleme yapıyor..."); 369 | minLength = l1; 370 | } 371 | 372 | } 373 | temp1 = p.v().point(); 374 | 375 | for (int iiii = 0; iiii < p.size(); iiii++, p.cw()) 376 | if (p.point().y > 0) p.point().y = -p.point().y; 377 | 378 | for (; p.v() != temp1; p.cw()) ; 379 | 380 | MessageBox.Show("en yakın nokta " + closestVertex.x.ToString()); 381 | string s00 = poligonListString(p); 382 | string s0="incelenen nokta - en yakın nokta " + somePoint.x.ToString()+" "+closestVertex.ToString(); 383 | //MessageBox.Show("incelenen nokta - en yakın nokta " + somePoint.x.ToString()+" "+closestVertex.point().x.ToString()); 384 | 385 | while(p.v().point() != closestVertex) // şu aktif vertex en yakın olanı 386 | p.advance(Rotation.CLOCKWISE); 387 | 388 | string ps = ""; // poligon x değerlerini buraya alıyoruz 389 | string s1="şu an aktif vertex closest olmalı p.v() değeri "+" "+p.v().point().x.ToString(); 390 | s1+="\nşu an aktif vertex closest olmalı" + " " + p.v().point().x.ToString(); 391 | s1+="\n şu an left için taramaya başlayacak..."; 392 | s1+="gönderilen değerler: "+s[i].x+" aktif vertex "+p.v().point().x+"poligon size: "+p.size(); 393 | for (int ii = 0; ii < p.size(); ii++, p.cw()) 394 | ps += " " + p.point().x.ToString(); 395 | //s[i].y = -s[i].y; 396 | MessageBox.Show(s1+" "+ps); 397 | ps = ""; 398 | utility.supportingLine(s[i], p, TopologyOrientation.LEFT); 399 | Vertex l = p.v(); 400 | 401 | //MessageBox.Show("soldan teget değeri "+l.point().x.ToString()); 402 | //string s2="soldan teget değeri "+l.point().x.ToString(); 403 | 404 | string s2 ="\n şu an right için taramaya başlayacak..."; 405 | s2 += "gönderilen değerler: ekleme noktası" + s[i].x + " aktif vertex " + p.v().point().x + " poligon size " + p.size(); 406 | 407 | for (int ii = 0; ii < p.size(); ii++, p.cw()) 408 | ps += " " + p.point().x.ToString(); 409 | MessageBox.Show(s2 + " \n" + "poligon içeriği : " + ps); 410 | 411 | utility.supportingLine(s[i], p, TopologyOrientation.RIGHT); 412 | 413 | //MessageBox.Show("sağdan teget değeri "+l.point().x.ToString()); 414 | string s3="sağdan teget değeri bulundu ve su an p.v() değeri de bu : "+p.point().x.ToString(); 415 | int a, b; 416 | a = p.size(); 417 | p.split(l); 418 | MessageBox.Show("silme yapıldı, yeni poligonn nokta sayısı : " + p.size()); 419 | b = p.size(); 420 | if (a < b) MessageBox.Show("silme nokta sayısı azaldı yapıldı..."); 421 | 422 | //MessageBox.Show("eklenen değer : "+s[i].ToString()); 423 | //string s4="eklenen değer : "+s[i].ToString(); 424 | 425 | p.insert(s[i]); 426 | if (p.v().point().y > 0) p.v().point().y = -p.v().point().y; 427 | //MessageBox.Show(s00+" " + "\n" + s2 + "\n" + s3 + "\n" + s4); 428 | drawPoligon(p, canvas); 429 | temp1 = p.v().point(); 430 | 431 | for (int iiii = 0; iiii < p.size(); iiii++, p.cw()) 432 | if (p.point().y > 0) p.point().y = -p.point().y; 433 | 434 | for (; p.v() != temp1; p.cw()) ; 435 | 436 | } 437 | return p; 438 | } 439 | } 440 | } 441 | -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/App.g.cs: -------------------------------------------------------------------------------- 1 | #pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "AC28512D285F6D1421C595BEFD4AF77C" 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.34014 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | using System; 13 | using System.Diagnostics; 14 | using System.Windows; 15 | using System.Windows.Automation; 16 | using System.Windows.Controls; 17 | using System.Windows.Controls.Primitives; 18 | using System.Windows.Data; 19 | using System.Windows.Documents; 20 | using System.Windows.Ink; 21 | using System.Windows.Input; 22 | using System.Windows.Markup; 23 | using System.Windows.Media; 24 | using System.Windows.Media.Animation; 25 | using System.Windows.Media.Effects; 26 | using System.Windows.Media.Imaging; 27 | using System.Windows.Media.Media3D; 28 | using System.Windows.Media.TextFormatting; 29 | using System.Windows.Navigation; 30 | using System.Windows.Shapes; 31 | using System.Windows.Shell; 32 | 33 | 34 | namespace RulerControlTest { 35 | 36 | 37 | /// 38 | /// App 39 | /// 40 | public partial class App : System.Windows.Application { 41 | 42 | /// 43 | /// InitializeComponent 44 | /// 45 | [System.Diagnostics.DebuggerNonUserCodeAttribute()] 46 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] 47 | public void InitializeComponent() { 48 | 49 | #line 4 "..\..\App.xaml" 50 | this.StartupUri = new System.Uri("MainWindow.xaml", System.UriKind.Relative); 51 | 52 | #line default 53 | #line hidden 54 | } 55 | 56 | /// 57 | /// Application Entry Point. 58 | /// 59 | [System.STAThreadAttribute()] 60 | [System.Diagnostics.DebuggerNonUserCodeAttribute()] 61 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] 62 | public static void Main() { 63 | RulerControlTest.App app = new RulerControlTest.App(); 64 | app.InitializeComponent(); 65 | app.Run(); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/App.g.i.cs: -------------------------------------------------------------------------------- 1 | #pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "AC28512D285F6D1421C595BEFD4AF77C" 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.34014 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | using System; 13 | using System.Diagnostics; 14 | using System.Windows; 15 | using System.Windows.Automation; 16 | using System.Windows.Controls; 17 | using System.Windows.Controls.Primitives; 18 | using System.Windows.Data; 19 | using System.Windows.Documents; 20 | using System.Windows.Ink; 21 | using System.Windows.Input; 22 | using System.Windows.Markup; 23 | using System.Windows.Media; 24 | using System.Windows.Media.Animation; 25 | using System.Windows.Media.Effects; 26 | using System.Windows.Media.Imaging; 27 | using System.Windows.Media.Media3D; 28 | using System.Windows.Media.TextFormatting; 29 | using System.Windows.Navigation; 30 | using System.Windows.Shapes; 31 | using System.Windows.Shell; 32 | 33 | 34 | namespace RulerControlTest { 35 | 36 | 37 | /// 38 | /// App 39 | /// 40 | public partial class App : System.Windows.Application { 41 | 42 | /// 43 | /// InitializeComponent 44 | /// 45 | [System.Diagnostics.DebuggerNonUserCodeAttribute()] 46 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] 47 | public void InitializeComponent() { 48 | 49 | #line 4 "..\..\App.xaml" 50 | this.StartupUri = new System.Uri("MainWindow.xaml", System.UriKind.Relative); 51 | 52 | #line default 53 | #line hidden 54 | } 55 | 56 | /// 57 | /// Application Entry Point. 58 | /// 59 | [System.STAThreadAttribute()] 60 | [System.Diagnostics.DebuggerNonUserCodeAttribute()] 61 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] 62 | public static void Main() { 63 | RulerControlTest.App app = new RulerControlTest.App(); 64 | app.InitializeComponent(); 65 | app.Run(); 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/MainWindow.baml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/obj/Debug/MainWindow.baml -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/MainWindow.g.cs: -------------------------------------------------------------------------------- 1 | #pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "38DA62D0E42FF56C4D11F59BF423FFEB" 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.34014 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | using RulerControl; 13 | using System; 14 | using System.Diagnostics; 15 | using System.Windows; 16 | using System.Windows.Automation; 17 | using System.Windows.Controls; 18 | using System.Windows.Controls.Primitives; 19 | using System.Windows.Data; 20 | using System.Windows.Documents; 21 | using System.Windows.Ink; 22 | using System.Windows.Input; 23 | using System.Windows.Markup; 24 | using System.Windows.Media; 25 | using System.Windows.Media.Animation; 26 | using System.Windows.Media.Effects; 27 | using System.Windows.Media.Imaging; 28 | using System.Windows.Media.Media3D; 29 | using System.Windows.Media.TextFormatting; 30 | using System.Windows.Navigation; 31 | using System.Windows.Shapes; 32 | using System.Windows.Shell; 33 | 34 | 35 | namespace RulerControlTest { 36 | 37 | 38 | /// 39 | /// MainWindow 40 | /// 41 | public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector { 42 | 43 | 44 | #line 5 "..\..\MainWindow.xaml" 45 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 46 | internal RulerControlTest.MainWindow mainWindow; 47 | 48 | #line default 49 | #line hidden 50 | 51 | 52 | #line 8 "..\..\MainWindow.xaml" 53 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 54 | internal System.Windows.Controls.Canvas myCanvas; 55 | 56 | #line default 57 | #line hidden 58 | 59 | 60 | #line 9 "..\..\MainWindow.xaml" 61 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 62 | internal RulerControl.RulerControl horizontalRuler; 63 | 64 | #line default 65 | #line hidden 66 | 67 | 68 | #line 10 "..\..\MainWindow.xaml" 69 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 70 | internal RulerControl.RulerControl verticalRuler; 71 | 72 | #line default 73 | #line hidden 74 | 75 | 76 | #line 13 "..\..\MainWindow.xaml" 77 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 78 | internal System.Windows.Controls.Button btnPointToConvexPolygon; 79 | 80 | #line default 81 | #line hidden 82 | 83 | 84 | #line 21 "..\..\MainWindow.xaml" 85 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 86 | internal System.Windows.Controls.ListBox myListBox; 87 | 88 | #line default 89 | #line hidden 90 | 91 | private bool _contentLoaded; 92 | 93 | /// 94 | /// InitializeComponent 95 | /// 96 | [System.Diagnostics.DebuggerNonUserCodeAttribute()] 97 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] 98 | public void InitializeComponent() { 99 | if (_contentLoaded) { 100 | return; 101 | } 102 | _contentLoaded = true; 103 | System.Uri resourceLocater = new System.Uri("/RulerControlTest;component/mainwindow.xaml", System.UriKind.Relative); 104 | 105 | #line 1 "..\..\MainWindow.xaml" 106 | System.Windows.Application.LoadComponent(this, resourceLocater); 107 | 108 | #line default 109 | #line hidden 110 | } 111 | 112 | [System.Diagnostics.DebuggerNonUserCodeAttribute()] 113 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] 114 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] 115 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")] 116 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] 117 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 118 | void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { 119 | switch (connectionId) 120 | { 121 | case 1: 122 | this.mainWindow = ((RulerControlTest.MainWindow)(target)); 123 | return; 124 | case 2: 125 | this.myCanvas = ((System.Windows.Controls.Canvas)(target)); 126 | 127 | #line 8 "..\..\MainWindow.xaml" 128 | this.myCanvas.MouseMove += new System.Windows.Input.MouseEventHandler(this.Window_MouseMove_1); 129 | 130 | #line default 131 | #line hidden 132 | 133 | #line 8 "..\..\MainWindow.xaml" 134 | this.myCanvas.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.myCanvas_MouseLeftButtonDown); 135 | 136 | #line default 137 | #line hidden 138 | return; 139 | case 3: 140 | this.horizontalRuler = ((RulerControl.RulerControl)(target)); 141 | return; 142 | case 4: 143 | this.verticalRuler = ((RulerControl.RulerControl)(target)); 144 | return; 145 | case 5: 146 | this.btnPointToConvexPolygon = ((System.Windows.Controls.Button)(target)); 147 | 148 | #line 13 "..\..\MainWindow.xaml" 149 | this.btnPointToConvexPolygon.Click += new System.Windows.RoutedEventHandler(this.btnPointToConvexPolygon_Click); 150 | 151 | #line default 152 | #line hidden 153 | return; 154 | case 6: 155 | this.myListBox = ((System.Windows.Controls.ListBox)(target)); 156 | return; 157 | } 158 | this._contentLoaded = true; 159 | } 160 | } 161 | } 162 | 163 | -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/MainWindow.g.i.cs: -------------------------------------------------------------------------------- 1 | #pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "38DA62D0E42FF56C4D11F59BF423FFEB" 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.34014 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | using RulerControl; 13 | using System; 14 | using System.Diagnostics; 15 | using System.Windows; 16 | using System.Windows.Automation; 17 | using System.Windows.Controls; 18 | using System.Windows.Controls.Primitives; 19 | using System.Windows.Data; 20 | using System.Windows.Documents; 21 | using System.Windows.Ink; 22 | using System.Windows.Input; 23 | using System.Windows.Markup; 24 | using System.Windows.Media; 25 | using System.Windows.Media.Animation; 26 | using System.Windows.Media.Effects; 27 | using System.Windows.Media.Imaging; 28 | using System.Windows.Media.Media3D; 29 | using System.Windows.Media.TextFormatting; 30 | using System.Windows.Navigation; 31 | using System.Windows.Shapes; 32 | using System.Windows.Shell; 33 | 34 | 35 | namespace RulerControlTest { 36 | 37 | 38 | /// 39 | /// MainWindow 40 | /// 41 | public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector { 42 | 43 | 44 | #line 5 "..\..\MainWindow.xaml" 45 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 46 | internal RulerControlTest.MainWindow mainWindow; 47 | 48 | #line default 49 | #line hidden 50 | 51 | 52 | #line 8 "..\..\MainWindow.xaml" 53 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 54 | internal System.Windows.Controls.Canvas myCanvas; 55 | 56 | #line default 57 | #line hidden 58 | 59 | 60 | #line 9 "..\..\MainWindow.xaml" 61 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 62 | internal RulerControl.RulerControl horizontalRuler; 63 | 64 | #line default 65 | #line hidden 66 | 67 | 68 | #line 10 "..\..\MainWindow.xaml" 69 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 70 | internal RulerControl.RulerControl verticalRuler; 71 | 72 | #line default 73 | #line hidden 74 | 75 | 76 | #line 13 "..\..\MainWindow.xaml" 77 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 78 | internal System.Windows.Controls.Button btnPointToConvexPolygon; 79 | 80 | #line default 81 | #line hidden 82 | 83 | 84 | #line 21 "..\..\MainWindow.xaml" 85 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 86 | internal System.Windows.Controls.ListBox myListBox; 87 | 88 | #line default 89 | #line hidden 90 | 91 | private bool _contentLoaded; 92 | 93 | /// 94 | /// InitializeComponent 95 | /// 96 | [System.Diagnostics.DebuggerNonUserCodeAttribute()] 97 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] 98 | public void InitializeComponent() { 99 | if (_contentLoaded) { 100 | return; 101 | } 102 | _contentLoaded = true; 103 | System.Uri resourceLocater = new System.Uri("/RulerControlTest;component/mainwindow.xaml", System.UriKind.Relative); 104 | 105 | #line 1 "..\..\MainWindow.xaml" 106 | System.Windows.Application.LoadComponent(this, resourceLocater); 107 | 108 | #line default 109 | #line hidden 110 | } 111 | 112 | [System.Diagnostics.DebuggerNonUserCodeAttribute()] 113 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] 114 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] 115 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")] 116 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] 117 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 118 | void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { 119 | switch (connectionId) 120 | { 121 | case 1: 122 | this.mainWindow = ((RulerControlTest.MainWindow)(target)); 123 | return; 124 | case 2: 125 | this.myCanvas = ((System.Windows.Controls.Canvas)(target)); 126 | 127 | #line 8 "..\..\MainWindow.xaml" 128 | this.myCanvas.MouseMove += new System.Windows.Input.MouseEventHandler(this.Window_MouseMove_1); 129 | 130 | #line default 131 | #line hidden 132 | 133 | #line 8 "..\..\MainWindow.xaml" 134 | this.myCanvas.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.myCanvas_MouseLeftButtonDown); 135 | 136 | #line default 137 | #line hidden 138 | return; 139 | case 3: 140 | this.horizontalRuler = ((RulerControl.RulerControl)(target)); 141 | return; 142 | case 4: 143 | this.verticalRuler = ((RulerControl.RulerControl)(target)); 144 | return; 145 | case 5: 146 | this.btnPointToConvexPolygon = ((System.Windows.Controls.Button)(target)); 147 | 148 | #line 13 "..\..\MainWindow.xaml" 149 | this.btnPointToConvexPolygon.Click += new System.Windows.RoutedEventHandler(this.btnPointToConvexPolygon_Click); 150 | 151 | #line default 152 | #line hidden 153 | return; 154 | case 6: 155 | this.myListBox = ((System.Windows.Controls.ListBox)(target)); 156 | return; 157 | } 158 | this._contentLoaded = true; 159 | } 160 | } 161 | } 162 | 163 | -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/RulerControlTest.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/obj/Debug/RulerControlTest.Properties.Resources.resources -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/RulerControlTest.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\bin\Debug\RulerControlTest.exe.config 2 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\bin\Debug\RulerControlTest.exe 3 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\bin\Debug\RulerControlTest.pdb 4 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\bin\Debug\RulerControl.dll 5 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\bin\Debug\RulerControl.pdb 6 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\obj\Debug\RulerControlTest.csprojResolveAssemblyReference.cache 7 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\obj\Debug\MainWindow.baml 8 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\obj\Debug\MainWindow.g.cs 9 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\obj\Debug\App.g.cs 10 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\obj\Debug\RulerControlTest_MarkupCompile.cache 11 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\obj\Debug\RulerControlTest.g.resources 12 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\obj\Debug\RulerControlTest.Properties.Resources.resources 13 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\obj\Debug\RulerControlTest.csproj.GenerateResource.Cache 14 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\obj\Debug\RulerControlTest.exe 15 | c:\Users\-ZaferAYAN-\Documents\Visual Studio 2012\Projects\RulerControl\RulerControlTest\obj\Debug\RulerControlTest.pdb 16 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\bin\Debug\RulerControlTest.exe.config 17 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\obj\Debug\RulerControlTest.exe 18 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\obj\Debug\RulerControlTest.pdb 19 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\bin\Debug\RulerControlTest.exe 20 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\bin\Debug\RulerControlTest.pdb 21 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\bin\Debug\RulerControl.dll 22 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\bin\Debug\RulerControl.pdb 23 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\obj\Debug\RulerControlTest.csprojResolveAssemblyReference.cache 24 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\obj\Debug\MainWindow.baml 25 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\obj\Debug\MainWindow.g.cs 26 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\obj\Debug\App.g.cs 27 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\obj\Debug\RulerControlTest_MarkupCompile.cache 28 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\obj\Debug\RulerControlTest.g.resources 29 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\obj\Debug\RulerControlTest.Properties.Resources.resources 30 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\obj\Debug\RulerControlTest.csproj.GenerateResource.Cache 31 | -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/RulerControlTest.csproj.GenerateResource.Cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/obj/Debug/RulerControlTest.csproj.GenerateResource.Cache -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/RulerControlTest.csprojResolveAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/obj/Debug/RulerControlTest.csprojResolveAssemblyReference.cache -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/RulerControlTest.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/obj/Debug/RulerControlTest.exe -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/RulerControlTest.g.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/obj/Debug/RulerControlTest.g.resources -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/RulerControlTest.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/obj/Debug/RulerControlTest.pdb -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/RulerControlTest_MarkupCompile.cache: -------------------------------------------------------------------------------- 1 | RulerControlTest 2 | 3 | 4 | winexe 5 | C# 6 | .cs 7 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\obj\Debug\ 8 | RulerControlTest 9 | none 10 | false 11 | DEBUG;TRACE 12 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\App.xaml 13 | 11151548125 14 | 15 | 9-1822003914 16 | 13600561673 17 | MainWindow.xaml; 18 | 19 | False 20 | 21 | -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/RulerControlTest_MarkupCompile.i.cache: -------------------------------------------------------------------------------- 1 | RulerControlTest 2 | 3 | 4 | winexe 5 | C# 6 | .cs 7 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\obj\Debug\ 8 | RulerControlTest 9 | none 10 | false 11 | DEBUG;TRACE 12 | C:\Users\-ZaferAYAN-\Documents\GitHub\RulerControlForWPF\RulerControlTest\App.xaml 13 | 11151548125 14 | 15 | 13515469572 16 | 13600561673 17 | MainWindow.xaml; 18 | 19 | False 20 | 21 | -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/RulerControlTest/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs -------------------------------------------------------------------------------- /RulerControlTest/obj/Debug/Window1.g.i.cs: -------------------------------------------------------------------------------- 1 | #pragma checksum "..\..\Window1.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "EEF91A91FD599C22A3BFE37BF965C249" 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.18051 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | using RulerControl; 13 | using System; 14 | using System.Diagnostics; 15 | using System.Windows; 16 | using System.Windows.Automation; 17 | using System.Windows.Controls; 18 | using System.Windows.Controls.Primitives; 19 | using System.Windows.Data; 20 | using System.Windows.Documents; 21 | using System.Windows.Ink; 22 | using System.Windows.Input; 23 | using System.Windows.Markup; 24 | using System.Windows.Media; 25 | using System.Windows.Media.Animation; 26 | using System.Windows.Media.Effects; 27 | using System.Windows.Media.Imaging; 28 | using System.Windows.Media.Media3D; 29 | using System.Windows.Media.TextFormatting; 30 | using System.Windows.Navigation; 31 | using System.Windows.Shapes; 32 | using System.Windows.Shell; 33 | 34 | 35 | namespace RulerControlTest { 36 | 37 | 38 | /// 39 | /// Window1 40 | /// 41 | public partial class Window1 : System.Windows.Window, System.Windows.Markup.IComponentConnector { 42 | 43 | 44 | #line 6 "..\..\Window1.xaml" 45 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 46 | internal System.Windows.Controls.Canvas coordinateCanvas; 47 | 48 | #line default 49 | #line hidden 50 | 51 | 52 | #line 7 "..\..\Window1.xaml" 53 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 54 | internal RulerControl.RulerControl horizontalRulerCtrl; 55 | 56 | #line default 57 | #line hidden 58 | 59 | 60 | #line 8 "..\..\Window1.xaml" 61 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] 62 | internal RulerControl.RulerControl verticalRulerCtrl; 63 | 64 | #line default 65 | #line hidden 66 | 67 | private bool _contentLoaded; 68 | 69 | /// 70 | /// InitializeComponent 71 | /// 72 | [System.Diagnostics.DebuggerNonUserCodeAttribute()] 73 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] 74 | public void InitializeComponent() { 75 | if (_contentLoaded) { 76 | return; 77 | } 78 | _contentLoaded = true; 79 | System.Uri resourceLocater = new System.Uri("/RulerControlTest;component/window1.xaml", System.UriKind.Relative); 80 | 81 | #line 1 "..\..\Window1.xaml" 82 | System.Windows.Application.LoadComponent(this, resourceLocater); 83 | 84 | #line default 85 | #line hidden 86 | } 87 | 88 | [System.Diagnostics.DebuggerNonUserCodeAttribute()] 89 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] 90 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] 91 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")] 92 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] 93 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] 94 | void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { 95 | switch (connectionId) 96 | { 97 | case 1: 98 | 99 | #line 5 "..\..\Window1.xaml" 100 | ((RulerControlTest.Window1)(target)).MouseMove += new System.Windows.Input.MouseEventHandler(this.Window_MouseMove_1); 101 | 102 | #line default 103 | #line hidden 104 | return; 105 | case 2: 106 | this.coordinateCanvas = ((System.Windows.Controls.Canvas)(target)); 107 | 108 | #line 6 "..\..\Window1.xaml" 109 | this.coordinateCanvas.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.myCanvas_MouseDown); 110 | 111 | #line default 112 | #line hidden 113 | return; 114 | case 3: 115 | this.horizontalRulerCtrl = ((RulerControl.RulerControl)(target)); 116 | return; 117 | case 4: 118 | this.verticalRulerCtrl = ((RulerControl.RulerControl)(target)); 119 | return; 120 | } 121 | this._contentLoaded = true; 122 | } 123 | } 124 | } 125 | 126 | -------------------------------------------------------------------------------- /Screenshots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/Screenshots/1.png -------------------------------------------------------------------------------- /Screenshots/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/Screenshots/2.png -------------------------------------------------------------------------------- /Screenshots/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/Screenshots/3.png -------------------------------------------------------------------------------- /Screenshots/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/Screenshots/4.png -------------------------------------------------------------------------------- /Screenshots/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/Screenshots/5.png -------------------------------------------------------------------------------- /Screenshots/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/Screenshots/6.png -------------------------------------------------------------------------------- /Screenshots/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/Screenshots/7.png -------------------------------------------------------------------------------- /Screenshots/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ozcanzaferayan/RulerControlForWPF/03e307fd32ee6d5658559e6a38ff2f8d1fe5dcdf/Screenshots/8.png --------------------------------------------------------------------------------