public UtmPoint NorthWestCornerUtm() { String value = CentralPoint.ToUtmString(_Digits); UtmPoint result = new UtmPoint(value); if (!SameZone(result)) { result = LimitToZone(result); } return(result); }
public UtmPoint SouthEastCornerUtm() { String value = CentralPoint.ToUtmString(_Digits); UtmPoint result = new UtmPoint(value); result.Easting += GridSize(_Digits); result.Northing += GridSize(_Digits); if (!SameZone(result)) { result = LimitToZone(result); } return(result); }
public static void PrintCloserLine(double x1, double y1, double x2, double y2) { double xy1 = CentralPoint.CalculatePythagorean(x1, y1); double xy2 = CentralPoint.CalculatePythagorean(x2, y2); if (xy1 <= xy2) { Console.WriteLine($"({x1}, {y1})({x2}, {y2})"); } else { Console.WriteLine($"({x2}, {y2})({x1}, {y1})"); } }
public static void PrintLongerLine(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) { double xy12 = CentralPoint.CalculatePythagorean(Math.Pow(x2 - x1, 2), Math.Pow(y2 - y1, 2)); double xy34 = CentralPoint.CalculatePythagorean(Math.Pow(x4 - x3, 2), Math.Pow(y4 - y3, 2)); if (xy12 >= xy34) { PrintCloserLine(x1, y1, x2, y2); } else { PrintCloserLine(x3, y3, x4, y4); } }
/// <summary> /// Stops this instance of Krento and dispose Krento context. /// </summary> internal void Stop() { TraceDebug.Trace("Stop Krento"); if (context != null) { try { context.StopServer(); context.UnloadKrentoPlugins(); context.UnloadKrentoToys(); context.UnloadKrentoDocklets(); context.UnloadRingImage(); context.Dispose(); context = null; } catch (Exception ex) { TraceDebug.Trace("Exception in Startup.Stop: " + ex.Message); context = null; } } CentralPoint.Shutdown(); }
public UtmPoint ActualCentralPoint() { String value = CentralPoint.ToUtmString(_Digits); UtmPoint west = new UtmPoint(value); west.Northing += GridSize(_Digits) / 2; UtmPoint east = new UtmPoint(west); east.Easting += GridSize(_Digits); if (!SameZone(west)) { west = LimitToZone(west); } if (!SameZone(east)) { east = LimitToZone(east); } UtmPoint result = new UtmPoint(value); result.Northing += GridSize(_Digits) / 2; result.Easting = (west.Easting + east.Easting) / 2; return(result); }
internal void Start() { string ApplicationPrefix = GlobalConfig.ProductName.ToUpperInvariant(); TraceDebug.Trace("Start {0}", GlobalConfig.ProductName); #if PORTABLE Environment.SetEnvironmentVariable(ApplicationPrefix + "_PORTABLE", GlobalConfig.MainFolder, EnvironmentVariableTarget.Process); Environment.SetEnvironmentVariable(ApplicationPrefix + "_DRIVE", GlobalConfig.ApplicationDrive, EnvironmentVariableTarget.Process); #endif Environment.SetEnvironmentVariable(ApplicationPrefix + "_DATA", GlobalConfig.MainFolder, EnvironmentVariableTarget.Process); messageID = NativeMethods.RegisterWindowMessage("KrentoStop"); //Do not localize!!! NativeMethods.AddRemoveMessageFilter(messageID, ChangeWindowMessageFilterFlags.Add); PrepareStandardProperties(); showSplashScreen = true; CentralPoint.Startup(); ApplyGUILanguage(); GlobalSettings.LoadGlobalSettings(); GlobalSettings.ManagerLeft = Settings.Default.ManagerLeft; GlobalSettings.ManagerTop = Settings.Default.ManagerTop; #region Parse command line foreach (string param in args) { if (TextHelper.SameText(param, @"/low")) { GlobalConfig.LowMemory = true; } if (TextHelper.SameText(param, @"/ns")) { showSplashScreen = false; } if (TextHelper.SameText(param, @"/nd")) { KrentoContext.SkipDocklets = true; } if (TextHelper.SameText(param, @"/nt")) { KrentoContext.SkipToys = true; } if (TextHelper.SameText(param, @"/desktop")) { KrentoContext.CreateDesktopCircle = true; } if (param.IndexOf(@".circle", StringComparison.OrdinalIgnoreCase) > 0) { KrentoContext.CircleParameter = param; } if (FileOperations.IsKrentoPackage(param)) { KrentoContext.PackageParameter = param; } } #endregion this.context = new KrentoContext(); #region FirstRun if (NativeMethods.GlobalCheckAtom("krento_first_run")) { KrentoContext.FirstRun = true; NativeMethods.GlobalKillAtom("krento_first_run"); } #if PORTABLE string firstRunFile = Path.Combine(GlobalConfig.ApplicationFolder, "first.run"); if (NativeMethods.FileExists(firstRunFile)) { KrentoContext.FirstRun = true; NativeMethods.FileDelete(firstRunFile); } #endif if (KrentoContext.FirstRun) { GlobalSettings.SaveGlobalSettings(); } #endregion #region First Instance if (context.FirstInstance) { this.mainForm = new MainForm(context); mainForm.Text = GlobalConfig.ProductName; InteropHelper.MainWindow = mainForm.Handle; if ((showSplashScreen) && GlobalSettings.ShowSplashScreen) { mainForm.SplashScreen = new SplashScreen(); } else { mainForm.SplashScreen = null; } if (NativeMethods.StartEngineEx(mainForm.Handle)) { if (GlobalSettings.ActivateServer) { if (NetworkOperations.PortAvailable(GlobalSettings.PortNumber)) { context.StartServer(); } } appContext = new ApplicationContext(); //Load plugins. If the instance is the first instance and //engine is activated, then plugins are loaded try { context.LoadKrentoPlugins(); } catch (Exception) { //do not stop on wrong plugins TraceDebug.Trace("Exception on loading Krento plugin"); } try { context.LoadKrentoToys(); } catch (Exception) { //do not stop on wrong plugins TraceDebug.Trace("Exception on loading Krento toy"); } try { context.LoadKrentoDocklets(); } catch { //do not stop on wrong docklet TraceDebug.Trace("Exception on loading docklet"); } NativeThemeManager.MakeSound("#110"); Application.Run(appContext); } } #endregion }