public static long Insert(MountItem mountItem) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { mountItem.MountItemNum=Meth.GetLong(MethodBase.GetCurrentMethod(),mountItem); return mountItem.MountItemNum; } return Crud.MountItemCrud.Insert(mountItem); }
/* public static void Update(MountItem mountItem) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),mountItem); return; } Crud.MountItemCrud.Update(mountItem); }*/ public static void Delete(MountItem mountItem) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),mountItem); return; } string command="DELETE FROM mountitem WHERE MountItemNum='"+POut.Long(mountItem.MountItemNum)+"'"; Db.NonQ(command); }
public static long Insert(MountItem mountItem) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { mountItem.MountItemNum = Meth.GetLong(MethodBase.GetCurrentMethod(), mountItem); return(mountItem.MountItemNum); } return(Crud.MountItemCrud.Insert(mountItem)); }
/* * public static void Update(MountItem mountItem) { * if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { * Meth.GetVoid(MethodBase.GetCurrentMethod(),mountItem); * return; * } * Crud.MountItemCrud.Update(mountItem); * }*/ public static void Delete(MountItem mountItem) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), mountItem); return; } string command = "DELETE FROM mountitem WHERE MountItemNum='" + POut.Long(mountItem.MountItemNum) + "'"; Db.NonQ(command); }
///<summary>Returns the list of mount items associated with the given mount key.</summary> public static MountItem[] GetItemsForMount(int mountNum) { string command = "SELECT * FROM mountitem WHERE MountNum='" + POut.PInt(mountNum) + "' ORDER BY OrdinalPos"; DataTable result = General2.GetTable(command); MountItem[] mountItems = new MountItem[result.Rows.Count]; for (int i = 0; i < mountItems.Length; i++) { mountItems[i] = Fill(result.Rows[i]); } return(mountItems); }
public static int Insert(MountItem mountItem) { string command = "INSERT INTO mountitem (MountItemNum,MountNum,Xpos,Ypos,OrdinalPos,Width,Height) VALUES (" + "'" + POut.PInt(mountItem.MountItemNum) + "'," + "'" + POut.PInt(mountItem.MountNum) + "'," + "'" + POut.PInt(mountItem.Xpos) + "'," + "'" + POut.PInt(mountItem.Ypos) + "'," + "'" + POut.PInt(mountItem.OrdinalPos) + "'," + "'" + POut.PInt(mountItem.Width) + "'," + "'" + POut.PInt(mountItem.Height) + "')"; return(General2.NonQEx(command, true)); }
///<summary>Converts the given datarow to a mountitem, assuming that the row represents a mountitem.</summary> public static MountItem Fill(DataRow mountItemRow) { MountItem mountItem = new MountItem(); mountItem.MountItemNum = PIn.PInt(mountItemRow["MountItemNum"].ToString()); mountItem.MountNum = PIn.PInt(mountItemRow["MountNum"].ToString()); mountItem.Xpos = PIn.PInt(mountItemRow["Xpos"].ToString()); mountItem.Ypos = PIn.PInt(mountItemRow["Ypos"].ToString()); mountItem.OrdinalPos = PIn.PInt(mountItemRow["OrdinalPos"].ToString()); mountItem.Width = PIn.PInt(mountItemRow["Width"].ToString()); mountItem.Height = PIn.PInt(mountItemRow["Height"].ToString()); return(mountItem); }
public static int Update(MountItem mountItem) { string command = "UPDATE mountitem SET " + "MountNum='" + POut.PInt(mountItem.MountNum) + "'," + "Xpos='" + POut.PInt(mountItem.Xpos) + "'," + "Ypos='" + POut.PInt(mountItem.Ypos) + "'," + "OrdinalPos='" + POut.PInt(mountItem.OrdinalPos) + "'," + "Width='" + POut.PInt(mountItem.Width) + "'," + "Height='" + POut.PInt(mountItem.Height) + "' " + "WHERE MountItemNum='" + POut.PInt(mountItem.MountItemNum) + "'"; return(General2.NonQEx(command)); }
///<summary></summary> public MountItem Copy() { MountItem m = new MountItem(); m.MountItemNum = MountItemNum; m.MountNum = MountNum; m.Xpos = Xpos; m.Ypos = Ypos; m.OrdinalPos = OrdinalPos; m.Width = Width; m.Height = Height; return(m); }
///<summary>Renders the given image using the settings provided by the given document object into the location of the given mountItem object.</summary> public static void RenderImageIntoMount(Bitmap mountImage, MountItem mountItem, Bitmap mountItemImage, Document mountItemDoc) { if (mountItem == null) { return; } using(Graphics g = Graphics.FromImage(mountImage)) { g.FillRectangle(Brushes.Black, mountItem.Xpos, mountItem.Ypos, mountItem.Width, mountItem.Height);//draw box behind image Bitmap image = ApplyDocumentSettingsToImage(mountItemDoc,mountItemImage,ImageSettingFlags.ALL); if (image == null) { return; } float widthScale = ((float)mountItem.Width) / image.Width; float heightScale = ((float)mountItem.Height) / image.Height; float scale = (widthScale < heightScale ? widthScale : heightScale); RectangleF imageRect = new RectangleF(0, 0, scale * image.Width, scale * image.Height); imageRect.X = mountItem.Xpos + mountItem.Width / 2 - imageRect.Width / 2; imageRect.Y = mountItem.Ypos + mountItem.Height / 2 - imageRect.Height / 2; g.DrawImage(image, imageRect); image.Dispose(); } }
///<summary>Renders the given image using the settings provided by the given document object into the location of the given mountItem object.</summary> public static void RenderImageIntoMount(Bitmap mountImage, MountItem mountItem, Bitmap mountItemImage, Document mountItemDoc) { if (mountItem == null) { return; } using (Graphics g = Graphics.FromImage(mountImage)) { g.FillRectangle(Brushes.Black, mountItem.Xpos, mountItem.Ypos, mountItem.Width, mountItem.Height); //draw box behind image Bitmap image = ApplyDocumentSettingsToImage(mountItemDoc, mountItemImage, ImageSettingFlags.ALL); if (image == null) { return; } float widthScale = ((float)mountItem.Width) / image.Width; float heightScale = ((float)mountItem.Height) / image.Height; float scale = (widthScale < heightScale ? widthScale : heightScale); RectangleF imageRect = new RectangleF(0, 0, scale * image.Width, scale * image.Height); imageRect.X = mountItem.Xpos + mountItem.Width / 2 - imageRect.Width / 2; imageRect.Y = mountItem.Ypos + mountItem.Height / 2 - imageRect.Height / 2; g.DrawImage(image, imageRect); image.Dispose(); } }
///<summary>Handles a change in selection of the xRay capture button.</summary> private void ToolBarCapture_Click() { if(treeDocuments.SelectedNode==null) { return; } if(ToolBarMain.Buttons["Capture"].Pushed) { ImageNodeId nodeId=(ImageNodeId)treeDocuments.SelectedNode.Tag; //ComputerPref computerPrefs=ComputerPrefs.GetForLocalComputer(); xRayImageController.SensorType=ComputerPrefs.LocalComputer.SensorType; xRayImageController.PortNumber=ComputerPrefs.LocalComputer.SensorPort; xRayImageController.Binned=ComputerPrefs.LocalComputer.SensorBinned; xRayImageController.ExposureLevel=ComputerPrefs.LocalComputer.SensorExposure; if(nodeId.NodeType!=ImageNodeType.Mount) {//No mount is currently selected. //Show the user that they are performing an image capture by generating a new mount. Mount mount=new Mount(); mount.DateCreated=DateTimeOD.Today; mount.Description="unnamed capture"; mount.DocCategory=GetCurrentCategory(); mount.ImgType=ImageType.Mount; mount.PatNum=PatCur.PatNum; int border=Math.Max(xRayImageController.SensorSize.Width,xRayImageController.SensorSize.Height)/24; mount.Width=4*xRayImageController.SensorSize.Width+5*border; mount.Height=xRayImageController.SensorSize.Height+2*border; mount.MountNum=Mounts.Insert(mount); MountItem mountItem=new MountItem(); mountItem.MountNum=mount.MountNum; mountItem.Width=xRayImageController.SensorSize.Width; mountItem.Height=xRayImageController.SensorSize.Height; mountItem.Ypos=border; mountItem.OrdinalPos=1; mountItem.Xpos=border; MountItems.Insert(mountItem); mountItem.OrdinalPos=0; mountItem.Xpos=mountItem.Width+2*border; MountItems.Insert(mountItem); mountItem.OrdinalPos=2; mountItem.Xpos=2*mountItem.Width+3*border; MountItems.Insert(mountItem); mountItem.OrdinalPos=3; mountItem.Xpos=3*mountItem.Width+4*border; MountItems.Insert(mountItem); FillDocList(false); SelectTreeNode(GetNodeById(MakeIdMount(mount.MountNum))); sliderBrightnessContrast.MinVal=PrefC.GetInt(PrefName.ImageWindowingMin); sliderBrightnessContrast.MaxVal=PrefC.GetInt(PrefName.ImageWindowingMax); } else if(nodeId.NodeType==ImageNodeType.Mount) {//A mount is currently selected. We must allow the user to insert new images into partially complete mounts. //Clear the visible selection so that the user will know when the device is ready for xray exposure. ImageHelper.RenderMountFrames(ImageRenderingNow,MountItemsForSelected,-1); RenderCurrentImage(new Document(),ImageRenderingNow.Width,ImageRenderingNow.Height,ZoomImage*ZoomOverall,PointTranslation); } //Here we can only allow access to the capture button during a capture, because it is too complicated and hard for a //user to follow what is going on if they use the other tools when a capture is taking place. EnableAllTools(false); ToolBarMain.Buttons["Capture"].Enabled=true; ToolBarMain.Invalidate(); xRayImageController.CaptureXRay(); } else {//The user unselected the image capture button, so cancel the current image capture. xRayImageController.KillXRayThread();//Stop current xRay capture and call OnCaptureFinalize() when done. } }
public static void Delete(MountItem mountItem) { string command = "DELETE FROM mountitem WHERE MountItemNum='" + POut.PInt(mountItem.MountItemNum) + "'"; General2.NonQEx(command); }