public GridColumn(Expression <Func <T, TDataType> > expression, CGrid <T> grid) { #region Setup defaults EncodeEnabled = true; SortEnabled = false; SanitizeEnabled = true; Hidden = false; _filterWidgetTypeName = PropertiesHelper.GetUnderlyingType(typeof(TDataType)).FullName; _grid = grid; #endregion if (expression != null) { var expr = expression.Body as MemberExpression; if (expr == null) { throw new ArgumentException( string.Format("Expression '{0}' must be a member expression", expression), "expression"); } _constraint = expression.Compile(); _orderers.Insert(0, new OrderByGridOrderer <T, TDataType>(expression)); _filter = new DefaultColumnFilter <T, TDataType>(expression); _search = new DefaultColumnSearch <T, TDataType>(expression); _group = new DefaultColumnGroup <T, TDataType>(expression); //Generate unique column name: FieldName = PropertiesHelper.BuildColumnNameFromMemberExpression(expr); Name = FieldName; Title = Name; //Using the same name by default } }
public List <C2DHoledPolygon> GetIntersectingPolygons(IList <C2DPoint> pointsA, IList <C2DPoint> pointsB, IntersectionType whichPolygons) { var leftPoly = new C2DPolygon(pointsA.ToList(), true); var rightPoly = new C2DPolygon(pointsB.ToList(), true); rightPoly.RandomPerturb(); var someGrid = new CGrid(); var smallPolygons = new List <C2DHoledPolygon>(); switch (whichPolygons) { case IntersectionType.Overlapping: leftPoly.GetOverlaps(rightPoly, smallPolygons, someGrid); break; case IntersectionType.NonOverlapping: leftPoly.GetNonOverlaps(rightPoly, smallPolygons, someGrid); break; default: throw new ArgumentException(nameof(whichPolygons)); } return(smallPolygons); }
/// <summary> /// Snaps this to the conceptual grid. /// </summary> public abstract void SnapToGrid(CGrid grid);
public DefaultColumnBuilder(CGrid <T> grid, IGridAnnotationsProvider annotations) { _grid = grid; _annotations = annotations; }
public void StopMove() { curGrid = null; }
public GridColumn(Expression <Func <T, TDataType> > expression, CGrid <T> grid) : this(expression, null, grid) { }
/// ----------------------------------------------------------------------------------------- /// <summary> /// /// </summary> /// ----------------------------------------------------------------------------------------- // Use this for initialization public virtual void Awake(Vector3 origin, int numRows, int numCols, float cellSize, bool show) { m_GridMap = new CGrid(); m_GridMap.Awake(origin, numRows, numCols, cellSize, show); }
private void Awake() { grid = GetComponent <CGrid>(); }
private static double CalculateConstraintCost() { double asd = 0.0; List <_Point> boundaries2 = localModel.OutlinePolygonPoints; if (boundaries2 == null || (boundaries2 != null && !boundaries2.Any())) { return(asd); } List <C2DPoint> convertedPointsForPolygon3 = boundaries2.Select(i => new C2DPoint(i.X, i.Y)).ToList(); C2DPolygon BoundaryPolygon = new C2DPolygon(); BoundaryPolygon.Create(convertedPointsForPolygon3, true); foreach (_Room room in localModel.rooms) { List <_Point> boundaries = room.GetPoints(); if (!boundaries.Any()) { continue; } List <C2DPoint> convertedPointsForPolygon2 = boundaries.Select(i => new C2DPoint(i.X, i.Y)).ToList(); C2DPolygon roomPolygon = new C2DPolygon(); roomPolygon.Create(convertedPointsForPolygon2, true); room.Polygon = roomPolygon; CGrid grid = new CGrid(); List <C2DHoledPolygon> asdasd = new List <C2DHoledPolygon>(); roomPolygon.GetOverlaps(BoundaryPolygon, asdasd, grid); List <double> a = asdasd.Select(i => i.GetArea()).ToList(); double sumoverlap = a.Sum() / 10000; double actualArea = room.Area; if (actualArea - sumoverlap > 0) { asd += +10000000; } asd += Math.Pow(2, actualArea - sumoverlap); } for (var i = 0; i < localModel.rooms.Count; i++) { _Room modelRoom = localModel.rooms[i]; for (int j = i + 1; j < localModel.rooms.Count; j++) { _Room modelRoom2 = localModel.rooms[j]; CGrid grid = new CGrid(); List <C2DHoledPolygon> asdasd = new List <C2DHoledPolygon>(); modelRoom.Polygon.GetOverlaps(modelRoom2.Polygon, asdasd, grid); List <double> a = asdasd.Select(k => k.GetArea()).ToList(); double sumoverlap = a.Sum() / 10000; double actualArea = modelRoom.Area; if (sumoverlap > 0) { asd += +10000000; } } } //then avoid room overlaps return(asd); }
protected void BindCGrid() { ContentsCaption.Text = string.Format(ContentsCaption.Text, CurrentCategory.Name); CGrid.DataBind(); }
protected void CGrid_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { if (e.CommandName.StartsWith("Do_")) { string[] args = e.CommandArgument.ToString().Split("|".ToCharArray()); CatalogNodeType catalogNodeType = (CatalogNodeType)AlwaysConvert.ToInt(args[0]); int catalogNodeId = AlwaysConvert.ToInt(args[1]); switch (e.CommandName) { case "Do_Open": //IF CATEGORY, REBIND CURRENT PAGE, //OTHERWISE REDIRECT TO CORRECT EDIT PAGE switch (catalogNodeType) { case CatalogNodeType.Category: //REBIND CURRENT CATEGORY CurrentCategoryId = catalogNodeId; //RESET PAGE INDEX CGrid.PageIndex = 0; break; case CatalogNodeType.Product: Response.Redirect("~/Admin/Products/EditProduct.aspx?CategoryId=" + CurrentCategoryId.ToString() + "&ProductId=" + catalogNodeId.ToString()); break; case CatalogNodeType.Webpage: Response.Redirect("~/Admin/Catalog/EditWebpage.aspx?CategoryId=" + CurrentCategoryId.ToString() + "&WebpageId=" + catalogNodeId.ToString()); break; case CatalogNodeType.Link: Response.Redirect("~/Admin/Catalog/EditLink.aspx?CategoryId=" + CurrentCategoryId.ToString() + "&LinkId=" + catalogNodeId.ToString()); break; } break; case "Do_Copy": // THIS WILL COPY THE PRODUCTS WITH THE ORIGNAL CATEGORY INFORMATION PRESERVED CatalogDataSource.Copy(catalogNodeId, catalogNodeType, 0); break; case "Do_Delete": DoDelete(catalogNodeType, catalogNodeId); break; case "Do_Pub": ICatalogable pubNode = CatalogDataSource.Load(catalogNodeId, catalogNodeType); if (pubNode != null) { //FOR CATEGORIES, WE MUST FIND OUT MORE INFORMATION if (pubNode is Category) { Response.Redirect("ChangeVisibility.aspx?CategoryId=" + ((Category)pubNode).ParentId.ToString() + String.Format("&Objects={0}:{1}", ((Category)pubNode).Id, (byte)(CatalogNodeType.Category))); } //FOR OTHER OBJECTS, WE CAN ADJUST switch (pubNode.Visibility) { case CatalogVisibility.Public: pubNode.Visibility = CatalogVisibility.Hidden; break; case CatalogVisibility.Hidden: pubNode.Visibility = CatalogVisibility.Private; break; default: pubNode.Visibility = CatalogVisibility.Public; break; } if (pubNode is Product) { ((Product)pubNode).Save(); } else if (pubNode is Webpage) { ((Webpage)pubNode).Save(); } else if (pubNode is Link) { ((Link)pubNode).Save(); } } break; } } CGrid.DataBind(); }
protected void BindCGrid() { ParentCategory.Visible = (CurrentCategory != null && CurrentCategory.Id > 0); ContentsCaption.Text = string.Format(ContentsCaption.Text, CurrentCategory.Name); CGrid.DataBind(); }
protected virtual void Start() { this.m_Grid = CGrid.GetInstance(); this.m_RootLine = CRootline.GetInstance(); }
protected void Page_Load(object sender, EventArgs e) { string scriptServerConfig = CGrid.CreateGridConfig(0, 5, 1, "colModelTax", "colNameTax", "optionServerTax"); ltrScriptClient.Text = "<script type='text/javascript'>" + scriptServerConfig + "</script>"; }
public HiddenGridColumn(Expression <Func <T, TDataType> > expression, CGrid <T> grid) : base(expression, grid) { Hidden = true; }
public ODataService(HttpClient httpClient, string url, CGrid <T> grid) { _httpClient = httpClient; _url = url; _grid = grid; }
private CGrid GetNeighbor(CGrid grid, int index) { if (index < 0 || index > 5) { return(null); } int col = grid.col; int row = grid.row; switch (index) { case 0: { col--; } break; case 1: { col -= 1 - grid.parity; row++; } break; case 2: { col += grid.parity; row++; } break; case 3: { col++; } break; case 4: { col += grid.parity; row--; } break; case 5: { col -= 1 - grid.parity; row--; } break; default: return(null); } if (col < 0 || col >= Col) { return(null); } if (row < 0 || row >= Row) { return(null); } return(gridMap[col, row]); }