public void SetValues(ImageResourceReference imageRef) { pendingStartValue = imageRef; if (resourceSelect != null) { if (imageRef == null) { resourceSelect.Selected = -1; subrectX.Value = 0; subrectY.Value = 0; subrectW.Value = 0; subrectH.Value = 0; return; } for (int i = 0; i < resourceSelect.GetItemCount(); ++i) { if (resourceSelect.GetItemText(i) == imageRef.Resource) { resourceSelect.Selected = i; if (imageRef.SubRect.HasValue) { subrectX.Value = (int)imageRef.SubRect.Value.Position.x; subrectY.Value = (int)imageRef.SubRect.Value.Position.y; subrectW.Value = (int)imageRef.SubRect.Value.Size.x; subrectH.Value = (int)imageRef.SubRect.Value.Size.y; } ResetTexturePreview(); return; } } } }
public ImageResourceReference GetImageRef() { var imageRef = new ImageResourceReference() { Resource = resourceSelect.Selected == -1 ? null : resourceSelect.GetItemText(resourceSelect.Selected), }; if (imageRef.Resource == "") { imageRef.Resource = null; } if (subrectW.Value >= 1 && subrectH.Value >= 1) { imageRef.SubRect = new Rect2((int)subrectX.Value, (int)subrectY.Value, (int)subrectW.Value, (int)subrectH.Value); } return(imageRef); }
public RainfallMotionResault(PointData[,] value, string dataName, Work work, string overviewImgResKey, string riImgResKey, string atImgResKey) : base(value, dataName, work, overviewImgResKey) { RainfallIntensityImage = new ImageResourceReference(work, riImgResKey); AreaTypeImage = new ImageResourceReference(work, atImgResKey); }