private Model.Point Scale(double x, double y) { Model.Point ret = new Model.Point(); ret.X = Constants.ScaleX * (y - Constants.MinLon); ret.Y = Constants.ScaleY * (x - Constants.MinLat); return(ret); }
private void FixNumbers() { foreach (var v in networkModel.Substations.SubstationEntity) { ToLatLon(v.X, v.Y, out double x, out double y); if (x < Constants.BottomX || x > Constants.UpperX || y < Constants.BottomY || y > Constants.UpperY) { continue; } else { Model.Point point = Scale(x, y); v.X = point.X; v.Y = point.Y; CreateModel(v.Id, NodeType.Substation, v.X, v.Y, v); } } foreach (var v in networkModel.Switches.SwitchEntity) { ToLatLon(v.X, v.Y, out double x, out double y); if (x < Constants.BottomX || x > Constants.UpperX || y < Constants.BottomY || y > Constants.UpperY) { continue; } else { Model.Point point = Scale(x, y); v.X = point.X; v.Y = point.Y; CreateModel(v.Id, NodeType.Switch, v.X, v.Y, v); } } foreach (var v in networkModel.Nodes.NodeEntity) { ToLatLon(v.X, v.Y, out double x, out double y); if (x < Constants.BottomX || x > Constants.UpperX || y < Constants.BottomY || y > Constants.UpperY) { continue; } else { Model.Point point = Scale(x, y); v.X = point.X; v.Y = point.Y; CreateModel(v.Id, NodeType.Node, v.X, v.Y, v); } } }