code
stringlengths
1
2.08M
repo_name
stringlengths
1
35
path
stringlengths
4
221
language
stringclasses
66 values
license
stringclasses
17 values
size
int64
1
2.08M
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Text.RegularExpressions; namespace FIS.iDET.Keygen { public partial class KeygenForm : Form { const string notValid = "(Machine ID not valid)"; public KeygenForm() { InitializeComponent(); } private void machineIDTextBox_TextChanged(object sender, EventArgs e) { // check if machine ID is valid string machineID = machineIDTextBox.Text.Trim().ToUpper(); Match match = Regex.Match( machineID, @"[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}" ); if (match.Success) serialTextBox.Text = LicenseService.GenarateSerialNumberFrom(machineID); else if (serialTextBox.Text != notValid) serialTextBox.Text = notValid; } private void serialTextBox_Click(object sender, EventArgs e) { serialTextBox.SelectAll(); } } }
2atgroup
TiffBrowserTestCSharp/Keygen/KeygenForm.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,259
namespace FIS.iDET.Keygen { partial class KeygenForm { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(KeygenForm)); this.machineIDLabel = new System.Windows.Forms.Label(); this.serialLabel = new System.Windows.Forms.Label(); this.labelBackgroundMachineID = new System.Windows.Forms.Label(); this.machineIDTextBox = new System.Windows.Forms.TextBox(); this.labelBackgroundSerialNo = new System.Windows.Forms.Label(); this.serialTextBox = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // machineIDLabel // this.machineIDLabel.BackColor = System.Drawing.Color.Transparent; this.machineIDLabel.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.machineIDLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(35)))), ((int)(((byte)(128)))), ((int)(((byte)(159))))); this.machineIDLabel.Location = new System.Drawing.Point(14, 37); this.machineIDLabel.Name = "machineIDLabel"; this.machineIDLabel.Size = new System.Drawing.Size(93, 23); this.machineIDLabel.TabIndex = 1; this.machineIDLabel.Text = "Machine ID"; this.machineIDLabel.TextAlign = System.Drawing.ContentAlignment.TopRight; // // serialLabel // this.serialLabel.BackColor = System.Drawing.Color.Transparent; this.serialLabel.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.serialLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(144)))), ((int)(((byte)(6)))), ((int)(((byte)(157))))); this.serialLabel.Location = new System.Drawing.Point(14, 113); this.serialLabel.Name = "serialLabel"; this.serialLabel.Size = new System.Drawing.Size(93, 19); this.serialLabel.TabIndex = 3; this.serialLabel.Text = "Serial No"; this.serialLabel.TextAlign = System.Drawing.ContentAlignment.TopRight; // // labelBackgroundMachineID // this.labelBackgroundMachineID.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(144)))), ((int)(((byte)(174))))); this.labelBackgroundMachineID.Enabled = false; this.labelBackgroundMachineID.Location = new System.Drawing.Point(112, 27); this.labelBackgroundMachineID.Name = "labelBackgroundMachineID"; this.labelBackgroundMachineID.Size = new System.Drawing.Size(517, 35); this.labelBackgroundMachineID.TabIndex = 5; // // machineIDTextBox // this.machineIDTextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(144)))), ((int)(((byte)(174))))); this.machineIDTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.machineIDTextBox.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.machineIDTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(211)))), ((int)(((byte)(237)))), ((int)(((byte)(246))))); this.machineIDTextBox.Location = new System.Drawing.Point(122, 33); this.machineIDTextBox.MaxLength = 39; this.machineIDTextBox.Name = "machineIDTextBox"; this.machineIDTextBox.Size = new System.Drawing.Size(496, 22); this.machineIDTextBox.TabIndex = 0; this.machineIDTextBox.TextChanged += new System.EventHandler(this.machineIDTextBox_TextChanged); // // labelBackgroundSerialNo // this.labelBackgroundSerialNo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(38)))), ((int)(((byte)(133))))); this.labelBackgroundSerialNo.Enabled = false; this.labelBackgroundSerialNo.Location = new System.Drawing.Point(112, 103); this.labelBackgroundSerialNo.Name = "labelBackgroundSerialNo"; this.labelBackgroundSerialNo.Size = new System.Drawing.Size(516, 35); this.labelBackgroundSerialNo.TabIndex = 5; // // serialTextBox // this.serialTextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(38)))), ((int)(((byte)(133))))); this.serialTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.serialTextBox.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.serialTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(206)))), ((int)(((byte)(246))))); this.serialTextBox.Location = new System.Drawing.Point(122, 109); this.serialTextBox.MaxLength = 39; this.serialTextBox.Name = "serialTextBox"; this.serialTextBox.Size = new System.Drawing.Size(496, 22); this.serialTextBox.TabIndex = 1; this.serialTextBox.Click += new System.EventHandler(this.serialTextBox_Click); // // KeygenForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(231)))), ((int)(((byte)(231)))), ((int)(((byte)(231))))); this.ClientSize = new System.Drawing.Size(647, 163); this.Controls.Add(this.serialTextBox); this.Controls.Add(this.machineIDTextBox); this.Controls.Add(this.labelBackgroundSerialNo); this.Controls.Add(this.labelBackgroundMachineID); this.Controls.Add(this.serialLabel); this.Controls.Add(this.machineIDLabel); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Name = "KeygenForm"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Keygen for FIS iDET"; this.TopMost = true; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label machineIDLabel; private System.Windows.Forms.Label serialLabel; private System.Windows.Forms.Label labelBackgroundMachineID; private System.Windows.Forms.TextBox machineIDTextBox; private System.Windows.Forms.Label labelBackgroundSerialNo; private System.Windows.Forms.TextBox serialTextBox; } }
2atgroup
TiffBrowserTestCSharp/Keygen/KeygenForm.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
8,209
using System; using System.Text; using System.Security.Cryptography; namespace FIS.iDET.Keygen { /// <summary> /// Calculate a serial number that matches a unique machine ID of a computer /// </summary> // Hoang add code ... public class LicenseService { public static string GenarateSerialNumberFrom(string machineID) { string serial = GetHash( "ID >> " + machineID + "Secret >> " + "aed45dba1f73080de226c193d3f9d605" ); return serial; } /// <summary> /// generate 16-byte hash of a string /// </summary> /// <param name="s">input string</param> /// <returns>16-byte hash string</returns> private static string GetHash(string s) { MD5 sec = new MD5CryptoServiceProvider(); ASCIIEncoding enc = new ASCIIEncoding(); byte[] bt = enc.GetBytes(s); return GetHexString(sec.ComputeHash(bt)); } /// <summary> /// intended to be used by GetHash() /// </summary> /// <param name="bt">input string</param> /// <returns>hex string</returns> private static string GetHexString(byte[] bt) { string s = string.Empty; for (int i = 0; i < bt.Length; i++) { byte b = bt[i]; int n, n1, n2; n = (int)b; n1 = n & 15; n2 = (n >> 4) & 15; if (n2 > 9) s += ((char)(n2 - 10 + (int)'A')).ToString(); else s += n2.ToString(); if (n1 > 9) s += ((char)(n1 - 10 + (int)'A')).ToString(); else s += n1.ToString(); if ((i + 1) != bt.Length && (i + 1) % 2 == 0) s += "-"; } return s; } } }
2atgroup
TiffBrowserTestCSharp/Keygen/LicenseService.cs
C#
Microsoft Reciprocal License (Ms-RL)
2,032
using System; using System.Collections.Generic; using System.Windows.Forms; namespace FIS.iDET.Keygen { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new KeygenForm()); } } }
2atgroup
TiffBrowserTestCSharp/Keygen/Program.cs
C#
Microsoft Reciprocal License (Ms-RL)
492
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("FIS.iDET Keygen")] [assembly: AssemblyDescription("Keygen for FPT BPO Data Eentry Tool")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("FPT BPO. Developed by Revo21 Studio")] [assembly: AssemblyProduct("FIS.iDET Keygen")] [assembly: AssemblyCopyright("Copyright © 2012 by FPT BPO")] [assembly: AssemblyTrademark("FPT BPO")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("97300fa9-4f9d-4a34-af12-5cd332d0767f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
2atgroup
TiffBrowserTestCSharp/Keygen/Properties/AssemblyInfo.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,530
using System; using System.Drawing; namespace FIS.iDET.TemplateCreator { public class DataColumn { public DataColumn() { // set default values _width = 100; _type = DataTypeEnum.COLUMN_TYPE_TEXT; _header = "Untitled"; x = y = w = h = 0; } public DataColumn(string header) { // set default values _width = 100; _type = DataTypeEnum.COLUMN_TYPE_TEXT; _header = header; x = y = w = h = 0; } public DataColumn(string header, int type, int width, DoubleRectangle rect) { // set default values _width = width; _type = type; _header = header; x = rect.X; y = rect.Y; w = rect.Width; h = rect.Height; } private double x, y, w, h; public DataColumn(string header, int type, int width, double x, double y, double w, double h) { // set default values _width = width; _type = type; _header = header; this.x = x; this.y = y; this.w = w; this.h = h; } public DoubleRectangle Rect { get { return new DoubleRectangle(x, y, w, h); } set { x = value.X; y = value.Y; w = value.Width; h = value.Height; } } public double X { get { return x; } set { this.x = value; } } public double Y { get { return y; } set { this.y = value; } } public double W { get { return w; } set { this.w = value; } } public double H { get { return h; } set { this.h = value; } } private int _width; public int Width { get { return _width; } set { _width = value; } } private int _type; public int Type { get { return _type; } set { _type = value; } } private string _header; public string Header { get { return _header; } set { _header = value; } } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/DataColumn.cs
C#
Microsoft Reciprocal License (Ms-RL)
2,632
using System; using System.Collections.Generic; using System.Text; namespace FIS.iDET.TemplateCreator { public static class DataTypeEnum { /* data type for datagridview column */ public const int COLUMN_TYPE_NUMBER = 0; public const int COLUMN_TYPE_DATE = 1; public const int COLUMN_TYPE_TEXT = 2; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/DataTypeEnum.cs
C#
Microsoft Reciprocal License (Ms-RL)
364
using System; using System.Collections.Generic; using System.Text; namespace FIS.iDET.TemplateCreator { /*class DoublePoint { public double X=0, Y=0; public DoublePoint(double X, double Y) { this. } }*/ public class DoubleRectangle { public double X = 0, Y = 0, Width = 0, Height = 0; public DoubleRectangle(double x, double y, double width, double height) { this.X = x; this.Y = y; this.Width = width; this.Height = height; } public DoubleRectangle() { } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/DoubleRectangle.cs
C#
Microsoft Reciprocal License (Ms-RL)
669
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Diagnostics; namespace FIS.iDET.TemplateCreator { public partial class FormAbout : Form { public FormAbout() { InitializeComponent(); } private void FormAbout_Load(object sender, EventArgs e) { LabelUserName.Text = GlobalConstants.Username; LabelProductID.Text = RegistryService.GetValue(GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY); label1.Text = GlobalConstants.stringVersion; } private void buttonOK_Click(object sender, EventArgs e) { this.Close(); } private void FormAbout_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.R) { MessageBox.Show("Welcome to the developer world !"); Process.Start("http://revo21studio.com/"); } else if (e.KeyCode == Keys.I) { MessageBox.Show("There are still good men in this world!"); Process.Start("http://p.yusukekamiyamane.com/"); } } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/FormAbout.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,328
namespace FIS.iDET.TemplateCreator { partial class FormAbout { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormAbout)); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.LabelUserName = new System.Windows.Forms.Label(); this.LabelProductID = new System.Windows.Forms.Label(); this.buttonOK = new System.Windows.Forms.Button(); this.label7 = new System.Windows.Forms.Label(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.SteelBlue; this.label1.Location = new System.Drawing.Point(168, 15); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(251, 22); this.label1.TabIndex = 2; this.label1.Text = "FIS Template Creator Tool"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(169, 140); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(263, 45); this.label2.TabIndex = 2; this.label2.Text = "Copyright © 2012 by FPT Information System,\r\n " + " FPT BPO Services Center.\r\nAll rights reserved."; // // label6 // this.label6.AutoEllipsis = true; this.label6.ForeColor = System.Drawing.Color.Gray; this.label6.Location = new System.Drawing.Point(12, 217); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(377, 85); this.label6.TabIndex = 2; this.label6.Text = resources.GetString("label6.Text"); // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(169, 67); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(154, 15); this.label8.TabIndex = 2; this.label8.Text = "This product is licensed to:"; // // LabelUserName // this.LabelUserName.AutoSize = true; this.LabelUserName.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.LabelUserName.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; this.LabelUserName.Location = new System.Drawing.Point(329, 67); this.LabelUserName.Name = "LabelUserName"; this.LabelUserName.Size = new System.Drawing.Size(78, 16); this.LabelUserName.TabIndex = 2; this.LabelUserName.Text = "John Smith"; // // LabelProductID // this.LabelProductID.AutoSize = true; this.LabelProductID.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Bold); this.LabelProductID.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; this.LabelProductID.Location = new System.Drawing.Point(169, 102); this.LabelProductID.Name = "LabelProductID"; this.LabelProductID.Size = new System.Drawing.Size(281, 16); this.LabelProductID.TabIndex = 2; this.LabelProductID.Text = "AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA"; // // buttonOK // this.buttonOK.BackColor = System.Drawing.SystemColors.GradientActiveCaption; this.buttonOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonOK.Location = new System.Drawing.Point(392, 235); this.buttonOK.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(82, 31); this.buttonOK.TabIndex = 3; this.buttonOK.Text = "OK"; this.buttonOK.UseVisualStyleBackColor = false; this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(169, 86); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(90, 15); this.label7.TabIndex = 2; this.label7.Text = "Serial Number:"; // // pictureBox2 // this.pictureBox2.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.fisHelp; this.pictureBox2.Location = new System.Drawing.Point(16, 6); this.pictureBox2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(120, 112); this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox2.TabIndex = 0; this.pictureBox2.TabStop = false; // // pictureBox1 // this.pictureBox1.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.fisLogo; this.pictureBox1.Location = new System.Drawing.Point(15, 126); this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(120, 87); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // // FormAbout // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; this.ClientSize = new System.Drawing.Size(491, 302); this.Controls.Add(this.buttonOK); this.Controls.Add(this.label7); this.Controls.Add(this.LabelProductID); this.Controls.Add(this.LabelUserName); this.Controls.Add(this.label8); this.Controls.Add(this.label6); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.pictureBox1); this.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormAbout"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "About"; this.Load += new System.EventHandler(this.FormAbout_Load); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormAbout_KeyDown); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label LabelUserName; private System.Windows.Forms.Label LabelProductID; private System.Windows.Forms.Button buttonOK; private System.Windows.Forms.Label label7; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox2; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/FormAbout.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
10,104
using System; using System.Windows.Forms; using System.Drawing; namespace FIS.iDET.TemplateCreator { public partial class FormEdit : Form { public FormEdit() { InitializeComponent(); } private FormTemplateCreator parentForm; private bool editMode = true; public FormEdit(FormTemplateCreator form, bool editMode) { InitializeComponent(); this.parentForm = form; this.editMode = editMode; if (!editMode) { createButton.Text = "Create Field"; this.Text = "Create new field"; comboBoxDataType.SelectedIndex = 2; } else { int i = parentForm.dataGridView.SelectedCells[0].ColumnIndex; textBoxFieldName.Text = parentForm.dataGridView.Columns[i].HeaderText; comboBoxDataType.Text = parentForm.dataGridView.Rows[0].Cells[i].Value.ToString(); } } private void cancelButton_Click(object sender, EventArgs e) { this.Close(); } private void createButton_Click(object sender, EventArgs e) { if (editMode) { // if user input data is valid if (textBoxFieldName.Text != "" && comboBoxDataType.SelectedIndex > -1) { // get index of selected column int i = parentForm.dataGridView.SelectedCells[0].ColumnIndex; // edit field name, ie column header text parentForm.dataGridView.Columns[i].HeaderText = textBoxFieldName.Text; // set new data type to row parentForm.dataGridView.Rows[0].Cells[i].Value = comboBoxDataType.Text; this.Close(); } else { MessageBox.Show("Please enter valid values for Field Name and Data Type"); } } else { // if user input data is valid if (textBoxFieldName.Text != "" && comboBoxDataType.SelectedIndex > -1) { // add new column int i = parentForm.dataGridView.Columns.Add((parentForm.count++).ToString(), textBoxFieldName.Text.Trim()); parentForm.dataGridView.Columns[i].ToolTipText = "Drag to re-order this field"; parentForm.dataGridView.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; // add new column element in Column list GlobalVariables.columns.Add(new DataColumn(textBoxFieldName.Text.Trim(), comboBoxDataType.SelectedIndex, 100, new DoubleRectangle(0, 0, 0, 0))); // add one new row if there is none if (parentForm.dataGridView.RowCount == 0) parentForm.dataGridView.Rows.Add(); // set data type to row parentForm.dataGridView.Rows[0].Cells[i].Value = comboBoxDataType.Text; parentForm.dataGridView.Rows[0].Cells[i].ToolTipText = "Double click to edit this Data type"; textBoxFieldName.Text = ""; } else { MessageBox.Show("Please enter valid values for Field Name and Data Type"); } } } private void textBoxFieldName_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char) Keys.Enter) { createButton_Click(sender, null); } else if (e.KeyChar == (char)Keys.Escape) { this.Close(); } } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/FormEdit.cs
C#
Microsoft Reciprocal License (Ms-RL)
3,976
namespace FIS.iDET.TemplateCreator { partial class FormEdit { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.textBoxFieldName = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.comboBoxDataType = new System.Windows.Forms.ComboBox(); this.createButton = new System.Windows.Forms.Button(); this.cancelButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // textBoxFieldName // this.textBoxFieldName.Location = new System.Drawing.Point(104, 6); this.textBoxFieldName.MaxLength = 256; this.textBoxFieldName.Name = "textBoxFieldName"; this.textBoxFieldName.Size = new System.Drawing.Size(173, 20); this.textBoxFieldName.TabIndex = 1; this.textBoxFieldName.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxFieldName_KeyPress); // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 9); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(60, 13); this.label2.TabIndex = 15; this.label2.Text = "Field Name"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(15, 39); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(57, 13); this.label1.TabIndex = 15; this.label1.Text = "Data Type"; // // comboBoxDataType // this.comboBoxDataType.FormattingEnabled = true; this.comboBoxDataType.Items.AddRange(new object[] { "Date Time", "Number", "General Text"}); this.comboBoxDataType.Location = new System.Drawing.Point(104, 36); this.comboBoxDataType.Name = "comboBoxDataType"; this.comboBoxDataType.Size = new System.Drawing.Size(173, 21); this.comboBoxDataType.TabIndex = 2; // // createButton // this.createButton.Location = new System.Drawing.Point(15, 78); this.createButton.Name = "createButton"; this.createButton.Size = new System.Drawing.Size(119, 23); this.createButton.TabIndex = 3; this.createButton.Text = "Edit this Field"; this.createButton.UseVisualStyleBackColor = true; this.createButton.Click += new System.EventHandler(this.createButton_Click); // // cancelButton // this.cancelButton.Location = new System.Drawing.Point(157, 78); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new System.Drawing.Size(119, 23); this.cancelButton.TabIndex = 4; this.cancelButton.Text = "Close"; this.cancelButton.UseVisualStyleBackColor = true; this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); // // FormEdit // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(288, 117); this.Controls.Add(this.textBoxFieldName); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.comboBoxDataType); this.Controls.Add(this.cancelButton); this.Controls.Add(this.createButton); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Name = "FormEdit"; this.Text = "Edit field"; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.TextBox textBoxFieldName; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.ComboBox comboBoxDataType; private System.Windows.Forms.Button createButton; private System.Windows.Forms.Button cancelButton; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/FormEdit.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
5,426
using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace FIS.iDET.TemplateCreator { public partial class FormTemplateCreator : Form { public static double zoomFactor = 1; ImageService tifImage = null; public int count = 0; private Point startPoint = new Point(0, 0); private Point imageStartPoint = new Point(0, 0); private Point endPoint = new Point(0, 0); DoubleRectangle rect = new DoubleRectangle(0, 0, 0, 0); public static int rows = 1; public FormTemplateCreator() { InitializeComponent(); } private void createButton_Click(object sender, EventArgs e) { FormEdit formEdit = new FormEdit(this, false); formEdit.ShowDialog(); } private void dataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex > -1) { dataGridView.CurrentCell = dataGridView[e.ColumnIndex, 0]; dataGridView.CurrentCell.Selected = true; editButton_Click(null, null); } } private void deleteButton_Click(object sender, EventArgs e) { if (dataGridView.SelectedCells != null) { int i = dataGridView.SelectedCells[0].ColumnIndex; if (MessageBox.Show("Are you sure you want to delete this field: " + dataGridView.Columns[i].HeaderText, "Deleting field", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { GlobalVariables.columns.RemoveAt(i); dataGridView.Columns.RemoveAt(i); if (dataGridView.Columns.Count == 0) saveButton.Enabled = false; } } else { MessageBox.Show("You have not set any column to delete"); } } private void editButton_Click(object sender, EventArgs e) { if (dataGridView.SelectedCells != null) { FormEdit formEdit = new FormEdit(this, true); formEdit.ShowDialog(); } else { MessageBox.Show("You have not set any column to delete"); } } private void FormTemplateCreator_Load(object sender, EventArgs e) { // init registry service RegistryService.Init(); // if app is not activated if (!LicenseService.AppIsActivated()) { // show license windows LicenseKeyForm licenseKeyForm = new LicenseKeyForm(); licenseKeyForm.ShowDialog(); } else { comboBoxZoomRatio.SelectedIndex = 4; textBoxRowsNumber.Text = "1"; this.Text += " - " + GlobalVariables.Version; } } private void loadButton_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "FIS.iDET Template|*.fis"; openFileDialog.Title = "Load template"; openFileDialog.ShowDialog(); if (openFileDialog.FileName != null && openFileDialog.FileName != "") { // clear data grid view newButton_Click(null, null); // get column info from XML GlobalVariables.columns = XmlService.ReadXml(openFileDialog.FileName); //set zoom comboBoxZoomRatio.Text = ((int)(zoomFactor * 100)).ToString(); if (GlobalVariables.columns == null) { // cannot load data MessageBox.Show("Cannot load template, please make sure that it is valid!"); } else { // set column info to datagridview foreach (DataColumn column in GlobalVariables.columns) { // add new column int i = dataGridView.Columns.Add((count++).ToString(), column.Header.Trim()); dataGridView.Columns[i].ToolTipText = "Drag to re-order this field"; dataGridView.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; dataGridView.Columns[i].Width = column.Width; // add one new row if there is none if (dataGridView.RowCount == 0) dataGridView.Rows.Add(); // set data type to row dataGridView.Rows[0].Cells[i].Value = XmlService.getDataTypeLongNameOf(column.Type); dataGridView.Rows[0].Cells[i].ToolTipText = "Double click to edit this Data type"; } dataGridView.Rows[0].Cells[0].Selected = true; if (GlobalVariables.TemplatePageCol != 0) { checkBoxPageNumber.Checked = true; checkBoxPageNumber_CheckedChanged(null, null); } } } } private void newButton_Click(object sender, EventArgs e) { dataGridView.CurrentCell = null; while (dataGridView.ColumnCount > 0) dataGridView.Columns.RemoveAt(0); GlobalVariables.columns.Clear(); pictBox.Image = null; EnableMenuIcons(false); saveButton.Enabled = false; } private void saveButton_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "FIS.iDET Template|*.fis"; saveFileDialog.Title = "Save template"; saveFileDialog.ShowDialog(); if (saveFileDialog.FileName != null && saveFileDialog.FileName != "") { XmlService.WriteXml(saveFileDialog.FileName, dataGridView); } } private void LoadImage() { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Tif Images|*.tif|Tiff Images|*.tiff|All files|*.*"; openFileDialog.Title = "Open Tiff Image"; DialogResult result = openFileDialog.ShowDialog(); if (result == DialogResult.OK && !String.IsNullOrEmpty(openFileDialog.FileName)) { // load tif file tifImage = new ImageService(openFileDialog.FileName); if (tifImage.FileLoadedOK) { // if template is in multipage mode, asks user to load excel file for this mode to work { textBoxPageNumber.ReadOnly = false; textBoxPageNumber.Text = (tifImage.CurrentFrame + 1).ToString(); } // set max page to toolStripLabelPage labelPage.Text = "/" + tifImage.TotalFrames.ToString(); // enable menu items // disable previous page button buttonPreviousPage.Enabled = false; // set default zoom factor tifImage.SetImageFrame(0); if (dataGridView.CurrentCell != null) { int id = dataGridView.CurrentCell.ColumnIndex; rect.X = GlobalVariables.columns[id].X; rect.Y = GlobalVariables.columns[id].Y; rect.Width = GlobalVariables.columns[id].W; rect.Height = GlobalVariables.columns[id].H; } pictBox.Image = tifImage.GetImageZoom(zoomFactor,rect); EnableMenuIcons(true); if (tifImage.TotalFrames == 1) buttonNextPage.Enabled = false; } else { ResetImageBox(); } } } private void EnableMenuIcons(Boolean enabled) { buttonNextPage.Enabled = enabled; buttonPreviousPage.Enabled = enabled; textBoxPageNumber.Enabled = enabled; comboBoxZoomRatio.Enabled = enabled; // H.NH added pictBox.Enabled = enabled; buttonRowHeight.Enabled = enabled; numericUpDown1.Enabled = enabled; textBoxRowsNumber.Enabled = enabled; } private void EnableButtonSize(Boolean enabled) { buttonPositionDown.Enabled = enabled; buttonPositionLeft.Enabled = enabled; buttonPositionRight.Enabled = enabled; buttonPositionUp.Enabled = enabled; buttonSizeDown.Enabled = enabled; buttonSizeUp.Enabled = enabled; buttonSizeLeft.Enabled = enabled; buttonSizeRight.Enabled = enabled; numericSpin.Enabled = enabled; // reverse textBoxRowsNumber.Enabled = !enabled; buttonRowHeight.Enabled = !enabled; } private void ResetImageBox() { // delete image pictBox.Image = null; // disable menu items EnableMenuIcons(false); pictBox.Enabled = false; EnableButtonSize(false); } private void buttonLoadImage_Click(object sender, EventArgs e) { LoadImage(); } private void RedrawPicture() // mode = 1 draw multiple rect { RedrawPicture(false); } private void RedrawPicture(bool mode) // mode = 1 draw multiple rect { /*if (navigationToolStripMenuItem.Checked) { DoubleRectangle rect; if (GlobalConstants.TemplatePageCol == 0) { rect = GetCurrentCellRectSingleLine(); } else { rect = GetCurrentCellRectMultiLine(); } PictBox.Image = tifImage.GetImageZoom(zoomFactor, rect); } else */ if (pictBox.Enabled) { pictBox.Image = tifImage.GetImageZoom(zoomFactor, rect, mode); pictBox.Refresh(); } } private void textBoxPageNumber_KeyPress(object sender, KeyPressEventArgs e) { if ( e.KeyChar == (char)Keys.Enter) { try { int page = Convert.ToInt32(textBoxPageNumber.Text); int frameToDisplay = 0; if (page > 0 && page <= tifImage.TotalFrames) { frameToDisplay = page - 1; // set image tifImage.SetImageFrame(frameToDisplay); RedrawPicture(); if (page == 1) { buttonNextPage.Enabled = true; buttonPreviousPage.Enabled = false; } if (page == tifImage.TotalFrames) { buttonNextPage.Enabled = false; buttonPreviousPage.Enabled = true; } } else textBoxPageNumber.Undo(); } catch { textBoxPageNumber.Undo(); } } } private void buttonPreviousPage_Click(object sender, EventArgs e) { tifImage.SetImageFrame(tifImage.CurrentFrame-1); RedrawPicture(); textBoxPageNumber.Text = (tifImage.CurrentFrame+1).ToString(); if (tifImage.CurrentFrame == 0) buttonPreviousPage.Enabled = false; if (tifImage.CurrentFrame < tifImage.TotalFrames-1) buttonNextPage.Enabled = true; } private void buttonNextPage_Click(object sender, EventArgs e) { tifImage.SetImageFrame(tifImage.CurrentFrame+1); RedrawPicture(); textBoxPageNumber.Text = (tifImage.CurrentFrame+1).ToString(); if (tifImage.CurrentFrame == tifImage.TotalFrames-1) buttonNextPage.Enabled = false; if (tifImage.CurrentFrame > 0) buttonPreviousPage.Enabled = true; } /* private Point ConvertToImageCoordinate(Point pictPoint) { Point imagePoint= new Point(0,0); int offsetX = panelPictBox.HorizontalScroll.Value / panelPictBox.HorizontalScroll.Maximum * (tifImage.Width - panelPictBox.Width); int x = (int)((rect.X + rect.Width - offsetX) * zoomFactor) + 10; int offsetY = panelPictBox.VerticalScroll.Value / panelPictBox.VerticalScroll.Maximum * (tifImage.Height - panelPictBox.Height); int y = (int)((rect.Y + rect.Height / 2 - offsetY) * zoomFactor) - 10; return imagePoint; } */ bool dragging = false; private void pictBox_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && dataGridView.Columns.Count > 0 && pictBox.Enabled) { EnableButtonSize(false); dragging = true; pictBox.Cursor = Cursors.Cross; startPoint.X = e.Location.X; startPoint.Y = e.Location.Y; //imageStartPoint = ConvertToImageCoordinate(startPoint); } } private void pictBox_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && dataGridView.Columns.Count> 0 && pictBox.Enabled && dragging ) { int x = startPoint.X < e.Location.X ? startPoint.X : e.Location.X; int y = startPoint.Y < e.Location.Y ? startPoint.Y : e.Location.Y; rect.X = (int) (x / zoomFactor); rect.Y = (int) (y / zoomFactor); rect.Width = Math.Abs((int)((e.Location.X - startPoint.X)/zoomFactor)); rect.Height = Math.Abs((int)((e.Location.Y - startPoint.Y)/zoomFactor)); //GlobalVariables.columns[curCol].Rect = rect; RedrawPicture(); } } private void pictBox_MouseUp(object sender, MouseEventArgs e) { if (dataGridView.Columns.Count > 0 && pictBox.Enabled && dragging) { dragging = false; int curCol = dataGridView.CurrentCell.ColumnIndex; int x = startPoint.X < e.Location.X ? startPoint.X : e.Location.X; int y = startPoint.Y < e.Location.Y ? startPoint.Y : e.Location.Y; rect.X = (int)(x / zoomFactor); rect.Y = (int)(y / zoomFactor); rect.Width = Math.Abs((int)((e.Location.X - startPoint.X) / zoomFactor)); rect.Height = Math.Abs((int)((e.Location.Y - startPoint.Y) / zoomFactor)); // Improve Rect Accuracy // rectMultiRow = rect; RedrawPicture(); } } private void comboBoxZoomRatio_SelectedIndexChanged(object sender, EventArgs e) { //PictBox.Focus(); if (comboBoxZoomRatio.SelectedIndex < 0) comboBoxZoomRatio.SelectedIndex = 4; //handle exception // else init zoom int pos = comboBoxZoomRatio.Text.IndexOf('%'); string zoomFactorString = comboBoxZoomRatio.Text.Remove(pos); zoomFactor = Convert.ToDouble(zoomFactorString) / 100; // active zoom buttons RedrawPicture(true); } private void comboBoxZoomRatio_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { int pos = comboBoxZoomRatio.Text.IndexOf('%'); string zoomFactorString = comboBoxZoomRatio.Text; if (pos > -1) zoomFactorString = comboBoxZoomRatio.Text.Remove(pos); else comboBoxZoomRatio.Text += "%"; double dzoomFactor = 0; // end zoomComboBox if (double.TryParse(zoomFactorString, out dzoomFactor) && dzoomFactor > 0 && dzoomFactor < 500) { zoomFactor = Convert.ToDouble(zoomFactorString) / 100; RedrawPicture(); } else comboBoxZoomRatio.SelectedIndex = 4; } } private void dataGridView_CurrentCellChanged(object sender, EventArgs e) { if (dataGridView.CurrentCell != null && pictBox.Enabled) { rect = GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].Rect; RedrawPicture(); if (rect.Height != 0 && rect.Width != 0) EnableButtonSize(true); else EnableButtonSize(false); } if (dataGridView.Columns.Count > 0) saveButton.Enabled = true; else saveButton.Enabled = false; if (dataGridView.CurrentCell != null) { editButton.Enabled = true; deleteButton.Enabled = true; } else { editButton.Enabled = false; deleteButton.Enabled = false; } } private void checkBoxPageNumber_CheckedChanged(object sender, EventArgs e) { comboBoxPageCol.Enabled = checkBoxPageNumber.Checked; comboBoxPageCol.Items.Clear(); if (checkBoxPageNumber.Checked) { for (int i = 1; i <= dataGridView.Columns.Count; i++) comboBoxPageCol.Items.Add(i); if (GlobalVariables.TemplatePageCol == 0 || GlobalVariables.TemplatePageCol > dataGridView.Columns.Count) { GlobalVariables.TemplatePageCol = dataGridView.Columns.Count; } comboBoxPageCol.SelectedIndex = GlobalVariables.TemplatePageCol - 1; } else { GlobalVariables.TemplatePageCol = 0; } } private void dataGridView_SelectionChanged(object sender, EventArgs e) { if (dataGridView.Columns.Count > 0) saveButton.Enabled = true; else saveButton.Enabled = false; if (dataGridView.CurrentCell != null) { editButton.Enabled = true; deleteButton.Enabled = true; } else { editButton.Enabled = false; deleteButton.Enabled = false; } //MessageBox.Show("yep"); } private void moveTooltipLeftToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].X-=(int) numericSpin.Value; rect.X -= (int)numericSpin.Value; RedrawPicture(true); } } private void moveTooltipRightToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].X += (int)numericSpin.Value; rect.X += (int)numericSpin.Value; RedrawPicture(true); } } private void moveTooltipUpToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].Y -= (int)numericSpin.Value; rect.Y -= (int)numericSpin.Value; RedrawPicture(true); } } private void moveTooltipDownToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].Y++; rect.Y += (int)numericSpin.Value; RedrawPicture(true); } } private void increaseTooltipHeightToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].H++; rect.Height ++; RedrawPicture(true); } } private void increaseTooltipWidthToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].W++; rect.Width++; RedrawPicture(true); } } private void decreaseTooltipHeightToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].H--; rect.Height --; RedrawPicture(true); } } private void decreaseTooltipWidthToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].W--; rect.Width--; RedrawPicture(true); } } // Shorcut key comming here protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { case Keys.Control | Keys.Shift | Keys.Up: moveTooltipUpToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Shift | Keys.Down: moveTooltipDownToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Shift | Keys.Left: moveTooltipLeftToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Shift | Keys.Right: moveTooltipRightToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Alt | Keys.Right: increaseTooltipWidthToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Alt | Keys.Up: decreaseTooltipHeightToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Alt | Keys.Left: decreaseTooltipWidthToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Alt | Keys.Down: increaseTooltipHeightToolStripMenuItem_Click(); return true; } return base.ProcessCmdKey(ref msg, keyData); } private void buttonPositionUp_Click(object sender, EventArgs e) { moveTooltipUpToolStripMenuItem_Click(); } private void buttonPositionDown_Click(object sender, EventArgs e) { moveTooltipDownToolStripMenuItem_Click(); } private void buttonPositionLeft_Click(object sender, EventArgs e) { moveTooltipLeftToolStripMenuItem_Click(); } private void buttonPositionRight_Click(object sender, EventArgs e) { moveTooltipRightToolStripMenuItem_Click(); } private void buttonSizeUp_Click(object sender, EventArgs e) { decreaseTooltipHeightToolStripMenuItem_Click(); } private void buttonSizeDown_Click(object sender, EventArgs e) { increaseTooltipHeightToolStripMenuItem_Click(); } private void buttonSizeLeft_Click(object sender, EventArgs e) { decreaseTooltipWidthToolStripMenuItem_Click(); } private void buttonSizeRight_Click(object sender, EventArgs e) { increaseTooltipWidthToolStripMenuItem_Click(); } private void comboBoxPageCol_SelectedIndexChanged(object sender, EventArgs e) { GlobalVariables.TemplatePageCol = comboBoxPageCol.SelectedIndex + 1; } private void dataGridView_ColumnAdded(object sender, DataGridViewColumnEventArgs e) { if (checkBoxPageNumber.Checked == true) checkBoxPageNumber_CheckedChanged(null, null); } private void dataGridView_ColumnRemoved(object sender, DataGridViewColumnEventArgs e) { if (checkBoxPageNumber.Checked == false) return; if (dataGridView.Columns.Count == 0) { comboBoxPageCol.Enabled = checkBoxPageNumber.Checked = false; } else { checkBoxPageNumber_CheckedChanged(null, null); } } public int valueUpDown = 0; private void numericUpDown1_ValueChanged(object sender, EventArgs e) { /*if (numericUpDown1.Value > valueUpDown) {*/ // valueUpDown = (int)numericUpDown1.Value; /// rect.Y = (int)((double)rectMultiRow.Y + (double)rectMultiRow.Height * ((double)valueUpDown / (double)rows)); if (numericUpDown1.Value > valueUpDown) { valueUpDown = (int)numericUpDown1.Value; rect.Y += rect.Height; } else { valueUpDown = (int)numericUpDown1.Value; rect.Y -= rect.Height; } RedrawPicture(); /*} else { valueUpDown = (int)numericUpDown1.Value; rect.Y = (int)((double)rectMultiRow.Y - (double)rectMultiRow.Height * ((double)valueUpDown / (double)rows)); RedrawPicture(); }*/ } private void buttonRowHeight_Click(object sender, EventArgs e) { if (dataGridView.CurrentCell!=null && pictBox.Enabled && rect.Height!=0 && rect.Width!=0 ) if (Int32.TryParse(textBoxRowsNumber.Text, out rows)) { EnableButtonSize(true); int curCol = dataGridView.CurrentCell.ColumnIndex; if (rows < 1) { rows = 1; textBoxRowsNumber.Text = rows.ToString(); } //rect1row.Width = (rect.Width / rows); rect.Height = (rect.Height / rows); GlobalVariables.columns[curCol].Rect = rect; RedrawPicture(true); // true means draw multiple Rect mode //buttonRowHeight.Enabled = false; return; } else { MessageBox.Show("Please enter number of Rows in Navigation zone correctly !", "Wrong rows number", MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxRowsNumber.Focus(); } buttonRowHeight.Enabled = false; } private void textBoxRowsNumber_KeyPress(object sender, KeyPressEventArgs e) { buttonRowHeight.Enabled = true; } private void panel2_Paint(object sender, PaintEventArgs e) { } private void numericSpin_ValueChanged(object sender, EventArgs e) { } private void buttonAbout_Click(object sender, EventArgs e) { FormAbout formAbout = new FormAbout(); formAbout.Show(); } private void buttonExit_Click(object sender, EventArgs e) { Application.Exit(); } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/FormTemplateCreator.cs
C#
Microsoft Reciprocal License (Ms-RL)
29,774
namespace FIS.iDET.TemplateCreator { partial class FormTemplateCreator { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormTemplateCreator)); this.dataGridView = new System.Windows.Forms.DataGridView(); this.createButton = new System.Windows.Forms.Button(); this.editButton = new System.Windows.Forms.Button(); this.deleteButton = new System.Windows.Forms.Button(); this.saveButton = new System.Windows.Forms.Button(); this.newButton = new System.Windows.Forms.Button(); this.loadButton = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.panelPictBox = new System.Windows.Forms.Panel(); this.pictBox = new System.Windows.Forms.PictureBox(); this.buttonLoadImage = new System.Windows.Forms.Button(); this.textBoxPageNumber = new System.Windows.Forms.TextBox(); this.labelPage = new System.Windows.Forms.Label(); this.comboBoxZoomRatio = new System.Windows.Forms.ComboBox(); this.checkBoxPageNumber = new System.Windows.Forms.CheckBox(); this.comboBoxPageCol = new System.Windows.Forms.ComboBox(); this.panel1 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); this.numericSpin = new System.Windows.Forms.NumericUpDown(); this.textBoxRowsNumber = new System.Windows.Forms.TextBox(); this.buttonSizeDown = new System.Windows.Forms.Button(); this.buttonPositionDown = new System.Windows.Forms.Button(); this.buttonSizeUp = new System.Windows.Forms.Button(); this.buttonSizeRight = new System.Windows.Forms.Button(); this.buttonPositionUp = new System.Windows.Forms.Button(); this.buttonSizeLeft = new System.Windows.Forms.Button(); this.buttonPositionRight = new System.Windows.Forms.Button(); this.label5 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.buttonPositionLeft = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.buttonRowHeight = new System.Windows.Forms.Button(); this.buttonPreviousPage = new System.Windows.Forms.Button(); this.buttonNextPage = new System.Windows.Forms.Button(); this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); this.label6 = new System.Windows.Forms.Label(); this.panel3 = new System.Windows.Forms.Panel(); this.label10 = new System.Windows.Forms.Label(); this.buttonExit = new System.Windows.Forms.Button(); this.buttonAbout = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); this.panelPictBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictBox)).BeginInit(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericSpin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); this.panel3.SuspendLayout(); this.SuspendLayout(); // // dataGridView // this.dataGridView.AllowUserToAddRows = false; this.dataGridView.AllowUserToDeleteRows = false; this.dataGridView.AllowUserToOrderColumns = true; this.dataGridView.AllowUserToResizeRows = false; this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView.Location = new System.Drawing.Point(3, 22); this.dataGridView.MultiSelect = false; this.dataGridView.Name = "dataGridView"; this.dataGridView.ReadOnly = true; this.dataGridView.Size = new System.Drawing.Size(1148, 62); this.dataGridView.TabIndex = 10; this.dataGridView.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellDoubleClick); this.dataGridView.ColumnAdded += new System.Windows.Forms.DataGridViewColumnEventHandler(this.dataGridView_ColumnAdded); this.dataGridView.ColumnRemoved += new System.Windows.Forms.DataGridViewColumnEventHandler(this.dataGridView_ColumnRemoved); this.dataGridView.CurrentCellChanged += new System.EventHandler(this.dataGridView_CurrentCellChanged); this.dataGridView.SelectionChanged += new System.EventHandler(this.dataGridView_SelectionChanged); // // createButton // this.createButton.Location = new System.Drawing.Point(11, 125); this.createButton.Name = "createButton"; this.createButton.Size = new System.Drawing.Size(102, 22); this.createButton.TabIndex = 2; this.createButton.Text = "New Column"; this.createButton.UseVisualStyleBackColor = true; this.createButton.Click += new System.EventHandler(this.createButton_Click); // // editButton // this.editButton.Enabled = false; this.editButton.Location = new System.Drawing.Point(11, 153); this.editButton.Name = "editButton"; this.editButton.Size = new System.Drawing.Size(102, 22); this.editButton.TabIndex = 3; this.editButton.Text = "Edit Column"; this.editButton.UseVisualStyleBackColor = true; this.editButton.Click += new System.EventHandler(this.editButton_Click); // // deleteButton // this.deleteButton.Enabled = false; this.deleteButton.Location = new System.Drawing.Point(11, 181); this.deleteButton.Name = "deleteButton"; this.deleteButton.Size = new System.Drawing.Size(102, 22); this.deleteButton.TabIndex = 4; this.deleteButton.Text = "Detele Column"; this.deleteButton.UseVisualStyleBackColor = true; this.deleteButton.Click += new System.EventHandler(this.deleteButton_Click); // // saveButton // this.saveButton.Enabled = false; this.saveButton.Location = new System.Drawing.Point(12, 55); this.saveButton.Name = "saveButton"; this.saveButton.Size = new System.Drawing.Size(102, 22); this.saveButton.TabIndex = 6; this.saveButton.Text = "Save template"; this.saveButton.UseVisualStyleBackColor = true; this.saveButton.Click += new System.EventHandler(this.saveButton_Click); // // newButton // this.newButton.Location = new System.Drawing.Point(13, 83); this.newButton.Name = "newButton"; this.newButton.Size = new System.Drawing.Size(102, 22); this.newButton.TabIndex = 5; this.newButton.Text = "Clear template"; this.newButton.UseVisualStyleBackColor = true; this.newButton.Click += new System.EventHandler(this.newButton_Click); // // loadButton // this.loadButton.Location = new System.Drawing.Point(12, 27); this.loadButton.Name = "loadButton"; this.loadButton.Size = new System.Drawing.Size(102, 22); this.loadButton.TabIndex = 7; this.loadButton.Text = "Load template"; this.loadButton.UseVisualStyleBackColor = true; this.loadButton.Click += new System.EventHandler(this.loadButton_Click); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(3, 6); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(55, 13); this.label1.TabIndex = 12; this.label1.Text = "Data Field"; // // panelPictBox // this.panelPictBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panelPictBox.AutoScroll = true; this.panelPictBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panelPictBox.Controls.Add(this.pictBox); this.panelPictBox.Location = new System.Drawing.Point(3, 90); this.panelPictBox.Name = "panelPictBox"; this.panelPictBox.Size = new System.Drawing.Size(1148, 587); this.panelPictBox.TabIndex = 13; // // pictBox // this.pictBox.Enabled = false; this.pictBox.Location = new System.Drawing.Point(3, 3); this.pictBox.Name = "pictBox"; this.pictBox.Size = new System.Drawing.Size(640, 346); this.pictBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.pictBox.TabIndex = 11; this.pictBox.TabStop = false; this.pictBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictBox_MouseDown); this.pictBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictBox_MouseMove); this.pictBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictBox_MouseUp); // // buttonLoadImage // this.buttonLoadImage.Location = new System.Drawing.Point(12, 277); this.buttonLoadImage.Name = "buttonLoadImage"; this.buttonLoadImage.Size = new System.Drawing.Size(101, 22); this.buttonLoadImage.TabIndex = 2; this.buttonLoadImage.Text = "Load Image"; this.buttonLoadImage.UseVisualStyleBackColor = true; this.buttonLoadImage.Click += new System.EventHandler(this.buttonLoadImage_Click); // // textBoxPageNumber // this.textBoxPageNumber.Enabled = false; this.textBoxPageNumber.Location = new System.Drawing.Point(8, 305); this.textBoxPageNumber.Name = "textBoxPageNumber"; this.textBoxPageNumber.Size = new System.Drawing.Size(32, 20); this.textBoxPageNumber.TabIndex = 14; this.textBoxPageNumber.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxPageNumber_KeyPress); // // labelPage // this.labelPage.AutoSize = true; this.labelPage.Location = new System.Drawing.Point(40, 313); this.labelPage.Name = "labelPage"; this.labelPage.Size = new System.Drawing.Size(18, 13); this.labelPage.TabIndex = 15; this.labelPage.Text = "/0"; // // comboBoxZoomRatio // this.comboBoxZoomRatio.Enabled = false; this.comboBoxZoomRatio.FormattingEnabled = true; this.comboBoxZoomRatio.Items.AddRange(new object[] { "20%", "40%", "60%", "80%", "100%", "120%", "140%", "160%", "180%", "200%", "220%", "240%", "260%", "280%", "300%"}); this.comboBoxZoomRatio.Location = new System.Drawing.Point(51, 333); this.comboBoxZoomRatio.Name = "comboBoxZoomRatio"; this.comboBoxZoomRatio.Size = new System.Drawing.Size(61, 21); this.comboBoxZoomRatio.TabIndex = 16; this.comboBoxZoomRatio.SelectedIndexChanged += new System.EventHandler(this.comboBoxZoomRatio_SelectedIndexChanged); this.comboBoxZoomRatio.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBoxZoomRatio_KeyPress); // // checkBoxPageNumber // this.checkBoxPageNumber.AutoSize = true; this.checkBoxPageNumber.Location = new System.Drawing.Point(11, 211); this.checkBoxPageNumber.Name = "checkBoxPageNumber"; this.checkBoxPageNumber.Size = new System.Drawing.Size(89, 17); this.checkBoxPageNumber.TabIndex = 18; this.checkBoxPageNumber.Text = "Page Column"; this.checkBoxPageNumber.UseVisualStyleBackColor = true; this.checkBoxPageNumber.CheckedChanged += new System.EventHandler(this.checkBoxPageNumber_CheckedChanged); // // comboBoxPageCol // this.comboBoxPageCol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxPageCol.Enabled = false; this.comboBoxPageCol.FormattingEnabled = true; this.comboBoxPageCol.Location = new System.Drawing.Point(11, 234); this.comboBoxPageCol.Name = "comboBoxPageCol"; this.comboBoxPageCol.Size = new System.Drawing.Size(101, 21); this.comboBoxPageCol.TabIndex = 19; this.comboBoxPageCol.SelectedIndexChanged += new System.EventHandler(this.comboBoxPageCol_SelectedIndexChanged); // // panel1 // this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.Controls.Add(this.panelPictBox); this.panel1.Controls.Add(this.dataGridView); this.panel1.Controls.Add(this.label1); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(1154, 680); this.panel1.TabIndex = 20; // // panel2 // this.panel2.Controls.Add(this.numericSpin); this.panel2.Controls.Add(this.newButton); this.panel2.Controls.Add(this.saveButton); this.panel2.Controls.Add(this.textBoxRowsNumber); this.panel2.Controls.Add(this.buttonSizeDown); this.panel2.Controls.Add(this.buttonPositionDown); this.panel2.Controls.Add(this.loadButton); this.panel2.Controls.Add(this.buttonSizeUp); this.panel2.Controls.Add(this.buttonSizeRight); this.panel2.Controls.Add(this.buttonPositionUp); this.panel2.Controls.Add(this.buttonSizeLeft); this.panel2.Controls.Add(this.buttonPositionRight); this.panel2.Controls.Add(this.label5); this.panel2.Controls.Add(this.label7); this.panel2.Controls.Add(this.label11); this.panel2.Controls.Add(this.label3); this.panel2.Controls.Add(this.buttonPositionLeft); this.panel2.Controls.Add(this.label4); this.panel2.Controls.Add(this.label8); this.panel2.Controls.Add(this.label12); this.panel2.Controls.Add(this.label9); this.panel2.Controls.Add(this.label2); this.panel2.Controls.Add(this.createButton); this.panel2.Controls.Add(this.buttonAbout); this.panel2.Controls.Add(this.buttonExit); this.panel2.Controls.Add(this.buttonRowHeight); this.panel2.Controls.Add(this.buttonLoadImage); this.panel2.Controls.Add(this.comboBoxPageCol); this.panel2.Controls.Add(this.buttonPreviousPage); this.panel2.Controls.Add(this.checkBoxPageNumber); this.panel2.Controls.Add(this.buttonNextPage); this.panel2.Controls.Add(this.comboBoxZoomRatio); this.panel2.Controls.Add(this.editButton); this.panel2.Controls.Add(this.labelPage); this.panel2.Controls.Add(this.deleteButton); this.panel2.Controls.Add(this.textBoxPageNumber); this.panel2.Dock = System.Windows.Forms.DockStyle.Right; this.panel2.Location = new System.Drawing.Point(1160, 0); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(124, 701); this.panel2.TabIndex = 21; this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint); // // numericSpin // this.numericSpin.Location = new System.Drawing.Point(53, 527); this.numericSpin.Minimum = new decimal(new int[] { 1, 0, 0, 0}); this.numericSpin.Name = "numericSpin"; this.numericSpin.Size = new System.Drawing.Size(53, 20); this.numericSpin.TabIndex = 13; this.numericSpin.Value = new decimal(new int[] { 1, 0, 0, 0}); this.numericSpin.ValueChanged += new System.EventHandler(this.numericSpin_ValueChanged); // // textBoxRowsNumber // this.textBoxRowsNumber.Enabled = false; this.textBoxRowsNumber.Location = new System.Drawing.Point(52, 386); this.textBoxRowsNumber.Name = "textBoxRowsNumber"; this.textBoxRowsNumber.Size = new System.Drawing.Size(61, 20); this.textBoxRowsNumber.TabIndex = 22; this.textBoxRowsNumber.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxRowsNumber_KeyPress); // // buttonSizeDown // this.buttonSizeDown.AutoSize = true; this.buttonSizeDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonSizeDown.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonSizeDown.Enabled = false; this.buttonSizeDown.FlatAppearance.BorderSize = 0; this.buttonSizeDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonSizeDown.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.plus_circle; this.buttonSizeDown.Location = new System.Drawing.Point(45, 607); this.buttonSizeDown.Name = "buttonSizeDown"; this.buttonSizeDown.Size = new System.Drawing.Size(32, 32); this.buttonSizeDown.TabIndex = 21; this.buttonSizeDown.UseVisualStyleBackColor = false; this.buttonSizeDown.Click += new System.EventHandler(this.buttonSizeDown_Click); // // buttonPositionDown // this.buttonPositionDown.AutoSize = true; this.buttonPositionDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonPositionDown.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonPositionDown.Enabled = false; this.buttonPositionDown.FlatAppearance.BorderSize = 0; this.buttonPositionDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonPositionDown.Image = ((System.Drawing.Image)(resources.GetObject("buttonPositionDown.Image"))); this.buttonPositionDown.Location = new System.Drawing.Point(46, 488); this.buttonPositionDown.Name = "buttonPositionDown"; this.buttonPositionDown.Size = new System.Drawing.Size(32, 32); this.buttonPositionDown.TabIndex = 21; this.buttonPositionDown.UseVisualStyleBackColor = false; this.buttonPositionDown.Click += new System.EventHandler(this.buttonPositionDown_Click); // // buttonSizeUp // this.buttonSizeUp.AutoSize = true; this.buttonSizeUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonSizeUp.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonSizeUp.Enabled = false; this.buttonSizeUp.FlatAppearance.BorderSize = 0; this.buttonSizeUp.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonSizeUp.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.minus_circle; this.buttonSizeUp.Location = new System.Drawing.Point(46, 553); this.buttonSizeUp.Name = "buttonSizeUp"; this.buttonSizeUp.Size = new System.Drawing.Size(30, 30); this.buttonSizeUp.TabIndex = 21; this.buttonSizeUp.UseVisualStyleBackColor = false; this.buttonSizeUp.Click += new System.EventHandler(this.buttonSizeUp_Click); // // buttonSizeRight // this.buttonSizeRight.AutoSize = true; this.buttonSizeRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonSizeRight.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonSizeRight.Enabled = false; this.buttonSizeRight.FlatAppearance.BorderSize = 0; this.buttonSizeRight.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonSizeRight.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.plus_circle; this.buttonSizeRight.Location = new System.Drawing.Point(79, 579); this.buttonSizeRight.Name = "buttonSizeRight"; this.buttonSizeRight.Size = new System.Drawing.Size(32, 32); this.buttonSizeRight.TabIndex = 21; this.buttonSizeRight.UseVisualStyleBackColor = false; this.buttonSizeRight.Click += new System.EventHandler(this.buttonSizeRight_Click); // // buttonPositionUp // this.buttonPositionUp.AutoSize = true; this.buttonPositionUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonPositionUp.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonPositionUp.Enabled = false; this.buttonPositionUp.FlatAppearance.BorderSize = 0; this.buttonPositionUp.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonPositionUp.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.arrow_up; this.buttonPositionUp.Location = new System.Drawing.Point(46, 437); this.buttonPositionUp.Name = "buttonPositionUp"; this.buttonPositionUp.Size = new System.Drawing.Size(32, 32); this.buttonPositionUp.TabIndex = 21; this.buttonPositionUp.UseVisualStyleBackColor = false; this.buttonPositionUp.Click += new System.EventHandler(this.buttonPositionUp_Click); // // buttonSizeLeft // this.buttonSizeLeft.AutoSize = true; this.buttonSizeLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonSizeLeft.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonSizeLeft.Enabled = false; this.buttonSizeLeft.FlatAppearance.BorderSize = 0; this.buttonSizeLeft.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonSizeLeft.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.minus_circle; this.buttonSizeLeft.Location = new System.Drawing.Point(8, 580); this.buttonSizeLeft.Name = "buttonSizeLeft"; this.buttonSizeLeft.Size = new System.Drawing.Size(32, 32); this.buttonSizeLeft.TabIndex = 21; this.buttonSizeLeft.UseVisualStyleBackColor = false; this.buttonSizeLeft.Click += new System.EventHandler(this.buttonSizeLeft_Click); // // buttonPositionRight // this.buttonPositionRight.AutoSize = true; this.buttonPositionRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonPositionRight.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonPositionRight.Enabled = false; this.buttonPositionRight.FlatAppearance.BorderSize = 0; this.buttonPositionRight.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonPositionRight.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.arrow_right; this.buttonPositionRight.Location = new System.Drawing.Point(79, 464); this.buttonPositionRight.Name = "buttonPositionRight"; this.buttonPositionRight.Size = new System.Drawing.Size(30, 32); this.buttonPositionRight.TabIndex = 21; this.buttonPositionRight.UseVisualStyleBackColor = false; this.buttonPositionRight.Click += new System.EventHandler(this.buttonPositionRight_Click); // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(12, 389); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(34, 13); this.label5.TabIndex = 20; this.label5.Text = "Rows"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(40, 473); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(44, 13); this.label7.TabIndex = 20; this.label7.Text = "Position"; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(18, 530); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(28, 13); this.label11.TabIndex = 20; this.label11.Text = "Spin"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(48, 590); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(27, 13); this.label3.TabIndex = 20; this.label3.Text = "Size"; // // buttonPositionLeft // this.buttonPositionLeft.AutoSize = true; this.buttonPositionLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonPositionLeft.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonPositionLeft.Enabled = false; this.buttonPositionLeft.FlatAppearance.BorderSize = 0; this.buttonPositionLeft.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonPositionLeft.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.arrow_left; this.buttonPositionLeft.Location = new System.Drawing.Point(10, 464); this.buttonPositionLeft.Name = "buttonPositionLeft"; this.buttonPositionLeft.Size = new System.Drawing.Size(32, 32); this.buttonPositionLeft.TabIndex = 21; this.buttonPositionLeft.UseVisualStyleBackColor = false; this.buttonPositionLeft.Click += new System.EventHandler(this.buttonPositionLeft_Click); // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(8, 336); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(34, 13); this.label4.TabIndex = 20; this.label4.Text = "Zoom"; // // label8 // this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label8.Location = new System.Drawing.Point(16, 365); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(87, 15); this.label8.TabIndex = 20; this.label8.Text = "NAVIGATION"; // // label12 // this.label12.AutoSize = true; this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label12.Location = new System.Drawing.Point(35, 107); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(41, 15); this.label12.TabIndex = 20; this.label12.Text = "DATA"; // // label9 // this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label9.Location = new System.Drawing.Point(22, 9); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(78, 15); this.label9.TabIndex = 20; this.label9.Text = "TEMPLATE"; // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.Location = new System.Drawing.Point(34, 258); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(50, 15); this.label2.TabIndex = 20; this.label2.Text = "IMAGE"; // // buttonRowHeight // this.buttonRowHeight.Enabled = false; this.buttonRowHeight.Location = new System.Drawing.Point(12, 411); this.buttonRowHeight.Name = "buttonRowHeight"; this.buttonRowHeight.Size = new System.Drawing.Size(101, 22); this.buttonRowHeight.TabIndex = 2; this.buttonRowHeight.Text = "Cal Row Height"; this.buttonRowHeight.UseVisualStyleBackColor = true; this.buttonRowHeight.Click += new System.EventHandler(this.buttonRowHeight_Click); // // buttonPreviousPage // this.buttonPreviousPage.Enabled = false; this.buttonPreviousPage.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.arrow_transition_180; this.buttonPreviousPage.Location = new System.Drawing.Point(76, 304); this.buttonPreviousPage.Name = "buttonPreviousPage"; this.buttonPreviousPage.Size = new System.Drawing.Size(23, 22); this.buttonPreviousPage.TabIndex = 2; this.buttonPreviousPage.UseVisualStyleBackColor = true; this.buttonPreviousPage.Click += new System.EventHandler(this.buttonPreviousPage_Click); // // buttonNextPage // this.buttonNextPage.Enabled = false; this.buttonNextPage.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.arrow_transition; this.buttonNextPage.Location = new System.Drawing.Point(99, 304); this.buttonNextPage.Name = "buttonNextPage"; this.buttonNextPage.Size = new System.Drawing.Size(23, 22); this.buttonNextPage.TabIndex = 2; this.buttonNextPage.UseVisualStyleBackColor = true; this.buttonNextPage.Click += new System.EventHandler(this.buttonNextPage_Click); // // numericUpDown1 // this.numericUpDown1.Enabled = false; this.numericUpDown1.Location = new System.Drawing.Point(1086, 2); this.numericUpDown1.Name = "numericUpDown1"; this.numericUpDown1.Size = new System.Drawing.Size(40, 20); this.numericUpDown1.TabIndex = 23; this.numericUpDown1.Visible = false; this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(1029, 4); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(50, 13); this.label6.TabIndex = 20; this.label6.Text = "Navigate"; this.label6.Visible = false; // // panel3 // this.panel3.Controls.Add(this.label10); this.panel3.Controls.Add(this.numericUpDown1); this.panel3.Controls.Add(this.label6); this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom; this.panel3.Location = new System.Drawing.Point(0, 679); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(1160, 22); this.panel3.TabIndex = 22; // // label10 // this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(12, 2); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(324, 13); this.label10.TabIndex = 12; this.label10.Text = "Copyright © by FPT Information System, FPT BPO Services Center."; // // buttonExit // this.buttonExit.Location = new System.Drawing.Point(13, 673); this.buttonExit.Name = "buttonExit"; this.buttonExit.Size = new System.Drawing.Size(101, 22); this.buttonExit.TabIndex = 2; this.buttonExit.Text = "Exit"; this.buttonExit.UseVisualStyleBackColor = true; this.buttonExit.Click += new System.EventHandler(this.buttonExit_Click); // // buttonAbout // this.buttonAbout.Location = new System.Drawing.Point(13, 647); this.buttonAbout.Name = "buttonAbout"; this.buttonAbout.Size = new System.Drawing.Size(101, 22); this.buttonAbout.TabIndex = 2; this.buttonAbout.Text = "About"; this.buttonAbout.UseVisualStyleBackColor = true; this.buttonAbout.Click += new System.EventHandler(this.buttonAbout_Click); // // FormTemplateCreator // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1284, 701); this.Controls.Add(this.panel3); this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "FormTemplateCreator"; this.Text = "FIS.iDET Template Creator"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.FormTemplateCreator_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); this.panelPictBox.ResumeLayout(false); this.panelPictBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictBox)).EndInit(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericSpin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); this.panel3.ResumeLayout(false); this.panel3.PerformLayout(); this.ResumeLayout(false); } #endregion public System.Windows.Forms.DataGridView dataGridView; private System.Windows.Forms.Button createButton; private System.Windows.Forms.Button editButton; private System.Windows.Forms.Button deleteButton; private System.Windows.Forms.Button saveButton; private System.Windows.Forms.Button newButton; private System.Windows.Forms.Button loadButton; private System.Windows.Forms.PictureBox pictBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.Panel panelPictBox; private System.Windows.Forms.Button buttonLoadImage; private System.Windows.Forms.TextBox textBoxPageNumber; private System.Windows.Forms.Label labelPage; private System.Windows.Forms.Button buttonPreviousPage; private System.Windows.Forms.Button buttonNextPage; public System.Windows.Forms.ComboBox comboBoxZoomRatio; public System.Windows.Forms.CheckBox checkBoxPageNumber; private System.Windows.Forms.ComboBox comboBoxPageCol; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.Button buttonSizeDown; private System.Windows.Forms.Button buttonPositionDown; private System.Windows.Forms.Button buttonSizeUp; private System.Windows.Forms.Button buttonSizeRight; private System.Windows.Forms.Button buttonPositionUp; private System.Windows.Forms.Button buttonSizeLeft; private System.Windows.Forms.Button buttonPositionRight; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button buttonPositionLeft; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox textBoxRowsNumber; private System.Windows.Forms.NumericUpDown numericUpDown1; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label9; private System.Windows.Forms.Button buttonRowHeight; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label12; private System.Windows.Forms.NumericUpDown numericSpin; private System.Windows.Forms.Label label11; private System.Windows.Forms.Button buttonAbout; private System.Windows.Forms.Button buttonExit; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/FormTemplateCreator.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
41,552
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Windows.Forms; namespace FIS.iDET.TemplateCreator { public class GlobalConstants { /* VARIABLES */ // username public static string Username = "No Name"; //version public static string stringVersion = "FIS.iDET Template Creator Tool \nVersion 2.0.0 Pre-Final"; // data columns info public static void OptionInit() { // get user name Username = RegistryService.GetValue(REGISTRY_USER_NAME) == null ? "No Name" : RegistryService.GetValue(REGISTRY_USER_NAME).Trim(); // date format index } /*** CONSTANTS ***/ // secret key used to generate serial number from machine ID public const string SERIAL_SECRET_KEY = "aed45dba1f73080de226c193d3f9d605"; // Company name, mainly used for folder naming public const string COMPANY_NAME = "FPT BPO iDET"; /* registry */ // Default path of registry to store serial number public const string REGISTRY_PATH = "Software\\" + COMPANY_NAME; // serial number string name public const string REGISTRY_SERIAL_NUMBER_KEY = "Serial"; // user name public const string REGISTRY_USER_NAME = "UN"; // no user name public const string REGISTRY_USER_NAME_NO_NAME = "No name"; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/GlobalConstants.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,488
using System; using System.Collections.Generic; using System.Text; namespace FIS.iDET.TemplateCreator { class GlobalVariables { public static string Version = "Version 2.1.0"; // current version of template creator public static string TemplateVersion = "2.0.6"; public const bool IsTri = false; public static DateTime ExpDate = new DateTime(2013, 2, 28); // data public static List<DataColumn> columns = new List<DataColumn>(); public static int TemplatePageCol = 0; // Image public static int spint = 1; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/GlobalVariables.cs
C#
Microsoft Reciprocal License (Ms-RL)
648
using System; using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms; namespace FIS.iDET.TemplateCreator { public class ImageService { string imageFileName; Bitmap tifImage; int totalFrames, currentFrame; Boolean fileLoadedOK = true; public ImageService() { fileLoadedOK = false; } public ImageService(string imageFileName) { this.imageFileName = imageFileName; LoadTifFile(); } public string FileName { get { return imageFileName; } set { imageFileName = value; LoadTifFile(); } } public int TotalFrames { get { return totalFrames; } set { totalFrames = value; } } public int Width { get { return tifImage.Width; } } public int Height { get { return tifImage.Height; } } public int CurrentFrame { get { return currentFrame; } set { currentFrame = value; } } public Boolean FileLoadedOK { get { return fileLoadedOK; } } private void LoadTifFile() { try { // decode tif image into bitmap tifImage = new Bitmap(imageFileName); // get total number of pages totalFrames = tifImage.GetFrameCount(FrameDimension.Page); } catch { fileLoadedOK = false; MessageBox.Show("Cannot load image file, please check if it is a valid TIFF image.", "Invalid image", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } private double zoomFactor = 1; public Bitmap GetImageZoom(double zoomFactor, DoubleRectangle rect) { return GetImageZoom(zoomFactor, rect, false); } public Bitmap GetImageZoom(double zoomFactor, DoubleRectangle rect, bool mode) // mode = 1 , draw multiple Rect { // calculate Zoom size this.zoomFactor = zoomFactor; int zoomWidth = scaleUp(Width); int zoomHeight = scaleUp(Height); // create a new empty temporary bitmap Bitmap tmp = new Bitmap(zoomWidth, zoomHeight); tmp.SetResolution(tifImage.HorizontalResolution, tifImage.VerticalResolution); // create new graphic object Graphics g = Graphics.FromImage(tmp); g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; // Zoom here Rectangle srcRect = new Rectangle(0, 0, (int) Width, (int) Height); Rectangle desRect = new Rectangle(0, 0, (int) zoomWidth, (int) zoomHeight); g.DrawImage(tifImage, desRect, srcRect, GraphicsUnit.Pixel); // draw rulers float penStrokeWidth = (float)zoomFactor * 4; Pen penRed = new Pen(Color.Orange, penStrokeWidth); penRed.Alignment = System.Drawing.Drawing2D.PenAlignment.Outset; var intRect = new Rectangle(); if (!mode) { intRect.X = scaleUp(rect.X); intRect.Y = scaleUp(rect.Y); intRect.Width = scaleUp(rect.Width); intRect.Height = scaleUp(rect.Height); if (rect.Width != 0 && rect.Height != 0) { g.DrawRectangle(penRed, intRect); } } else { for (int i = 1; i <= FormTemplateCreator.rows; i++) { if (rect.Width != 0 && rect.Height != 0) { intRect.Width = scaleUp(rect.Width); intRect.Height = scaleUp(rect.Height); intRect.X = scaleUp(rect.X); intRect.Y = scaleUp(rect.Y + rect.Height * (i - 1)); g.DrawRectangle(penRed, intRect); } } } // release Resource g.Dispose(); GC.Collect(); return tmp; } public Bitmap GetImageZoom(double zoomFactor) { // calculate Zoom size this.zoomFactor = zoomFactor; int zoomWidth = scaleUp(Width); int zoomHeight = scaleUp(Height); // create a new empty temporary bitmap Bitmap tmp = new Bitmap(zoomWidth, zoomHeight); tmp.SetResolution(tifImage.HorizontalResolution, tifImage.VerticalResolution); // create new graphic object Graphics g = Graphics.FromImage(tmp); g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; // Zoom here Rectangle srcRect = new Rectangle(0, 0, Width, Height); Rectangle desRect = new Rectangle(0, 0, zoomWidth, zoomHeight); g.DrawImage(tifImage, desRect, srcRect, GraphicsUnit.Pixel); // release Resource g.Dispose(); GC.Collect(); return tmp; } private int scaleUp(double original) { return (int) Math.Round(original * zoomFactor); } public void SetImageFrame(int frameToDisplay) { if (frameToDisplay >= 0 && frameToDisplay < totalFrames) currentFrame = frameToDisplay; // set active frame tifImage.SelectActiveFrame(FrameDimension.Page, currentFrame); } public Bitmap GetImageFrame(int frameToDisplay, double zoomFactor, DoubleRectangle rect) { SetImageFrame(frameToDisplay); return GetImageZoom(zoomFactor, rect,true); } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/ImageService.cs
C#
Microsoft Reciprocal License (Ms-RL)
6,597
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.Win32; using System.Text.RegularExpressions; namespace FIS.iDET.TemplateCreator { public partial class LicenseKeyForm : Form { public LicenseKeyForm() { InitializeComponent(); } private void LicenseKeyForm_Load(object sender, EventArgs e) { textBoxMachineID.Text = LicenseService.GetMachineID(); } private void buttonExit_Click(object sender, EventArgs e) { Application.ExitThread(); } private void buttonActivate_Click(object sender, EventArgs e) { string serialToCheck = textBoxLicenseKey.Text.Trim().ToUpper(); if (LicenseService.IsSerialNumberCorrect(serialToCheck)) { // activation succeeds // informs user MessageBox.Show("Activation succeeds! Application will now close, please re-open application to start using it.", "Activation succeeds", MessageBoxButtons.OK, MessageBoxIcon.Information); // add valid serial number to registry RegistryService.SetValue(GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY, serialToCheck); // add user name to registry RegistryService.SetValue(GlobalConstants.REGISTRY_USER_NAME, textBoxUserName.Text); // exit app to finish activation Application.ExitThread(); } else { // activation fails MessageBox.Show("Wrong serial number!", "Activation fails", MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxLicenseKey.Focus(); } } private void textBoxLicenseKey_TextChanged(object sender, EventArgs e) { // check if serial number form is valid string serial = textBoxLicenseKey.Text.Trim().ToUpper(); Match match = Regex.Match( serial, @"[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}" ); // change activate button status due to validation of user input's serial number labelActivate.Enabled = match.Success; } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/LicenseKeyForm.cs
C#
Microsoft Reciprocal License (Ms-RL)
2,617
namespace FIS.iDET.TemplateCreator { partial class LicenseKeyForm { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LicenseKeyForm)); this.label1 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.textBoxLicenseKey = new System.Windows.Forms.TextBox(); this.textBoxMachineID = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.labelActivate = new System.Windows.Forms.Label(); this.labelExit = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.textBoxUserName = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Arial", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(7)))), ((int)(((byte)(101))))); this.label1.Location = new System.Drawing.Point(32, 20); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(568, 29); this.label1.TabIndex = 0; this.label1.Text = "Application is not activated for this machine yet!"; // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(59)))), ((int)(((byte)(74))))); this.label3.Location = new System.Drawing.Point(35, 64); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(133, 19); this.label3.TabIndex = 0; this.label3.Text = "Your machine ID"; // // textBoxLicenseKey // this.textBoxLicenseKey.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.textBoxLicenseKey.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxLicenseKey.Location = new System.Drawing.Point(37, 220); this.textBoxLicenseKey.MaxLength = 39; this.textBoxLicenseKey.Name = "textBoxLicenseKey"; this.textBoxLicenseKey.Size = new System.Drawing.Size(626, 29); this.textBoxLicenseKey.TabIndex = 2; this.textBoxLicenseKey.TextChanged += new System.EventHandler(this.textBoxLicenseKey_TextChanged); // // textBoxMachineID // this.textBoxMachineID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.textBoxMachineID.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxMachineID.Location = new System.Drawing.Point(37, 86); this.textBoxMachineID.MaxLength = 39; this.textBoxMachineID.Name = "textBoxMachineID"; this.textBoxMachineID.ReadOnly = true; this.textBoxMachineID.Size = new System.Drawing.Size(626, 29); this.textBoxMachineID.TabIndex = 3; // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(59)))), ((int)(((byte)(74))))); this.label2.Location = new System.Drawing.Point(33, 198); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(289, 19); this.label2.TabIndex = 0; this.label2.Text = "Serial Number (from IT administrator)"; // // labelActivate // this.labelActivate.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(8)))), ((int)(((byte)(96)))), ((int)(((byte)(76))))); this.labelActivate.Enabled = false; this.labelActivate.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelActivate.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(163)))), ((int)(((byte)(223)))), ((int)(((byte)(47))))); this.labelActivate.Location = new System.Drawing.Point(158, 267); this.labelActivate.Name = "labelActivate"; this.labelActivate.Size = new System.Drawing.Size(121, 37); this.labelActivate.TabIndex = 4; this.labelActivate.Text = "Activate"; this.labelActivate.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.labelActivate.Click += new System.EventHandler(this.buttonActivate_Click); // // labelExit // this.labelExit.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(36)))), ((int)(((byte)(46)))), ((int)(((byte)(63))))); this.labelExit.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelExit.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(167)))), ((int)(((byte)(173)))), ((int)(((byte)(184))))); this.labelExit.Location = new System.Drawing.Point(408, 267); this.labelExit.Name = "labelExit"; this.labelExit.Size = new System.Drawing.Size(121, 37); this.labelExit.TabIndex = 4; this.labelExit.Text = "Exit"; this.labelExit.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.labelExit.Click += new System.EventHandler(this.buttonExit_Click); // // label6 // this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(59)))), ((int)(((byte)(74))))); this.label6.Location = new System.Drawing.Point(33, 131); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(117, 19); this.label6.TabIndex = 0; this.label6.Text = "Your full name"; // // textBoxUserName // this.textBoxUserName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.textBoxUserName.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxUserName.Location = new System.Drawing.Point(37, 153); this.textBoxUserName.MaxLength = 50; this.textBoxUserName.Name = "textBoxUserName"; this.textBoxUserName.Size = new System.Drawing.Size(626, 29); this.textBoxUserName.TabIndex = 2; // // LicenseKeyForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(118)))), ((int)(((byte)(164)))), ((int)(((byte)(200))))); this.ClientSize = new System.Drawing.Size(703, 323); this.Controls.Add(this.labelExit); this.Controls.Add(this.labelActivate); this.Controls.Add(this.textBoxMachineID); this.Controls.Add(this.textBoxUserName); this.Controls.Add(this.label6); this.Controls.Add(this.textBoxLicenseKey); this.Controls.Add(this.label2); this.Controls.Add(this.label3); this.Controls.Add(this.label1); this.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "LicenseKeyForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "FIS.iDET Registration"; this.Load += new System.EventHandler(this.LicenseKeyForm_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox textBoxLicenseKey; private System.Windows.Forms.TextBox textBoxMachineID; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label labelActivate; private System.Windows.Forms.Label labelExit; private System.Windows.Forms.Label label6; private System.Windows.Forms.TextBox textBoxUserName; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/LicenseKeyForm.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
10,595
using System; using System.Security.Cryptography; using System.Text; namespace FIS.iDET.TemplateCreator { /// <summary> /// Generates a 16 byte Unique Identification code of a computer /// Example: 1234-8DB5-5763-69D3-FE52-8CF7-395D-2EA9 /// </summary> public class LicenseService { private static string MachineID = null; private static string ValidSerial = null; public static Boolean AppIsActivated() { string serialToCheck = RegistryService.GetValue(GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY); return IsSerialNumberCorrect(serialToCheck); } /// <summary> /// gets the unique ID of current machine /// </summary> public static string GetMachineID() { // calculate machine ID for first time if (MachineID == null) { MachineID = GetHash( "CPU >> " + cpuId() + "\nBIOS >> " + biosId() //"\nBASE >> " + baseId() + //"\nDISK >> "+ diskId() + //"\nVIDEO >> " + videoId() + //"\nMAC >> " + macId() ); } return MachineID; } /// <summary> /// calculate serial number for a machine ID /// </summary> /// <param name="machineID"></param> /// <returns></returns> public static string GenerateSerialNumberFrom(string anyMachineID) { String serial = GetHash( "ID >> " + anyMachineID + "Secret >> " + GlobalConstants.SERIAL_SECRET_KEY ); return serial; } public static Boolean IsSerialNumberCorrect(string serialToCheck) { if (String.IsNullOrEmpty(serialToCheck)) return false; // normalize input serial serialToCheck = serialToCheck.Trim().ToUpper(); // calculate valid serial if needed if (ValidSerial == null) { if (MachineID == null) { GetMachineID(); } ValidSerial = GenerateSerialNumberFrom(MachineID); } return serialToCheck == ValidSerial; } /// <summary> /// generate 16-byte hash of a string /// </summary> /// <param name="s">input string</param> /// <returns>16-byte hash string</returns> private static string GetHash(string s) { MD5 sec = new MD5CryptoServiceProvider(); ASCIIEncoding enc = new ASCIIEncoding(); byte[] bt = enc.GetBytes(s); return GetHexString(sec.ComputeHash(bt)); } /// <summary> /// intended to be used by GetHash() /// </summary> /// <param name="bt">input string</param> /// <returns>hex string</returns> private static string GetHexString(byte[] bt) { string s = string.Empty; for (int i = 0; i < bt.Length; i++) { byte b = bt[i]; int n, n1, n2; n = (int)b; n1 = n & 15; n2 = (n >> 4) & 15; if (n2 > 9) s += ((char)(n2 - 10 + (int)'A')).ToString(); else s += n2.ToString(); if (n1 > 9) s += ((char)(n1 - 10 + (int)'A')).ToString(); else s += n1.ToString(); if ((i + 1) != bt.Length && (i + 1) % 2 == 0) s += "-"; } return s; } #region Original Device ID Getting Code //Return a hardware identifier private static string identifier(string wmiClass, string wmiProperty, string wmiMustBeTrue) { string result = ""; System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass); System.Management.ManagementObjectCollection moc = mc.GetInstances(); foreach (System.Management.ManagementObject mo in moc) { if (mo[wmiMustBeTrue].ToString() == "True") { //Only get the first one if (result == "") { try { result = mo[wmiProperty].ToString(); break; } catch { } } } } return result; } //Return a hardware identifier private static string identifier(string wmiClass, string wmiProperty) { string result = ""; System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass); System.Management.ManagementObjectCollection moc = mc.GetInstances(); foreach (System.Management.ManagementObject mo in moc) { //Only get the first one if (result == "") { try { if (mo[wmiProperty]!=null) result = mo[wmiProperty].ToString(); break; } catch { } } } return result; } private static string cpuId() { //Uses first CPU identifier available in order of preference //Don't get all identifiers, as it is very time consuming string retVal = identifier("Win32_Processor", "UniqueId"); if (retVal == "") //If no UniqueID, use ProcessorID { retVal = identifier("Win32_Processor", "ProcessorId"); if (retVal == "") //If no ProcessorId, use Name { retVal = identifier("Win32_Processor", "Name"); if (retVal == "") //If no Name, use Manufacturer { retVal = identifier("Win32_Processor", "Manufacturer"); } //Add clock speed for extra security retVal += identifier("Win32_Processor", "MaxClockSpeed"); } } return retVal; } //BIOS Identifier private static string biosId() { return identifier("Win32_BIOS", "Manufacturer") + identifier("Win32_BIOS", "SMBIOSBIOSVersion") + identifier("Win32_BIOS", "IdentificationCode") + identifier("Win32_BIOS", "SerialNumber") + identifier("Win32_BIOS", "ReleaseDate") + identifier("Win32_BIOS", "Version"); } //Main physical hard drive ID private static string diskId() { return identifier("Win32_DiskDrive", "Model") + identifier("Win32_DiskDrive", "Manufacturer") + identifier("Win32_DiskDrive", "Signature") + identifier("Win32_DiskDrive", "TotalHeads"); } //Motherboard ID private static string baseId() { return identifier("Win32_BaseBoard", "Model") + identifier("Win32_BaseBoard", "Manufacturer") + identifier("Win32_BaseBoard", "Name") + identifier("Win32_BaseBoard", "SerialNumber"); } //Primary video controller ID private static string videoId() { return identifier("Win32_VideoController", "DriverVersion") + identifier("Win32_VideoController", "Name"); } //First enabled network card ID private static string macId() { return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled"); } #endregion } }
2atgroup
TiffBrowserTestCSharp/Template Creator/LicenseService.cs
C#
Microsoft Reciprocal License (Ms-RL)
8,446
using System; using System.Collections.Generic; using System.Windows.Forms; namespace FIS.iDET.TemplateCreator { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { if (GlobalVariables.IsTri && DateTime.Now.CompareTo(GlobalVariables.ExpDate) > 0) { MessageBox.Show("Date_Time_Problem, contact developer !"); return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormTemplateCreator()); } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/Program.cs
C#
Microsoft Reciprocal License (Ms-RL)
738
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Template Creator")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Developed by Revo21 Studio <hoang@revo21studio.com>")] [assembly: AssemblyProduct("Template Creator")] [assembly: AssemblyCopyright("Copyright © 2012 Developed by Revo21")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("1eb1457c-837f-4dc8-b52b-6e9c8982e00c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.6.0")] [assembly: AssemblyFileVersion("2.0.6.0")]
2atgroup
TiffBrowserTestCSharp/Template Creator/Properties/AssemblyInfo.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,514
using System; using System.Collections.Generic; using System.Text; using Microsoft.Win32; using System.Windows.Forms; namespace FIS.iDET.TemplateCreator { public class RegistryService { private static RegistryKey appRegistryKey = Registry.CurrentUser.OpenSubKey(GlobalConstants.REGISTRY_PATH, true); private static RegistryKey appRegistryLicenseKey = Registry.LocalMachine.OpenSubKey(GlobalConstants.REGISTRY_PATH, false); public static void Init() { // in case key does not exist if (appRegistryKey == null) { // create new one Registry.CurrentUser.CreateSubKey(GlobalConstants.REGISTRY_PATH); appRegistryKey = Registry.CurrentUser.OpenSubKey(GlobalConstants.REGISTRY_PATH, true); } try { if (appRegistryLicenseKey == null) { Registry.LocalMachine.CreateSubKey(GlobalConstants.REGISTRY_PATH); appRegistryLicenseKey = Registry.LocalMachine.OpenSubKey(GlobalConstants.REGISTRY_PATH, true); } } catch { MessageBox.Show("Your application hasn't been activated. Please run under administrative rights to active it!","Administrator Request",MessageBoxButtons.OK,MessageBoxIcon.Stop); Application.Exit(); } } /// <summary> /// gets application registry value from a key /// </summary> /// <param name="name">key name</param> /// <returns>key's value</returns> public static string GetValue(string name) { try { if (name == GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY || name == GlobalConstants.REGISTRY_USER_NAME) return appRegistryLicenseKey.GetValue(name) as string; else return appRegistryKey.GetValue(name) as string; } catch (Exception ex) { MessageBox.Show("Error while reading from registry key \"" + appRegistryKey.ToString() + "\": " + ex.Message); return null; } } /// <summary> /// set application registry value to a key /// </summary> /// <param name="name">key name</param> /// <param name="value">new value to set to key</param> public static void SetValue(string name, string value) { try { if (name == GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY || name == GlobalConstants.REGISTRY_USER_NAME) { //grant write permisson appRegistryLicenseKey = Registry.LocalMachine.OpenSubKey(GlobalConstants.REGISTRY_PATH, true); appRegistryLicenseKey.SetValue(name, value); appRegistryLicenseKey.Flush(); } else { appRegistryKey.SetValue(name, value); appRegistryKey.Flush(); } } catch { MessageBox.Show("Error while writing to registry key. Please call IT for support.", "Administrative Rights Needed",MessageBoxButtons.OK,MessageBoxIcon.Warning); } } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/RegistryService.cs
C#
Microsoft Reciprocal License (Ms-RL)
3,516
using System; using System.Collections.Generic; using System.Xml; using System.IO; using System.Text; using System.Windows.Forms; namespace FIS.iDET.TemplateCreator { class XmlService { public static List<DataColumn> ReadXml(string fromFile) { try { FileStream fs = new FileStream(fromFile, FileMode.Open); XmlTextReader r = new XmlTextReader(fs); // array to store processed data List<DataColumn> columns = new List<DataColumn>(); // read column nodes while (r.Read()) { if (r.NodeType == XmlNodeType.Element && r.Name == "template") { // set template properties to global vars // GlobalConstants.TemplateName = r.GetAttribute("name"); FormTemplateCreator.zoomFactor = Convert.ToDouble(r.GetAttribute("zoom")) / 100; GlobalVariables.TemplateVersion = r.GetAttribute("version"); GlobalVariables.TemplatePageCol = Convert.ToInt32(r.GetAttribute("pagecol")); // break; } // get header text from current node's name if (r.NodeType == XmlNodeType.Element && r.Name == "col") { columns.Add( new DataColumn( r.GetAttribute("fieldname"), Convert.ToInt32(r.GetAttribute("datatype")), Convert.ToInt32(r.GetAttribute("colwidth")), Convert.ToDouble(r.GetAttribute("x")), Convert.ToDouble(r.GetAttribute("y")), Convert.ToDouble(r.GetAttribute("w")), Convert.ToDouble(r.GetAttribute("h")))); } } fs.Close(); return columns; } catch (Exception ex) { MessageBox.Show("Unexpected error while loading template file \"" + fromFile + "\"\nError details: " + ex.Message); return null; } } public static void WriteXml(string toFile, DataGridView dataGridView) { try { FileStream fs = new FileStream(toFile, FileMode.Create, FileAccess.Write); XmlTextWriter w = new XmlTextWriter(fs, Encoding.UTF8); w.Formatting = Formatting.Indented; w.Indentation = 4; w.WriteStartDocument(); // root node // <template zoom="100%" version="2.0"> w.WriteStartElement("template"); w.WriteAttributeString("zoom", (FormTemplateCreator.zoomFactor * 100).ToString()); w.WriteAttributeString("version", GlobalVariables.TemplateVersion); if (GlobalVariables.TemplatePageCol !=0) { w.WriteAttributeString("pagecol", GlobalVariables.TemplatePageCol.ToString()); } // element nodes // <col name="Field Name" datatype="number or text or date" width="100"/> // sort columns to display index int[] a = new int[dataGridView.ColumnCount]; int[] b = new int[dataGridView.ColumnCount]; for (int i = 0; i < dataGridView.ColumnCount; i++) { b[i] = dataGridView.Columns[i].DisplayIndex; } for (int i = 0; i < dataGridView.ColumnCount; i++) for (int j = 0; j < dataGridView.ColumnCount; j++) { if (b[j] == i) { a[i] = j; break; } } for (int j = 0; j < dataGridView.ColumnCount; j++) { int i = a[j]; w.WriteStartElement("col"); w.WriteAttributeString("fieldname", dataGridView.Columns[i].HeaderText); w.WriteAttributeString("datatype", getDataTypeShortNameOf(dataGridView.Rows[0].Cells[i].Value.ToString())); w.WriteAttributeString("colwidth", dataGridView.Columns[i].Width.ToString()); w.WriteAttributeString("x", GlobalVariables.columns[i].X.ToString()); w.WriteAttributeString("y", GlobalVariables.columns[i].Y.ToString()); w.WriteAttributeString("w", GlobalVariables.columns[i].W.ToString()); w.WriteAttributeString("h", GlobalVariables.columns[i].H.ToString()); w.WriteEndElement(); } // close xml tags w.WriteEndElement(); w.WriteEndDocument(); // close document w.Flush(); fs.Close(); MessageBox.Show("Template file saved to \"" + toFile + "\" successfully!"); } catch (Exception ex) { MessageBox.Show("Unexpected error while saving file to \"" + toFile + "\"\nError details: " + ex.Message); } } public static string getDataTypeShortNameOf(string longName) { if (longName == "Date Time") return DataTypeEnum.COLUMN_TYPE_DATE.ToString(); else if (longName == "Number") return DataTypeEnum.COLUMN_TYPE_NUMBER.ToString(); else return DataTypeEnum.COLUMN_TYPE_TEXT.ToString(); } public static string getDataTypeLongNameOf(int shortName) { switch (shortName) { case DataTypeEnum.COLUMN_TYPE_DATE: return "Date Time"; case DataTypeEnum.COLUMN_TYPE_NUMBER: return "Number"; default: return "General Text"; } } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/XmlService.cs
C#
Microsoft Reciprocal License (Ms-RL)
6,435
using System; using System.Windows.Forms; namespace FIS.iDET { public class ClipboardUtils { public static void OnDataGridPaste(object grid, KeyEventArgs e) { //MessageBox.Show(e.KeyCode.ToString()); if (e.Control ) if ( e.KeyCode == Keys.V) PasteFromClipboard((DataGridView)grid); else if ( e.KeyCode == Keys.Oem7) PasteFromUpper((DataGridView)grid); if (e.KeyCode == Keys.Delete) DeleteSelectedArea((DataGridView)grid); } public static void DeleteSelectedArea(DataGridView grid) { for (int i = 0; i < grid.SelectedCells.Count; i++) grid.SelectedCells[i].Value = null; } public static void PasteFromUpper(DataGridView grid) { int currentRow = grid.SelectedCells[0].RowIndex; int currentColumn = grid.SelectedCells[0].ColumnIndex; if (grid.SelectedCells.Count > 1) { // choose the 1st cell for (int i = 1; i < grid.SelectedCells.Count; i++) { if (currentRow > grid.SelectedCells[i].RowIndex) currentRow = grid.SelectedCells[i].RowIndex; if (currentColumn > grid.SelectedCells[i].ColumnIndex) currentColumn = grid.SelectedCells[i].ColumnIndex; } DataGridViewCell cell = grid[currentColumn, currentRow]; // if 1st cell null if (cell.Value == null && currentRow>0 ) if (!cell.ReadOnly) //H.NH add cell.Value = grid[currentColumn, currentRow - 1].Value; //choose the upper cell for (int i = 0; i < grid.SelectedCells.Count; i++) { if (!grid.SelectedCells[i].ReadOnly) grid.SelectedCells[i].Value = cell.Value; //H.NH add } } else { if (currentRow > 0) grid[currentColumn, currentRow].Value = grid[currentColumn, currentRow - 1].Value; } } public static void PasteFromClipboard(DataGridView grid) { try { char[] rowSplitter = { '\r', '\n' }; char[] columnSplitter = { '\t' }; // Get the text from Clipboard IDataObject dataInClipboard = Clipboard.GetDataObject(); string stringInClipboard = (string)dataInClipboard.GetData(DataFormats.StringFormat); // split into rows string[] rowInClipboard = stringInClipboard.Split(rowSplitter, StringSplitOptions.RemoveEmptyEntries); // get current cell int currentRow = grid.SelectedCells[0].RowIndex; int currentColumn = grid.SelectedCells[0].ColumnIndex; // get 1st cell in selected area for (int i = 1; i < grid.SelectedCells.Count; i++) { if (currentRow > grid.SelectedCells[i].RowIndex) currentRow = grid.SelectedCells[i].RowIndex; if (currentColumn > grid.SelectedCells[i].ColumnIndex) currentColumn = grid.SelectedCells[i].ColumnIndex; } // add more rows if need to paste data /* if (grid.Rows.Count < rowInClipboard.Length + currentRow) grid.Rows.Add(rowInClipboard.Length + currentRow - grid.Rows.Count); */ // paste for (int iRow = 0; iRow < rowInClipboard.Length; iRow++) { if (iRow + currentRow < grid.Rows.Count) { string[] cellsInRow = rowInClipboard[iRow].Split(columnSplitter); for (int iCol = 0; iCol < cellsInRow.Length; iCol++) { if (grid.ColumnCount > currentColumn + iCol) { DataGridViewCell currentCell = grid.Rows[currentRow + iRow].Cells[currentColumn + iCol]; if (!currentCell.ReadOnly) // H.NH added to avoid Read only case. currentCell.Value = cellsInRow[iCol]; } } } else break; } } catch (Exception e) { MessageBox.Show("Sorry, can not paste from the clipboard.\nError: " + e.Message, "Paste Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/ClipboardUtils.cs
C#
Microsoft Reciprocal License (Ms-RL)
4,946
using System; using System.Collections.Generic; using System.Text; using System.Drawing; namespace FIS.iDET { public class DataColumn { public DataColumn() { // set default values _width = 100; _type = DataTypeEnum.COLUMN_TYPE_TEXT; _header = "Untitled"; x = y = w = h = 0; } public DataColumn(string header) { // set default values _width = 100; _type = DataTypeEnum.COLUMN_TYPE_TEXT; _header = header; x = y = w = h = 0; } public DataColumn(string header, int type, int width, DoubleRectangle rect) { // set default values _width = width; _type = type; _header = header; x = rect.X; y = rect.Y; w = rect.Width; h = rect.Height; } private double x, y, w, h; public DataColumn(string header, int type, int width, double x, double y, double w, double h) { // set default values _width = width; _type = type; _header = header; this.x = x; this.y = y; this.w = w; this.h = h; } public DataColumn (DataColumn datacol) { this._header = datacol.Header; this._width = datacol.Width; this._type = datacol.Type; this.x = datacol.x; this.y = datacol.y; this.w = datacol.w; this.h = datacol.h; } public DoubleRectangle Rect { get { return new DoubleRectangle(x, y, w, h); } set { x = value.X; y = value.Y; w = value.Width; h = value.Height; } } public double X { get { return x; } set { this.x = value; } } public double Y { get { return y; } set { this.y = value; } } public double W { get { return w; } set { this.w = value; } } public double H { get { return h; } set { this.h = value; } } private int _width; public int Width { get { return _width; } set { _width = value; } } private int _type; public int Type { get { return _type; } set { _type = value; } } private string _header; public string Header { get { return _header; } set { _header = value; } } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/DataColumn.cs
C#
Microsoft Reciprocal License (Ms-RL)
3,001
using System; using System.Collections.Generic; using System.Text; namespace FIS.iDET { public static class DataTypeEnum { /* data type for datagridview column */ public const int COLUMN_TYPE_NUMBER = 0; public const int COLUMN_TYPE_DATE = 1; public const int COLUMN_TYPE_TEXT = 2; } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/DataTypeEnum.cs
C#
Microsoft Reciprocal License (Ms-RL)
348
using System; using System.Collections.Generic; using System.Text; namespace FIS.iDET { /*class DoublePoint { public double X=0, Y=0; public DoublePoint(double X, double Y) { this. } }*/ public class DoubleRectangle { public double X = 0, Y = 0, Width = 0, Height = 0; public DoubleRectangle(double x, double y, double width, double height) { this.X = x; this.Y = y; this.Width = width; this.Height = height; } public DoubleRectangle() { } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/DoubleRectangle.cs
C#
Microsoft Reciprocal License (Ms-RL)
653
using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; using System.Windows.Forms; using Microsoft.Office.Interop.Excel; namespace FIS.iDET { /// <summary> /// Class providing methods to work with data importing from and exporting to Microsoft Excel /// </summary> public class ExcelService { /// <summary> /// The excel app (COM) /// This costs memory since it loads one new excel app to one instance of this class. /// Initialize this class with care! /// ALWAYS remember to call QuitExelApp() to quit the excel app after using /// I don't make this static since it's may cause conflict when /// many workbooks are opened at the same time /// </summary> _Application excelApp = new Microsoft.Office.Interop.Excel.Application(); // excel file full path, this is the excel file this class will work on string excelFileName; public int sheetsCount; Boolean saved = true; public ExcelService() { // init excel app // hide from UI excelApp.Visible = false; // no alert boxes excelApp.DisplayAlerts = false; } /// <summary> /// initialize new excel service for an excel file /// </summary> /// <param name="excelFullFilePath">full path to excel file for this excel service to work on</param> public ExcelService(string excelFileName) { this.excelFileName = excelFileName; // init excel app // hide from UI excelApp.Visible = false; // no alert boxes excelApp.DisplayAlerts = false; } /// <summary> /// check if current excel file exists /// </summary> public Boolean FileExists { get { if (String.IsNullOrEmpty(excelFileName)) return false; else return File.Exists(excelFileName); } } public Boolean Saved { get { return saved; } set { saved = value; } } public string FileName { get { return excelFileName; } set { excelFileName = value; } } public void SaveAsAutoSave(DataGridView dataGridView) //H.NH handle autosave corruption { if (dataGridView.ColumnCount == 0) return; _Workbook workBook; try { // creating new WorkBook within Excel application workBook = excelApp.Workbooks.Add(Type.Missing); // get new Excelsheet in workbook _Worksheet workSheet = workBook.Sheets["Sheet1"] as _Worksheet; //TODO delete // store its reference to worksheet workSheet = workBook.ActiveSheet as _Worksheet; // store header part in Excel for (int i = 1; i < dataGridView.Columns.Count + 1; i++) workSheet.Cells[1, i] = dataGridView.Columns[i - 1].HeaderText; // store data to temp array object[,] values = new object[dataGridView.Rows.Count, dataGridView.Columns.Count]; for (int i = 0; i < dataGridView.Rows.Count; i++) for (int j = 0; j < dataGridView.Columns.Count; j++) if (dataGridView.Rows[i].Cells[j].Value != null) values[i, j] = dataGridView.Rows[i].Cells[j].Value.ToString(); // store Each row and column value to excel sheet string lastCell = GetLastCellName(dataGridView.Columns.Count, dataGridView.Rows.Count); if (GlobalConstants.TemplatePageCol != 0) // multiline mode workSheet.get_Range("A2", lastCell).NumberFormat = "@"; // all data save as string ! workSheet.get_Range("A2", lastCell).Value2 = values; } catch (Exception e) { // debug // MessageBox.Show("Cannot save file, please ensure that Excel is not opening else where.\n" + e.Message, "Save file error"); return; } try { // delete destination file, if any if (File.Exists(excelFileName)) File.Delete(excelFileName); // save the workbook workBook.SaveAs(excelFileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, XlSaveConflictResolution.xlLocalSessionChanges, Type.Missing, Type.Missing, Type.Missing); // set curent status of excel file to "just saved" saved = true; } catch (Exception e) { // debug //MessageBox.Show("File cannot be saved, please check file permissions.\n" + e.Message, "Save file error"); } finally { // close workbook and worksheet workBook.Close(); workBook = null; GC.Collect(); } } public void SaveAs(DataGridView dataGridView) { if (dataGridView.ColumnCount == 0) return; _Workbook workBook; try { // creating new WorkBook within Excel application workBook = excelApp.Workbooks.Add(Type.Missing); } catch (Exception e) { // debug MessageBox.Show("Cannot save file, please ensure that Excel is not opening else where.\n" + e.Message, "Save file error"); return; } // get new Excelsheet in workbook _Worksheet workSheet = workBook.Sheets["Sheet1"] as _Worksheet; //TODO delete // store its reference to worksheet workSheet = workBook.ActiveSheet as _Worksheet; // store header part in Excel for (int i = 1; i < dataGridView.Columns.Count + 1; i++) workSheet.Cells[1, i] = dataGridView.Columns[i - 1].HeaderText; // store data to temp array object[,] values = new object[dataGridView.Rows.Count, dataGridView.Columns.Count]; for (int i = 0; i < dataGridView.Rows.Count; i++) for (int j = 0; j < dataGridView.Columns.Count; j++) if (dataGridView.Rows[i].Cells[j].Value != null) values[i, j] = dataGridView.Rows[i].Cells[j].Value.ToString(); // store Each row and column value to excel sheet string lastCell = GetLastCellName(dataGridView.Columns.Count, dataGridView.Rows.Count); if (GlobalConstants.TemplatePageCol != 0 ) // multiline mode workSheet.get_Range("A2", lastCell).NumberFormat = "@"; // all data save as string ! workSheet.get_Range("A2", lastCell).Value2 = values; try { // delete destination file, if any if (File.Exists(excelFileName)) File.Delete(excelFileName); // save the workbook workBook.SaveAs(excelFileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, XlSaveConflictResolution.xlLocalSessionChanges, Type.Missing, Type.Missing, Type.Missing); // set curent status of excel file to "just saved" saved = true; } catch ( Exception e) { // debug MessageBox.Show("File cannot be saved, please check file permissions.\n" + e.Message, "Save file error"); } finally { // close workbook and worksheet workBook.Close(); workSheet = null; workBook = null; GC.Collect(); } } public void SaveComapreResultAs(List<PageCompareInfo> listAllPagesCompare, int numsheets, ref List<ExcelSheet> listExcelSheetsResult) { _Workbook workBook; try { // creating new WorkBook within Excel application workBook = excelApp.Workbooks.Add(Type.Missing); } catch (Exception e) { // debug MessageBox.Show("Cannot save file, please ensure that Excel is not opening else where.\n"+e.Message, "Save file error"); return; } for (int i = numsheets; i >= GlobalVariables.startSheet; i--) { // get new Excelsheet in workbook string sheetName = string.Format("Page{0}", i); Sheets xlSheets = workBook.Sheets as Sheets; //TODO delete //add new sheet //_Worksheet newSheet = (_Worksheet)xlSheets.Add(xlSheets[1], Type.Missing, Type.Missing, Type.Missing); _Worksheet newSheet = (_Worksheet)xlSheets.Add(); newSheet.Name = sheetName; // store header part in Excel for (int j = 0; j < listAllPagesCompare[i].listColumnCompare.Count; j++) newSheet.Cells[1, j + 1] = listAllPagesCompare[i].listColumnCompare[j].fieldName; // add page number // DANGEROUS CODE HERE !!! newSheet.Cells[listAllPagesCompare[i].listColumnCompare.Count + 1] = GlobalConstants.ExtendColumnName; // identify last cell int id = listAllPagesCompare[i].listColumnCompare.Count - 1; int lastCellColumn = listAllPagesCompare[i].listColumnCompare[id].column + GlobalConstants.ExtendColumn; int lastCellRow = listAllPagesCompare[i].endRow; // store data to excel string lastCell = GetLastCellName(lastCellColumn, lastCellRow); newSheet.get_Range("A2", lastCell).NumberFormat = "@"; newSheet.get_Range("A2", lastCell).Value2 = listExcelSheetsResult[i].value; } // delete Sheet1, Sheet2, Sheet3 for (int i = 0; i < 3; i++) { _Worksheet sheet = workBook.Worksheets[numsheets - GlobalVariables.startSheet + 2] as _Worksheet; sheet.Delete(); } try { // delete destination file, if any if (File.Exists(excelFileName)) File.Delete(excelFileName); // save the workbook workBook.SaveAs(excelFileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, XlSaveConflictResolution.xlLocalSessionChanges, Type.Missing, Type.Missing, Type.Missing); // set curent status of excel file to "just saved" saved = true; } catch (Exception e) { // debug MessageBox.Show("File cannot be saved, please check file permissions.\n" + e.Message, "Save file error"); } finally { // close workbook and worksheet workBook.Close(); Marshal.ReleaseComObject(workBook); workBook = null; GC.Collect(); } } public void SaveComapreResultAsOneSheet(List<PageCompareInfo> listAllPagesCompare, int numsheets, ref List<ExcelSheet> listExcelSheetsResult) { _Workbook workBook; object[,] excelSheetResult = new object[65540, GlobalConstants.maxColumns]; try { // creating new WorkBook within Excel application workBook = excelApp.Workbooks.Add(Type.Missing); } catch (Exception e) { // debug MessageBox.Show("Cannot save file, please ensure that Excel is not opening else where.\n"+e.Message, "Save file error"); return; } _Worksheet xlSheet = workBook.Sheets[1] as _Worksheet; xlSheet = workBook.ActiveSheet as _Worksheet; // store header part in Excel for (int j = 0; j < listAllPagesCompare[0].listColumnCompare.Count; j++) xlSheet.Cells[1, j + 1] = listAllPagesCompare[0].listColumnCompare[j].fieldName; int lastCellColumn = listAllPagesCompare[0].listColumnCompare.Count + GlobalConstants.ExtendColumn; // int lastCellColumn = GlobalVariables.lastColumn + GlobalConstants.ExtendColumn; xlSheet.Cells[1, lastCellColumn] = GlobalConstants.ExtendColumnName; long bookmarkRow = 0; for (int i = GlobalVariables.startSheet; i <= numsheets; i++) { int startRow = listAllPagesCompare[i].startRow; int endRow = listAllPagesCompare[i].endRow; for (int k = 0; k < lastCellColumn; k++) { for (int j = 0; j <= (endRow - startRow); j++) { excelSheetResult[bookmarkRow + j, k] = listExcelSheetsResult[i].value[j, k]; } } if (endRow >= startRow) bookmarkRow = bookmarkRow + (endRow - startRow + 1); } //store data to excel string lastCell = GetLastCellName(lastCellColumn, bookmarkRow); xlSheet.get_Range("A2", lastCell).NumberFormat = "@"; xlSheet.get_Range("A2", lastCell).Value2 = excelSheetResult; try { // delete destination file, if any if (File.Exists(excelFileName)) File.Delete(excelFileName); // save the workbook workBook.SaveAs(excelFileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive, XlSaveConflictResolution.xlLocalSessionChanges, Type.Missing, Type.Missing, Type.Missing); // set curent status of excel file to "just saved" saved = true; } catch (Exception e) { // debug MessageBox.Show("File cannot be saved, please check file permissions.\n" + e.Message , "Save file error"); } finally { // close workbook and worksheet excelSheetResult = null; workBook.Close(); Marshal.ReleaseComObject(workBook); workBook = null; GC.Collect(); } } public static string GetLastCellName(int maxColumn, long maxRow) { string col = ((string)(Convert.ToChar(maxColumn / 26 + 64).ToString() + Convert.ToChar(maxColumn % 26 + 64))).Replace('@', ' ').Trim(); return String.Concat(col, (maxRow + 1).ToString()); } public void SaveFilePathToRegistry() { if (String.IsNullOrEmpty(excelFileName)) RegistryService.SetValue(GlobalConstants.REGISTRY_LAST_EXCEL_KEY, GlobalConstants.REGISTRY_LAST_EXCEL_NULL_VALUE); else // save destination file path to registry RegistryService.SetValue(GlobalConstants.REGISTRY_LAST_EXCEL_KEY, excelFileName); } /// <summary> /// recover an autosaved file to a user's defined destionation file /// by copy autosaved file to destionation file /// </summary> public void Recover() { SaveFileDialog saveFileDialogRecover = new SaveFileDialog(); saveFileDialogRecover.Filter = "Excel|*.xls"; saveFileDialogRecover.Title = "Recover File"; DialogResult result = saveFileDialogRecover.ShowDialog(); if (result == DialogResult.OK && !String.IsNullOrEmpty(saveFileDialogRecover.FileName)) { try { // try to copy autosaved file to new destination File.Copy(excelFileName, saveFileDialogRecover.FileName, true); // inform user if succeeds MessageBox.Show( "Recovered file saved at \"" + saveFileDialogRecover.FileName + "\" successfully!", "Recovery succeeds", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { // in case of recovery failure, inform user and ask for retrying DialogResult dialogResult = MessageBox.Show( "Cannot save file to your choosen path, please check file permissions." + "\nAutosaved file: " + excelFileName + "\nDestination file: " + saveFileDialogRecover.FileName + "\n\nDo you want to try again?", "Recovery fails", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); // retry if user chooses so if (dialogResult == DialogResult.Retry) Recover(); } } // delete autosaved file File.Delete(excelFileName); } /// <summary> /// save a copy of current excel file to a user's defined destionation file /// </summary> public void SaveACopy() { SaveFileDialog saveFileDialogRecover = new SaveFileDialog(); saveFileDialogRecover.Filter = "Excel|*.xls"; saveFileDialogRecover.Title = "Save a Copy"; DialogResult result = saveFileDialogRecover.ShowDialog(); if (result == DialogResult.OK && !String.IsNullOrEmpty(saveFileDialogRecover.FileName)) { try { System.IO.File.Copy(excelFileName, saveFileDialogRecover.FileName, true); } catch (Exception e) { MessageBox.Show( "Cannot save file to your choosen path, please check destination file permission.", "Error while saving.\n" + e.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } public void QuitExcelApp() { excelApp.Quit(); /* Hoang_nguyenHuu Added */ GC.Collect(); } public bool ImportDataFromExcelFileToCompare(out List<ExcelSheet> listExcelSheets) { Workbook workBook; Worksheet workSheet; List<ExcelSheet> listSheets = new List<ExcelSheet>(); // eliminate Zero base array, change to 1 base array listExcelSheets = null; try { workBook = excelApp.Workbooks.Open(this.FileName, 0, true, 5, "", "", true, XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); int numSheets = workBook.Sheets.Count; this.sheetsCount = numSheets; if (GlobalVariables.startSheet > numSheets) { GlobalVariables.startSheet = numSheets; } // init Data for listSheets for (int i = 0; i <= numSheets; i++) listSheets.Add(new ExcelSheet()); for (int i = GlobalVariables.startSheet; i < numSheets + 1; i++) { workSheet = (Worksheet)workBook.Sheets[i]; // // Take the used range of the sheet. Finally, get an object array of all // of the cells in the sheet (their values). You can do things with those // values. // Copy data from Excel to Array string lastCell = GetLastCellName(GlobalVariables.lastColumn, GlobalConstants.maxRows); // Range excelRange = workSheet.get_Range("A1",last); Range excelRange = workSheet.get_Range("A1", lastCell); ExcelSheet Sheet = new ExcelSheet((object[,])excelRange.get_Value( XlRangeValueDataType.xlRangeValueDefault)); // Identify the last row of Excel sheet for compare if (FormMergeTool.listAllPagesCompare[i].endRow == 0) // XML has no defination about endRow { Range last = workSheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell, Type.Missing); // check last row again int r = last.Row; /*bool blastRow = false; // Remove all blank row for (r = last.Row; r >= 1; r--) { for (int c = 0; c < FormCompareTool.listAllPagesCompare[1].listColumnCompare.Count; c++) { int col = FormCompareTool.listAllPagesCompare[1].listColumnCompare[c].column; if ((Sheet.value[r, col] != null) && ((string)Sheet.value[r, col] != string.Empty)) { blastRow = true; break; } } if (blastRow) break; }*/ FormMergeTool.listAllPagesCompare[i].endRow = r; } listSheets[i] = Sheet; } // Dispose Excel workBook.Close(); workSheet = null; workBook = null; GC.Collect(); // listExcelSheets = listSheets; if (listExcelSheets != null) return true; else return false; } catch (Exception e) { MessageBox.Show( "Cannot open excel file, please ensure the file is not used by other applications.\n"+ e.Message, "Error while opening file.\n" + e.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } } public void ImportDataFromExcelFile(String fileName, ref DataGridView dataGridView) { Workbook workBook; Worksheet workSheet; // open destination workbook file try { workBook = excelApp.Workbooks.Open(fileName, 0, true, 5, "", "", true, XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); workSheet = (Worksheet)workBook.ActiveSheet; } catch ( Exception e) { MessageBox.Show( "Cannot open excel file, please ensure the file is not used by other applications.\n"+ e.Message, "Error while opening file.\n" + e.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // get data from excel to temp array // single line mode string lastCellName; if (GlobalConstants.TemplatePageCol == 0) lastCellName = GetLastCellName(dataGridView.Columns.Count, dataGridView.Rows.Count); //multiline mode else { Range lastCell = workSheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell, Type.Missing); int rowIndex = lastCell.Row - 1; lastCellName = GetLastCellName(dataGridView.Columns.Count, rowIndex); // add more rows to datagridview to meet excel's rows count if (rowIndex >= dataGridView.Rows.Count) dataGridView.Rows.Add(rowIndex - dataGridView.Rows.Count); } object[,] values = workSheet.get_Range("A2", lastCellName).Value2 as object[,]; // copy array to data grid view for (int i = 0; i < dataGridView.Rows.Count; i++) for (int j = 0; j < dataGridView.Columns.Count; j++) { if (GlobalConstants.IsDateColumn(j)) { double d; if (values[i + 1, j + 1] != null && Double.TryParse(values[i + 1, j + 1].ToString(), out d)) dataGridView.Rows[i].Cells[j].Value = DateTime.FromOADate(d); else dataGridView.Rows[i].Cells[j].Value = values[i + 1, j + 1]; } else { dataGridView.Rows[i].Cells[j].Value = values[i + 1, j + 1]; } } // close workbook and worksheet workBook.Close(); workSheet = null; workBook = null; GC.Collect(); } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/ExcelService.cs
C#
Microsoft Reciprocal License (Ms-RL)
26,643
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Diagnostics; namespace FIS.iDET { public partial class FormAbout : Form { public FormAbout() { InitializeComponent(); } private void FormAbout_Load(object sender, EventArgs e) { LabelUserName.Text = GlobalConstants.Username; LabelProductID.Text = RegistryService.GetValue(GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY); label1.Text = GlobalConstants.stringVersion; } private void buttonOK_Click(object sender, EventArgs e) { this.Close(); } private void FormAbout_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.R) { MessageBox.Show("Welcome to the developer world !"); Process.Start("http://revo21studio.com/"); } else if (e.KeyCode == Keys.I) { MessageBox.Show("There are still good men in this world!"); Process.Start("http://p.yusukekamiyamane.com/"); } } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/FormAbout.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,312
namespace FIS.iDET { partial class FormAbout { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormAbout)); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.LabelUserName = new System.Windows.Forms.Label(); this.LabelProductID = new System.Windows.Forms.Label(); this.buttonOK = new System.Windows.Forms.Button(); this.label7 = new System.Windows.Forms.Label(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.SteelBlue; this.label1.Location = new System.Drawing.Point(168, 15); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(273, 44); this.label1.TabIndex = 2; this.label1.Text = "FIS Data Entry Support Tool \r\nVersion 2.0.1 Alpha"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(169, 140); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(263, 45); this.label2.TabIndex = 2; this.label2.Text = "Copyright © 2012 by FPT Information System,\r\n " + " FPT BPO Services Center.\r\nAll rights reserved."; // // label6 // this.label6.AutoEllipsis = true; this.label6.ForeColor = System.Drawing.Color.Gray; this.label6.Location = new System.Drawing.Point(12, 217); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(377, 85); this.label6.TabIndex = 2; this.label6.Text = resources.GetString("label6.Text"); // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(169, 67); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(154, 15); this.label8.TabIndex = 2; this.label8.Text = "This product is licensed to:"; // // LabelUserName // this.LabelUserName.AutoSize = true; this.LabelUserName.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.LabelUserName.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; this.LabelUserName.Location = new System.Drawing.Point(329, 67); this.LabelUserName.Name = "LabelUserName"; this.LabelUserName.Size = new System.Drawing.Size(78, 16); this.LabelUserName.TabIndex = 2; this.LabelUserName.Text = "John Smith"; // // LabelProductID // this.LabelProductID.AutoSize = true; this.LabelProductID.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Bold); this.LabelProductID.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; this.LabelProductID.Location = new System.Drawing.Point(169, 102); this.LabelProductID.Name = "LabelProductID"; this.LabelProductID.Size = new System.Drawing.Size(281, 16); this.LabelProductID.TabIndex = 2; this.LabelProductID.Text = "AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA"; // // buttonOK // this.buttonOK.BackColor = System.Drawing.SystemColors.GradientActiveCaption; this.buttonOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonOK.Location = new System.Drawing.Point(392, 235); this.buttonOK.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(82, 31); this.buttonOK.TabIndex = 3; this.buttonOK.Text = "OK"; this.buttonOK.UseVisualStyleBackColor = false; this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(169, 86); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(90, 15); this.label7.TabIndex = 2; this.label7.Text = "Serial Number:"; // // pictureBox2 // this.pictureBox2.Image = global::FIS.iDET.Properties.Resources.fisHelp; this.pictureBox2.Location = new System.Drawing.Point(16, 6); this.pictureBox2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(120, 112); this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox2.TabIndex = 0; this.pictureBox2.TabStop = false; // // pictureBox1 // this.pictureBox1.Image = global::FIS.iDET.Properties.Resources.fisLogo; this.pictureBox1.Location = new System.Drawing.Point(15, 126); this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(120, 87); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // // FormAbout // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; this.ClientSize = new System.Drawing.Size(491, 302); this.Controls.Add(this.buttonOK); this.Controls.Add(this.label7); this.Controls.Add(this.LabelProductID); this.Controls.Add(this.LabelUserName); this.Controls.Add(this.label8); this.Controls.Add(this.label6); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.pictureBox1); this.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormAbout"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "About"; this.Load += new System.EventHandler(this.FormAbout_Load); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormAbout_KeyDown); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label LabelUserName; private System.Windows.Forms.Label LabelProductID; private System.Windows.Forms.Button buttonOK; private System.Windows.Forms.Label label7; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox2; } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/FormAbout.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
10,082
using System; using System.Collections; using System.Collections.Generic; using System.Windows.Forms; namespace FIS.iDET { public partial class FormMergeTool : Form { List<ExcelSheet> listExcelSheets1 = null; List<ExcelSheet> listExcelSheets2 = null; public static List<ExcelSheet> listExcelSheetsResult = null; ExcelService excelFile1 = null; ExcelService excelFile2 = null; ExcelService excelFileSave = null; public static PageCompareInfo pageAll = new PageCompareInfo(); public static List<PageCompareInfo> listPagesCompare = new List<PageCompareInfo>(); public static List<PageCompareInfo> listAllPagesCompare = new List<PageCompareInfo>(); List<DataColumn> columns = new List<DataColumn>(); // string charsRemove = "/ ,.'`"; int numSheets = 0; public FormMergeTool() { InitializeComponent(); } private void buttonExcel1_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Excel files|*.xls|All files|*.*"; openFileDialog.Title = "Open Excel File 1"; DialogResult result = openFileDialog.ShowDialog(); if (result == DialogResult.OK && !String.IsNullOrEmpty(openFileDialog.FileName)) { textBoxExcel1.Text = openFileDialog.FileName; } } private void buttonExcel2_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Excel files|*.xls|All files|*.*"; openFileDialog.Title = "Open Excel File 1"; DialogResult result = openFileDialog.ShowDialog(); if (result == DialogResult.OK && !String.IsNullOrEmpty(openFileDialog.FileName)) { textBoxExcel2.Text = openFileDialog.FileName; } } private void buttonCompare_Click(object sender, EventArgs e) { // check condition of all text box to make sure we can run compare if (textBoxExcel1.Text != "" && textBoxExcel2.Text != "" && textBoxLayoutFile.Text != "" && textBoxSaveToExcel.Text != "" && Int32.TryParse(textBoxFromSheet.Text, out GlobalVariables.startSheet) && Int32.TryParse(textBoxStartPage.Text, out GlobalVariables.startPage)) { // Init ALL if (GlobalVariables.startSheet == 0) { GlobalVariables.startSheet = 1; textBoxFromSheet.Text = "1"; } columns = XmlService.ReadPageCompareXML(textBoxLayoutFile.Text, out pageAll, out listPagesCompare); if (columns != null) { InitListAllPagesCompare(); } else { MessageBox.Show("Wrong FISMAPPING file structure ! Please check and try again"); return; } FormPleaseWait formWait = new FormPleaseWait(); formWait.Show(); excelFile1 = new ExcelService(textBoxExcel1.Text); excelFile2 = new ExcelService(textBoxExcel2.Text); excelFileSave = new ExcelService(textBoxSaveToExcel.Text); listExcelSheets1 = new List<ExcelSheet>(); listExcelSheets2 = new List<ExcelSheet>(); listExcelSheetsResult = new List<ExcelSheet>(); if (excelFile1.ImportDataFromExcelFileToCompare(out listExcelSheets1)) { numSheets = excelFile1.sheetsCount; excelFile1.QuitExcelApp(); if (GlobalVariables.startSheet.ToString() != textBoxFromSheet.Text.Trim()) { textBoxFromSheet.Text = GlobalVariables.startSheet.ToString(); } } else { formWait.Close(); return; } if (excelFile2.ImportDataFromExcelFileToCompare(out listExcelSheets2)) { excelFile2.QuitExcelApp(); } else { formWait.Close(); return; } // Process CompareTwoExcelSheetsArray(); excelFileSave.SaveComapreResultAsOneSheet(listAllPagesCompare, numSheets, ref listExcelSheetsResult); excelFileSave.QuitExcelApp(); formWait.Close(); // Reduce memory excelFile1 = null; excelFile2 = null; excelFileSave = null; listExcelSheets1 = null; listExcelSheets2 = null; listExcelSheetsResult = null; GC.Collect(); columns = new List<DataColumn>(); MessageBox.Show("Compare finised !!!"); } else MessageBox.Show(" You haven't filled all Required fields. Please check and try again."); } private void buttonLayoutFile_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "FISMAPPING files|*.fismapping|All files|*.*"; openFileDialog.Title = "Choose FIS template file"; DialogResult result = openFileDialog.ShowDialog(); if (result == DialogResult.OK && !String.IsNullOrEmpty(openFileDialog.FileName)) { textBoxLayoutFile.Text = openFileDialog.FileName; } } string Standardlize(string s) { for (int i = 0; i < GlobalVariables.charsRemove.Length; i++) { char[] c = { GlobalVariables.charsRemove[i] }; string schar = new string(c); s = s.Replace(schar, string.Empty); } for (int i = 0; i < s.Length; i++) { int charcode = (int)s[i]; char[] c = { s[i] }; string sC = new string(c); if ((charcode >= 65296) && (charcode <= 65305)) { int charCodeRep = charcode - 65248; char cR = (char)charCodeRep; char[] cRA = { cR }; string sR = new string(cRA); s = s.Replace(sC, sR); } } return s; } string CompareTwoCellsValue(string s1, string s2) { s1 = s1.Trim(); s2 = s2.Trim(); if ((s1 == "") && (s2 == "")) return string.Empty; int num1 = 0, num2 = 0; switch (comboBoxOption.SelectedIndex) // Option 1 { case 0: if (Int32.TryParse(s1, out num1) && Int32.TryParse(s2, out num2)) if (num1 == num2) return s1; // 2 number same value break; case 1: if (Int32.TryParse(s1, out num1) && Int32.TryParse(s2, out num2)) if (num1 == num2) return s1; // 2 number same value else return s1 + "<>" + s2; // != value if ((s1.IndexOf('S') < 0) && (s2.IndexOf('S') < 0)) // No 'S' character { if (Int32.TryParse(s1, out num1)) return s1; if (Int32.TryParse(s2, out num1)) return s2; // ouput number value } break; } return s1 + "<>" + s2; /* if (s1 == s2) return s1; int num; if (Int32.TryParse(s1, out num) && !Int32.TryParse(s2, out num)) return s1; if (Int32.TryParse(s2, out num) && !Int32.TryParse(s1, out num)) return s2; return s1 + "<>" + s2; */ } void CompareTwoExcelSheetsArray() { // reset data listExcelSheetsResult.Clear(); // init 1 based, not zero base // init listExcelSheetResult Array for (int i = 0; i <= numSheets; i++) listExcelSheetsResult.Add(new ExcelSheet()); // for (int i = GlobalVariables.startSheet; i <= numSheets; i++) { try // handle data compare range in excel file out of Fismapping stipulate ! { int startRow = listAllPagesCompare[i].startRow; int endRow = listAllPagesCompare[i].endRow; for (int j = 0; j < listAllPagesCompare[i].listColumnCompare.Count; j++) { // Identify compare range int col = listAllPagesCompare[i].listColumnCompare[j].column; switch (listAllPagesCompare[i].listColumnCompare[j].mode) { case CompareMode.COMPARE: for (int row = startRow; row <= endRow; row++) { string s1 = string.Empty; string s2 = string.Empty; if (listExcelSheets1[i].value[row, col] != null) s1 = listExcelSheets1[i].value[row, col].ToString(); if (listExcelSheets2[i].value[row, col] != null) s2 = listExcelSheets2[i].value[row, col].ToString(); s1 = Standardlize(s1); s2 = Standardlize(s2); listExcelSheetsResult[i].value[row - startRow, j] = CompareTwoCellsValue(s1, s2); //listExcelSheetsResult[i].value[row-startRow, j] = "'"+ listExcelSheetsResult[i].value[row-startRow, j]; } break; case CompareMode.DISPLAY: for (int row = startRow; row <= endRow; row++) { string s = string.Empty; if (listAllPagesCompare[i].listColumnCompare[j].source == FileSource.FILE1) { if (listExcelSheets1[i].value[row, col] != null) s = listExcelSheets1[i].value[row, col].ToString(); } else { if (listExcelSheets2[i].value[row, col] != null) s = listExcelSheets2[i].value[row, col].ToString(); } listExcelSheetsResult[i].value[row - startRow, j] = s; //listExcelSheetsResult[i].value[row - startRow, j] = "'" + listExcelSheetsResult[i].value[row - startRow, j]; } break; // Create an empty column into excel result case CompareMode.NONE: break; } } } catch (Exception e) { MessageBox.Show("Data in Excel file is out of range determited by FISMAPPING file.\nPlease check page number: " + i.ToString() +"\nThe compare process will still continue.\n"+ e.Message , "Compare out of range",MessageBoxButtons.OK,MessageBoxIcon.Warning); } // add page number // DANGEROUS CODE HERE !!! int colPageNumber = listAllPagesCompare[i].listColumnCompare.Count; int rowPageNumberStart = listAllPagesCompare[i].startRow; int rowPageNumberEnd = listAllPagesCompare[i].endRow; for (int k = rowPageNumberStart; k <= rowPageNumberEnd; k++) { listExcelSheetsResult[i].value[k - rowPageNumberStart, colPageNumber] = GlobalVariables.startPage.ToString(); } GlobalVariables.startPage++; } } void InitListAllPagesCompare() { // clear list listAllPagesCompare.Clear(); // Init for (int i = 0; i < GlobalConstants.maxPagesCompare; i++) { PageCompareInfo page = new PageCompareInfo(); page.endRow = pageAll.endRow; page.startRow = pageAll.startRow; page.listColumnCompare = pageAll.listColumnCompare ; listAllPagesCompare.Add(page); } // Compare information for special pages ! for (int i = 0; i < listPagesCompare.Count; i++) { int k = listPagesCompare[i].pageID; listAllPagesCompare[k] = listPagesCompare[i]; } } private void buttonSaveToExcel_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Excel|*.xls"; saveFileDialog.Title = "Save as Excel File"; DialogResult result = saveFileDialog.ShowDialog(); if (result == DialogResult.OK && !String.IsNullOrEmpty(saveFileDialog.FileName)) { textBoxSaveToExcel.Text = saveFileDialog.FileName; } } private void FormCompareTool_Load(object sender, EventArgs e) { textBoxFromSheet.Text = GlobalVariables.startSheet.ToString(); comboBoxOption.SelectedIndex = 0; textBoxStartPage.Text = GlobalVariables.startPage.ToString(); } private void buttonCancel_Click(object sender, EventArgs e) { this.Close(); } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/FormMergeTool.cs
C#
Microsoft Reciprocal License (Ms-RL)
15,088
namespace FIS.iDET { partial class FormMergeTool { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMergeTool)); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.textBoxExcel1 = new System.Windows.Forms.TextBox(); this.textBoxExcel2 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.textBoxSaveToExcel = new System.Windows.Forms.TextBox(); this.buttonExcel1 = new System.Windows.Forms.Button(); this.buttonExcel2 = new System.Windows.Forms.Button(); this.buttonSaveToExcel = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); this.buttonCompare = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); this.textBoxStartPage = new System.Windows.Forms.TextBox(); this.button3 = new System.Windows.Forms.Button(); this.label5 = new System.Windows.Forms.Label(); this.textBoxLayoutFile = new System.Windows.Forms.TextBox(); this.buttonLayoutFile = new System.Windows.Forms.Button(); this.label6 = new System.Windows.Forms.Label(); this.comboBoxOption = new System.Windows.Forms.ComboBox(); this.label7 = new System.Windows.Forms.Label(); this.textBoxFromSheet = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(15, 24); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(61, 13); this.label1.TabIndex = 0; this.label1.Text = "File Excel 1"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(15, 96); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(96, 13); this.label2.TabIndex = 0; this.label2.Text = "Save To Excel File"; // // textBoxExcel1 // this.textBoxExcel1.Location = new System.Drawing.Point(119, 21); this.textBoxExcel1.Name = "textBoxExcel1"; this.textBoxExcel1.ReadOnly = true; this.textBoxExcel1.Size = new System.Drawing.Size(382, 20); this.textBoxExcel1.TabIndex = 1; // // textBoxExcel2 // this.textBoxExcel2.Location = new System.Drawing.Point(119, 56); this.textBoxExcel2.Name = "textBoxExcel2"; this.textBoxExcel2.ReadOnly = true; this.textBoxExcel2.Size = new System.Drawing.Size(382, 20); this.textBoxExcel2.TabIndex = 1; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(15, 59); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(61, 13); this.label3.TabIndex = 0; this.label3.Text = "File Excel 2"; // // textBoxSaveToExcel // this.textBoxSaveToExcel.Location = new System.Drawing.Point(119, 93); this.textBoxSaveToExcel.Name = "textBoxSaveToExcel"; this.textBoxSaveToExcel.ReadOnly = true; this.textBoxSaveToExcel.Size = new System.Drawing.Size(382, 20); this.textBoxSaveToExcel.TabIndex = 1; // // buttonExcel1 // this.buttonExcel1.Location = new System.Drawing.Point(516, 18); this.buttonExcel1.Name = "buttonExcel1"; this.buttonExcel1.Size = new System.Drawing.Size(77, 25); this.buttonExcel1.TabIndex = 2; this.buttonExcel1.Text = "Browse..."; this.buttonExcel1.UseVisualStyleBackColor = true; this.buttonExcel1.Click += new System.EventHandler(this.buttonExcel1_Click); // // buttonExcel2 // this.buttonExcel2.Location = new System.Drawing.Point(516, 53); this.buttonExcel2.Name = "buttonExcel2"; this.buttonExcel2.Size = new System.Drawing.Size(77, 25); this.buttonExcel2.TabIndex = 2; this.buttonExcel2.Text = "Browse..."; this.buttonExcel2.UseVisualStyleBackColor = true; this.buttonExcel2.Click += new System.EventHandler(this.buttonExcel2_Click); // // buttonSaveToExcel // this.buttonSaveToExcel.Location = new System.Drawing.Point(516, 90); this.buttonSaveToExcel.Name = "buttonSaveToExcel"; this.buttonSaveToExcel.Size = new System.Drawing.Size(77, 25); this.buttonSaveToExcel.TabIndex = 2; this.buttonSaveToExcel.Text = "Browse..."; this.buttonSaveToExcel.UseVisualStyleBackColor = true; this.buttonSaveToExcel.Click += new System.EventHandler(this.buttonSaveToExcel_Click); // // buttonCancel // this.buttonCancel.Location = new System.Drawing.Point(352, 207); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(149, 24); this.buttonCancel.TabIndex = 2; this.buttonCancel.Text = "Cancel"; this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); // // buttonCompare // this.buttonCompare.Location = new System.Drawing.Point(118, 207); this.buttonCompare.Name = "buttonCompare"; this.buttonCompare.Size = new System.Drawing.Size(149, 24); this.buttonCompare.TabIndex = 2; this.buttonCompare.Text = "Compare"; this.buttonCompare.UseVisualStyleBackColor = true; this.buttonCompare.Click += new System.EventHandler(this.buttonCompare_Click); // // label4 // this.label4.Location = new System.Drawing.Point(15, 132); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(122, 19); this.label4.TabIndex = 0; this.label4.Text = "Page Start Number "; // // textBoxStartPage // this.textBoxStartPage.Location = new System.Drawing.Point(119, 129); this.textBoxStartPage.Name = "textBoxStartPage"; this.textBoxStartPage.Size = new System.Drawing.Size(60, 20); this.textBoxStartPage.TabIndex = 1; // // button3 // this.button3.Location = new System.Drawing.Point(516, 126); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(77, 25); this.button3.TabIndex = 2; this.button3.Text = "Browse..."; this.button3.UseVisualStyleBackColor = true; this.button3.Visible = false; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(14, 170); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(55, 13); this.label5.TabIndex = 0; this.label5.Text = "Layout file"; // // textBoxLayoutFile // this.textBoxLayoutFile.Location = new System.Drawing.Point(118, 167); this.textBoxLayoutFile.Name = "textBoxLayoutFile"; this.textBoxLayoutFile.ReadOnly = true; this.textBoxLayoutFile.Size = new System.Drawing.Size(382, 20); this.textBoxLayoutFile.TabIndex = 1; // // buttonLayoutFile // this.buttonLayoutFile.Location = new System.Drawing.Point(515, 164); this.buttonLayoutFile.Name = "buttonLayoutFile"; this.buttonLayoutFile.Size = new System.Drawing.Size(77, 25); this.buttonLayoutFile.TabIndex = 2; this.buttonLayoutFile.Text = "Browse..."; this.buttonLayoutFile.UseVisualStyleBackColor = true; this.buttonLayoutFile.Click += new System.EventHandler(this.buttonLayoutFile_Click); // // label6 // this.label6.Location = new System.Drawing.Point(326, 132); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(94, 19); this.label6.TabIndex = 0; this.label6.Text = "Compare Option"; // // comboBoxOption // this.comboBoxOption.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxOption.FormattingEnabled = true; this.comboBoxOption.Items.AddRange(new object[] { "Option 1", "Option 2"}); this.comboBoxOption.Location = new System.Drawing.Point(413, 129); this.comboBoxOption.Name = "comboBoxOption"; this.comboBoxOption.Size = new System.Drawing.Size(87, 21); this.comboBoxOption.TabIndex = 3; // // label7 // this.label7.Location = new System.Drawing.Point(195, 131); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(122, 19); this.label7.TabIndex = 0; this.label7.Text = "From Sheet"; // // textBoxFromSheet // this.textBoxFromSheet.Location = new System.Drawing.Point(260, 129); this.textBoxFromSheet.Name = "textBoxFromSheet"; this.textBoxFromSheet.Size = new System.Drawing.Size(60, 20); this.textBoxFromSheet.TabIndex = 1; // // FormMergeTool // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(609, 246); this.Controls.Add(this.comboBoxOption); this.Controls.Add(this.buttonCompare); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonLayoutFile); this.Controls.Add(this.button3); this.Controls.Add(this.buttonSaveToExcel); this.Controls.Add(this.buttonExcel2); this.Controls.Add(this.buttonExcel1); this.Controls.Add(this.textBoxLayoutFile); this.Controls.Add(this.textBoxFromSheet); this.Controls.Add(this.textBoxStartPage); this.Controls.Add(this.textBoxSaveToExcel); this.Controls.Add(this.textBoxExcel2); this.Controls.Add(this.label5); this.Controls.Add(this.textBoxExcel1); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormMergeTool"; this.Text = "Data Merge Tool"; this.Load += new System.EventHandler(this.FormCompareTool_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox textBoxExcel1; private System.Windows.Forms.TextBox textBoxExcel2; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox textBoxSaveToExcel; private System.Windows.Forms.Button buttonExcel1; private System.Windows.Forms.Button buttonExcel2; private System.Windows.Forms.Button buttonSaveToExcel; private System.Windows.Forms.Button buttonCancel; private System.Windows.Forms.Button buttonCompare; private System.Windows.Forms.Label label4; private System.Windows.Forms.Button button3; private System.Windows.Forms.Label label5; private System.Windows.Forms.TextBox textBoxLayoutFile; private System.Windows.Forms.Button buttonLayoutFile; public System.Windows.Forms.TextBox textBoxStartPage; private System.Windows.Forms.Label label6; private System.Windows.Forms.ComboBox comboBoxOption; private System.Windows.Forms.Label label7; public System.Windows.Forms.TextBox textBoxFromSheet; } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/FormMergeTool.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
14,485
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace FIS.iDET { public partial class FormPleaseWait : Form { public FormPleaseWait() { InitializeComponent(); } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/FormPleaseWait.cs
C#
Microsoft Reciprocal License (Ms-RL)
356
namespace FIS.iDET { partial class FormPleaseWait { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // label1 // this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.Location = new System.Drawing.Point(96, 46); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(244, 21); this.label1.TabIndex = 0; this.label1.Text = "Tool Compare Is Processing..."; // // label2 // this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.Location = new System.Drawing.Point(96, 67); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(244, 21); this.label2.TabIndex = 0; this.label2.Text = "Please Wait..."; // // FormPleaseWait // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(376, 132); this.ControlBox = false; this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormPleaseWait"; this.Text = "Processing"; this.ResumeLayout(false); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/FormPleaseWait.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
2,871
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Windows.Forms; namespace FIS.iDET { public class GlobalConstants { // Version public const string stringVersion = "FIS Data Entry Support Tool\nVersion 2.0.0 Pre-Final"; public const bool IsTri = false; public static DateTime ExpDate = new DateTime(2013, 2, 28); /* VARIABLES */ // auto-jump tool-tip public const int offsetX = 40; public const int offsetY = 40; // data for Page Compare Tool public const int maxPagesCompare = 260; public const int ExtendColumn = 1; public const string ExtendColumnName = "Page"; // zoom public const int maxZoomFactor = 2; public const double minZoomFactor = 0.2; public const int maxZoomIndex = 10; // base 1 counter // data format style for data columns public static int ComboBoxDateFormatIndex; public static int ComboBoxZoomIndex=4; // username public static string Username = "No Name"; // data columns info public static List<DoubleRectangle> ColumnsOriginalRects; public static List<DataColumn> Columns; public static List<int> DateColumnIndices; // xml template public static string TemplateName = "Untitled template"; public static string TemplateVersion = "2.0.5"; public static double TemplateZoom = 1; public static int TemplatePageCol = 0; // max Excel Range public const int maxRows = 2000; // In real: 65536 public const int maxColumns = 100; // In real: 256 public static void OptionInit() { // get user name Username = RegistryService.GetValue(REGISTRY_USER_NAME) == null ? "No Name" : RegistryService.GetValue(REGISTRY_USER_NAME).Trim(); // date format index ComboBoxDateFormatIndex = Convert.ToInt32(RegistryService.GetValue(REGISTRY_DATE_FORMAT_INDEX)); // return 0 in case have no data. // exception handlde if (ComboBoxDateFormatIndex < 0) ComboBoxDateFormatIndex = 0; // zoom index ComboBoxZoomIndex = 4; // Pos Spin } public static bool IsDateColumn(int i) { return DateColumnIndices.IndexOf(i) > -1; } /*** CONSTANTS ***/ // secret key used to generate serial number from machine ID public const string SERIAL_SECRET_KEY = "aed45dba1f73080de226c193d3f9d605"; // Company name, mainly used for folder naming public const string COMPANY_NAME = "FPT BPO iDET"; /* excel app */ // excel auto save file name and location public const string AUTOSAVE_FILENAME = "autosave.xls"; /* registry */ // Default path of registry to store serial number public const string REGISTRY_PATH = "Software\\" + COMPANY_NAME; // serial number string name public const string REGISTRY_SERIAL_NUMBER_KEY = "Serial"; // last working image file string name public const string REGISTRY_LAST_IMAGE_KEY = "Image"; // last working image value for no file public const string REGISTRY_LAST_IMAGE_NULL_VALUE = "No image loaded"; // last working excel file string name public const string REGISTRY_LAST_EXCEL_KEY = "Excel"; // last working excel value for no file public const string REGISTRY_LAST_EXCEL_NULL_VALUE = "File has not been saved"; // comboBox Date Format Index public const string REGISTRY_DATE_FORMAT_INDEX = "DateFormat"; // user name public const string REGISTRY_USER_NAME = "UN"; // no user name public const string REGISTRY_USER_NAME_NO_NAME = "No name"; } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/GlobalConstants.cs
C#
Microsoft Reciprocal License (Ms-RL)
4,058
using System; using System.Collections.Generic; using System.Text; namespace FIS.iDET { /*public class ExcelSheetResult { public List<object[]> value= new List<object[]>(); public ExcelSheetResult() { } }*/ public class ExcelSheet { // public object[,] value = new object[GlobalConstants.maxRows, GlobalConstants.maxColumns]; public object[,] value = new object[GlobalConstants.maxRows,GlobalConstants.maxColumns]; public ExcelSheet(object[,] Value) { value = Value; } public ExcelSheet() { } } class GlobalVariables { /* PARAMETER */ // Compare Tool public static int startSheet = 1; public static int startPage = 1; public static string charsRemove = "/ ,.'`"; public static int lastColumn = 0; public static int lastRow = GlobalConstants.maxRows; // Zoom public static int zoomMode = 0; // 0: fit width, 1:fitheight } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/GlobalVariables.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,153
using System; using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms; namespace FIS.iDET { public class ImageService { string imageFileName; Bitmap tifImage; int totalFrames, currentFrame; Boolean fileLoadedOK = true; public ImageService() { fileLoadedOK = false; } public ImageService(string imageFileName) { this.imageFileName = imageFileName; LoadTifFile(); } public string FileName { get { return imageFileName; } set { imageFileName = value; LoadTifFile(); } } public int TotalFrames { get { return totalFrames; } set { totalFrames = value; } } public int Width { get { return tifImage.Width; } } public int Height { get { return tifImage.Height; } } public int CurrentFrame { get { return currentFrame; } set { currentFrame = value; } } public Boolean FileLoadedOK { get { return fileLoadedOK; } } private void LoadTifFile() { try { // decode tif image into bitmap tifImage = new Bitmap(imageFileName); // get total number of pages totalFrames = tifImage.GetFrameCount(FrameDimension.Page); } catch { fileLoadedOK = false; MessageBox.Show("Cannot load image file, please check if it is a valid TIFF image.", "Invalid image", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } private double zoomFactor = 1; public Bitmap GetImageZoom(double zoomFactor, DoubleRectangle rect) { // calculate Zoom size this.zoomFactor = zoomFactor; int zoomWidth = scaleUp(Width); int zoomHeight = scaleUp(Height); // create a new empty temporary bitmap Bitmap tmp = new Bitmap(zoomWidth, zoomHeight); // tmp.SetResolution(tifImage.HorizontalResolution, tifImage.VerticalResolution); //H.NH fix this // create new graphic object Graphics g = Graphics.FromImage(tmp); g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel; g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed; g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed; g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Low; g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None; // Zoom here Rectangle srcRect = new Rectangle(0, 0, Width, Height); Rectangle desRect = new Rectangle(0, 0, zoomWidth, zoomHeight); g.DrawImage(tifImage, desRect, srcRect, GraphicsUnit.Pixel); // draw navigation guide if (rect.Width != 0 && rect.Y != 0) { float penStrokeWidth = (float)zoomFactor * 4; Pen penRed = new Pen(Color.Red, penStrokeWidth); Pen penOrange = new Pen(Color.Blue, penStrokeWidth); penRed.Alignment = System.Drawing.Drawing2D.PenAlignment.Outset; penOrange.Alignment = System.Drawing.Drawing2D.PenAlignment.Outset; Rectangle intRect= new Rectangle(0,0,0,0); intRect.X = scaleUp(rect.X); intRect.Y = scaleUp(rect.Y); intRect.Width = scaleUp(rect.Width); intRect.Height = scaleUp(rect.Height); if (rect.Width != 0 && rect.Height != 0) { g.DrawLine(penOrange, 0, intRect.Y + intRect.Height, zoomWidth, intRect.Y + intRect.Height); g.DrawLine(penOrange, intRect.X, 0, intRect.X, zoomHeight); } g.DrawRectangle(penRed, intRect); } // release Resource g.Dispose(); // GC.Collect(); return tmp; } public Bitmap GetImageZoom(double zoomFactor) { // calculate Zoom size this.zoomFactor = zoomFactor; int zoomWidth = scaleUp(Width); int zoomHeight = scaleUp(Height); // create a new empty temporary bitmap Bitmap tmp = new Bitmap(zoomWidth, zoomHeight); //tmp.SetResolution(tifImage.HorizontalResolution, tifImage.VerticalResolution); // create new graphic object Graphics g = Graphics.FromImage(tmp); g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel; g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed; g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed; g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Low; g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.None; // Zoom here Rectangle srcRect = new Rectangle(0, 0, Width, Height); Rectangle desRect = new Rectangle(0, 0, zoomWidth, zoomHeight); g.DrawImage(tifImage, desRect, srcRect, GraphicsUnit.Pixel); // release Resource g.Dispose(); // GC.Collect(); return tmp; } private int scaleUp(double original) { return (int) Math.Round(original * zoomFactor); } public void SetImageFrame(int frameToDisplay) { // var t1 = DateTime.Now; if (frameToDisplay >= 0 && frameToDisplay < totalFrames) currentFrame = frameToDisplay; // var t2 = DateTime.Now; // set active frame tifImage.SelectActiveFrame(FrameDimension.Page, currentFrame); // var t3 = DateTime.Now; //var t4 = DateTime.Now; //System.Diagnostics.Debug.WriteLine("time1: " + (t2.Subtract(t1).TotalMilliseconds.ToString()) + // " time 2: " + (t3.Subtract(t2).TotalMilliseconds.ToString()) + // " time 3: " + (t4.Subtract(t3).TotalMilliseconds.ToString())) // ; //System.Diagnostics.Debug.WriteLine("finish"); } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/ImageService.cs
C#
Microsoft Reciprocal License (Ms-RL)
7,214
using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; using System.Windows.Forms; using Microsoft.VisualBasic; namespace FIS.iDET { public partial class InputToolForm : Form { // the autosaved excel file private ExcelService autosaveExcelFile = null; // search direction private bool findDown = true; // current image private ImageService tifImage; // the user's working excel file private ExcelService userExcelFile = null; public InputToolForm() { InitializeComponent(); gTooltip = Graphics.FromHwnd(label1.Handle); } private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { FormAbout aboutForm = new FormAbout(); aboutForm.ShowDialog(); } private void comboBoxDateFormat_SelectedIndexChanged(object sender, EventArgs e) { if (tifImage != null) { /* for (int i = 0; i < tifImage.TotalFrames; i++) if (dataGridViewInput[0, i].Value != null) ConvertCellValueToDateTime(dataGridViewInput[0, i]); */ // TOCHECK programatically apply to all columns having type date for (int i = 0; i < GlobalConstants.Columns.Count; i++) { if (GlobalConstants.Columns[i].Type == DataTypeEnum.COLUMN_TYPE_DATE) dataGridViewInput.Columns[i].DefaultCellStyle.Format = comboBoxDateFormat.Text; } } } private void ConvertCellValueToDateTime(DataGridViewCell cell) { DateTime dateTime; if (DateTime.TryParse(cell.Value.ToString(), out dateTime)) //cell.Value = dateTime.ToString(comboBoxDateFormat.Text); cell.Value = dateTime; } private void CreateNewExcelFile() { // reset data grid view ResetDataGridView(); // define new empty excel file userExcelFile.FileName = null; userExcelFile.Saved = true; // save to registry RegistryService.SetValue(GlobalConstants.REGISTRY_LAST_EXCEL_KEY, GlobalConstants.REGISTRY_LAST_EXCEL_NULL_VALUE); this.Text = "FIS.iDET: Unsaved"; } private void dataGridViewInput_CellEndEdit(object sender, DataGridViewCellEventArgs e) { // hide tooltip if (navigationToolStripMenuItem.Checked) toolTipPictBox.Hide(PictBox); // when user makes change to data if (userExcelFile.Saved) { // set excel file status to unsaved userExcelFile.Saved = false; // add * in app caption if (Text.IndexOf('*') == -1) { Text = Text.Trim() + '*'; } // enable save buttons EnableSaveButton(true); // start autosave timerAutosave.Start(); } // format date // TODO get column index to parse as datetime from GlobalConstants.ColumnTypes[] if (GlobalConstants.IsDateColumn(e.ColumnIndex) && e.RowIndex > -1 && dataGridViewInput.CurrentCell != null && dataGridViewInput.CurrentCell.Value != null) { // try to parse cell value to date ConvertCellValueToDateTime(dataGridViewInput.CurrentCell); } } private void dataGridViewInput_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { if (e.ColumnIndex == -1 && e.RowIndex > -1) { e.PaintBackground(e.CellBounds, true); using (SolidBrush br = new SolidBrush(Color.Black)) { StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; e.Graphics.DrawString((e.RowIndex + 1).ToString(), e.CellStyle.Font, br, e.CellBounds, sf); } e.Handled = true; } } private void dataGridViewInput_ColumnAdded(object sender, DataGridViewColumnEventArgs e) { // make all columns unsortable e.Column.SortMode = DataGridViewColumnSortMode.NotSortable; } private void dataGridViewInput_KeyUp(object sender, KeyEventArgs e) { ClipboardUtils.OnDataGridPaste(sender, e); } private void DeleteDataGridView() { // clear data grid if (dataGridViewInput.DataSource == null) dataGridViewInput.Columns.Clear(); else dataGridViewInput.DataSource = null; } private void EnableMenuIcons(Boolean enabled) { saveDataAsToolStripMenuItem.Enabled = enabled; if (GlobalConstants.TemplatePageCol == 0) // H.NH added newExcelFileToolStripMenuItem.Enabled = enabled; loadExcelFileToolStripMenuItem.Enabled = enabled; if (GlobalConstants.TemplatePageCol == 0) toolStripButtonNewData.Enabled = enabled; // H.NH added toolStripButtonNextPage.Enabled = enabled; toolStripButtonPreviousPage.Enabled = enabled; toolStripButtonFind.Enabled = enabled; toolStripTextBoxFind.Enabled = enabled; toolStripButtonFindDirection.Enabled = enabled; comboBoxDateFormat.Enabled = enabled; toolStripTextBoxPageNumber.Enabled = enabled; goToPageToolStripMenuItem.Enabled = enabled; findToolStripMenuItem.Enabled = enabled; toolStripComboBoxZoomRatio.Enabled = enabled; toolStripButtonZoomOut.Enabled = enabled; toolStripButtonZoomIn.Enabled = enabled; navigationToolStripMenuItem.Enabled = enabled; toolStripButtonNavigationGuide.Enabled = enabled; toolStripButtonZoomFit.Enabled = enabled; PictBox.Enabled = enabled; toolStripOpenExcelFileButton.Enabled = enabled; /* moveTooltipDownToolStripMenuItem.Enabled = moveTooltipLeftToolStripMenuItem.Enabled = moveTooltipUpToolStripMenuItem.Enabled = moveTooltipRightToolStripMenuItem.Enabled = increaseTooltipHeightToolStripMenuItem.Enabled = increaseTooltipWidthToolStripMenuItem.Enabled = decreaseTooltipHeightToolStripMenuItem.Enabled = decreaseTooltipWidthToolStripMenuItem.Enabled = enabled; */ navigationToolStripMenuItem.Enabled = toolStripButtonNavigationGuide.Enabled = enabled; //H.NH add toolStripComboBoxPosSpin.SelectedIndex = 0; toolStripComboBoxPosSpin.Enabled = enabled; } private void EnableSaveButton(Boolean enable) { saveDataToolStripMenuItem.Enabled = enable; toolStripButtonSaveData.Enabled = enable; } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { // this makes sure form closing event is called // so that user is asked to save data before closing app this.Close(); } private void findToolStripMenuItem_Click(object sender, EventArgs e) { toolStripTextBoxFind.Focus(); toolStripTextBoxFind.SelectAll(); } private void goToPageToolStripMenuItem_Click(object sender, EventArgs e) { toolStripTextBoxPageNumber.Focus(); toolStripTextBoxPageNumber.SelectAll(); } private void helpsubToolStripMenuItem_Click(object sender, EventArgs e) { string appPath = Application.ExecutablePath; try { appPath = appPath.Remove(appPath.LastIndexOf('\\')); Process.Start(appPath + "\\Help.htm"); } catch { MessageBox.Show("Sorry, can not find Help files.Please try again!", "No help files", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } private void InputToolForm_FormClosed(object sender, FormClosedEventArgs e) { SaveApplicationOption(); } private void InputToolForm_FormClosing(object sender, FormClosingEventArgs e) { // asks user to save data file, if it is not saved // if user clicks cancel, stop if (!PromptIfDataNotSaved()) { e.Cancel = true; return; } // exit excel app if (autosaveExcelFile != null) autosaveExcelFile.QuitExcelApp(); if (userExcelFile != null) userExcelFile.QuitExcelApp(); // delete autosave file if (autosaveExcelFile != null && autosaveExcelFile.FileExists) File.Delete(autosaveExcelFile.FileName); } private void InputToolForm_Load(object sender, EventArgs e) { // init registry service RegistryService.Init(); // if app is not activated if (!LicenseService.AppIsActivated()) { // show license windows LicenseKeyForm licenseKeyForm = new LicenseKeyForm(); licenseKeyForm.ShowDialog(); } // otherwise // run the app else { // init app options GlobalConstants.OptionInit(); // init user excel file userExcelFile = new ExcelService(); // init autosave excel file // the temporary directory to store autosave file string autosaveDirectory = Path.GetTempPath() + GlobalConstants.COMPANY_NAME; // create temp folder, if needed if (!Directory.Exists(autosaveDirectory)) Directory.CreateDirectory(autosaveDirectory); // assign full filename to autosave excel file autosaveExcelFile = new ExcelService(autosaveDirectory + "\\" + GlobalConstants.AUTOSAVE_FILENAME); // if recovery file exists // show recovery dialog box if (autosaveExcelFile.FileExists) ShowRecoveryDialog(); // set last working files to nothing RegistryService.SetValue(GlobalConstants.REGISTRY_LAST_IMAGE_KEY, GlobalConstants.REGISTRY_LAST_IMAGE_NULL_VALUE); RegistryService.SetValue(GlobalConstants.REGISTRY_LAST_EXCEL_KEY, GlobalConstants.REGISTRY_LAST_EXCEL_NULL_VALUE); this.Text = "FIS.iDET: Unsaved"; // load application last options LoadApplicationOption(); } } /// <summary> /// check if a string is found in data grid view's cell [i, j] /// </summary> /// <param name="whatToFind">string to find</param> /// <param name="i">row index of data grid view cell to check</param> /// <param name="j">comun index of data grid view cell to check</param> /// <returns></returns> private bool IsFound(string whatToFind, int i, int j) { if (dataGridViewInput.Rows[i].Cells[j].Value == null) return false; string parentString = dataGridViewInput.Rows[i].Cells[j].Value.ToString(); // TODO programmatically loop thru every column with type date // to convert that date to string with user's date format setting before checking if (GlobalConstants.IsDateColumn(j)) // date column { DateTime validDate; if (DateTime.TryParse(parentString, out validDate)) return validDate.ToString(comboBoxDateFormat.Text).ToLowerInvariant().Contains(whatToFind); else return parentString.ToLowerInvariant().Contains(whatToFind); } else return parentString.ToLowerInvariant().Contains(whatToFind); } private void LoadApplicationOption() { // comboBox Date Format index comboBoxDateFormat.SelectedIndex = GlobalConstants.ComboBoxDateFormatIndex; } private void loadExcelFileToolStripMenuItem_Click(object sender, EventArgs e) { OpenExcelFile(); } private void LoadImage() { // check if image template is loaded // if not, ask user to if (GlobalConstants.Columns == null) { MessageBox.Show("Please load an image template first! A windows will now appear for you to load such template."); if (!LoadTemplate()) return; } // ask if user wants to save data file // stop if user clicks cancel if (!PromptIfDataNotSaved()) return; // show open image file dialog OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Tif Images|*.tif|Tiff Images|*.tiff|All files|*.*"; openFileDialog.Title = "Open Tiff Image"; DialogResult result = openFileDialog.ShowDialog(); if (result == DialogResult.OK && !String.IsNullOrEmpty(openFileDialog.FileName)) { // load tif file tifImage = new ImageService(openFileDialog.FileName); if (tifImage.FileLoadedOK) { // if template is in multipage mode, asks user to load excel file for this mode to work if (GlobalConstants.TemplatePageCol != 0) { if (MessageBox.Show("You are working in multipage mode, do you want to load an Excel data file for this mode to work?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { if (!OpenExcelFile()) { ResetImageBox(); return; } else { // toolStripTextBoxPageNumber.ReadOnly = true; rem by H.NH } } else { string rowsPerPage = ""; rowsPerPage = Interaction.InputBox("Please input the number of rows per page:", "Create new Excel File", "10"); int rowspp = 10; int.TryParse(rowsPerPage, out rowspp); if (rowspp > 0) { ResetDataGridView(); dataGridViewInput.Rows.Add(rowspp * tifImage.TotalFrames); for (int page = 1; page <= tifImage.TotalFrames; page++) { for (int row = 1; row <= rowspp; row++) { dataGridViewInput.Rows[(page-1)*rowspp+row-1].Cells[GlobalConstants.TemplatePageCol - 1].Value = page.ToString(); } } } else { MessageBox.Show("Wrong number!"); ResetImageBox(); return; } } } else { // toolStripTextBoxPageNumber.ReadOnly = false; // create new excel file CreateNewExcelFile(); } // set max page to toolStripLabelPage toolStripLabelPage.Text = " / " + tifImage.TotalFrames.ToString(); // enable menu items EnableMenuIcons(true); // disable previous page button toolStripButtonPreviousPage.Enabled = false; // disable next page button if there is just one page if (tifImage.TotalFrames == 1) toolStripButtonNextPage.Enabled = false; // disable save buttons as there is no data to save yet EnableSaveButton(false); // set image file name to registry RegistryService.SetValue(GlobalConstants.REGISTRY_LAST_IMAGE_KEY, openFileDialog.FileName); // set combobox zoom index toolStripComboBoxZoomRatio.SelectedIndex = GlobalConstants.ComboBoxZoomIndex; // set default zoom factor zoomFactor = GlobalConstants.TemplateZoom; toolStripComboBoxZoomRatio.Text = ((int)(zoomFactor*100)).ToString() + "%"; KeyPressEventArgs key = new KeyPressEventArgs((char) Keys.Enter); toolStripComboBoxZoomRatio_KeyPress(null, key); } else { ResetImageBox(); } } } private void ResetImageBox() { // delete data grid view since no image is loaded DeleteDataGridView(); // delete image PictBox.Image = null; // disable menu items EnableMenuIcons(false); EnableSaveButton(false); // set no image to registry RegistryService.SetValue(GlobalConstants.REGISTRY_LAST_IMAGE_KEY, GlobalConstants.REGISTRY_LAST_IMAGE_NULL_VALUE); } private void loadImageToolStripMenuItem_Click(object sender, EventArgs e) { LoadImage(); } private void newExcelFileToolStripMenuItem_Click(object sender, EventArgs e) { // inform user that working data are not saved // stop if user clicks cancel if (!PromptIfDataNotSaved()) return; CreateNewExcelFile(); } private bool OpenExcelFile() { // ask if user wants to save data file // stop if user clicks cancel if (!PromptIfDataNotSaved()) return false; // show open excel file dialog OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Excel files|*.xls|New Excel files|*.xlsx|All files|*.*"; openFileDialog.Title = "Open Excel File"; DialogResult result = openFileDialog.ShowDialog(); if (result == DialogResult.OK && !String.IsNullOrEmpty(openFileDialog.FileName)) { try { // clear datagrid ResetDataGridView(); // move focus out of datagridview, what this really does? // toolStripTextBoxPageNumber.Focus(); // import data from excel to data grid view userExcelFile.ImportDataFromExcelFile(openFileDialog.FileName, ref dataGridViewInput); // set current excel file to the file 've just open. userExcelFile.FileName = openFileDialog.FileName; // push excel file name to Autosave Registry RegistryService.SetValue(GlobalConstants.REGISTRY_LAST_EXCEL_KEY, openFileDialog.FileName); this.Text = "FIS.iDET: " + openFileDialog.FileName; // move focus in to datagridview //dataGridViewInput.Focus(); } catch (Exception e) { MessageBox.Show("Error: " + e.Message); return false; } } else return false; return true; } /// <summary> /// shows a message box asking user to save data before continuing next action /// </summary> /// <returns>true if user has decided to go on (ie user clicks on button YES or NO), false if user clicks on CANCEL</returns> private Boolean PromptIfDataNotSaved() { if (dataGridViewInput != null && userExcelFile != null) { // if working data are not saved if (!userExcelFile.Saved && dataGridViewInput.ColumnCount > 0) { // asks if user want to save it DialogResult result = MessageBox.Show("Do you want to save your current data?", "Unsaved data", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3); if (result == DialogResult.Cancel) // not continue return false; else if (result == DialogResult.Yes) { // if an working excel file exists // save it if (userExcelFile.FileName != null) { userExcelFile.SaveAs(dataGridViewInput); return true; } else // if no working excel file // prompts user to choose one return ShowSaveAsDialog(); } } } return true;// continue } private void ResetDataGridView() { // delete old data DeleteDataGridView(); int allColumnWidth = 0; // set default column headers to data grid for (int i = 0; i < GlobalConstants.Columns.Count; i++) { dataGridViewInput.Columns.Add(GlobalConstants.Columns[i].Header, GlobalConstants.Columns[i].Header); dataGridViewInput.Columns[i].Width = GlobalConstants.Columns[i].Width; allColumnWidth += GlobalConstants.Columns[i].Width; } // set the page column read-only if (GlobalConstants.TemplatePageCol > 0 && GlobalConstants.TemplatePageCol <= GlobalConstants.Columns.Count) { dataGridViewInput.Columns[GlobalConstants.TemplatePageCol - 1].ReadOnly = false; //H.NH change this to allow edit mode ! } // add rows to data grid (in case of single line mode) if (tifImage != null && tifImage.TotalFrames != 0 && GlobalConstants.TemplatePageCol == 0) dataGridViewInput.Rows.Add(tifImage.TotalFrames); // in case of multi line mode, rows will be added on excel import // set date format style to date typed columns foreach (int i in GlobalConstants.DateColumnIndices) dataGridViewInput.Columns[i].DefaultCellStyle.Format = comboBoxDateFormat.Text; // resize container panel to fit datagridview's new width splitContainerApp.SplitterDistance = splitContainerApp.Width - allColumnWidth - 55; // dataGridViewInput.Refresh(); // resize data grid view // dataGridViewInput.Width = allColumnWidth; } /// <summary> /// save application options to registry /// </summary> private void SaveApplicationOption() { RegistryService.SetValue(GlobalConstants.REGISTRY_DATE_FORMAT_INDEX, comboBoxDateFormat.SelectedIndex.ToString()); } private void saveDataAsToolStripMenuItem_Click(object sender, EventArgs e) { ShowSaveAsDialog(); } private void saveDataToolStripMenuItem_Click(object sender, EventArgs e) { SaveUserExcelFile(); } private void SaveUserExcelFile() { // stop edit mode dataGridViewInput.EndEdit(); // in case this is called for first time, prompts user to choose a file path if (userExcelFile.FileName == null) ShowSaveAsDialog(); else { // save the file userExcelFile.SaveAs(dataGridViewInput); // stop autosave as file is updated timerAutosave.Stop(); // diasable save buttons EnableSaveButton(false); // clear * in app name Text = Text.Replace('*', ' '); } } private void SelectDataGridViewCell(int i, int j) { dataGridViewInput.CurrentCell = dataGridViewInput.Rows[i].Cells[j]; // dataGridViewInput.Focus(); // dataGridViewInput.BeginEdit(true); } private void ShowRecoveryDialog() { // get last working image file path string lastWorkingImageFile = RegistryService.GetValue(GlobalConstants.REGISTRY_LAST_IMAGE_KEY); // get last working excel file path string lastWorkingExcelFile = RegistryService.GetValue(GlobalConstants.REGISTRY_LAST_EXCEL_KEY); // show recovery dialog box DialogResult result = MessageBox.Show( "It seems like Application crashed last time you were working onf" + "\nImage file: " + lastWorkingImageFile + "\nExcel file: " + lastWorkingExcelFile + "\n\nFortunately we found an auto-saved version your data, do you want to recover it?", "Data recovery", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1 ); // copy autosave file to new location if (result == DialogResult.Yes) autosaveExcelFile.Recover(); } private Boolean ShowSaveAsDialog() { // exit edit mode to update last working cell of data grid dataGridViewInput.EndEdit(); // show save file dialog box SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Excel|*.xls"; saveFileDialog.Title = "Save as Excel File"; DialogResult result = saveFileDialog.ShowDialog(); if (result == DialogResult.OK && !String.IsNullOrEmpty(saveFileDialog.FileName)) { // set file name to user excel file userExcelFile.FileName = saveFileDialog.FileName; // save file userExcelFile.SaveAs(dataGridViewInput); // stop autosave timerAutosave.Stop(); // disable save buttons EnableSaveButton(false); // update to registry RegistryService.SetValue(GlobalConstants.REGISTRY_LAST_EXCEL_KEY, saveFileDialog.FileName); this.Text = "FIS.iDET: " + saveFileDialog.FileName; // save succeeds return true; } // save fails return false; } /*** Menu Handlers ***/ private void timerAutosave_Tick(object sender, EventArgs e) { if (!userExcelFile.Saved) autosaveExcelFile.SaveAsAutoSave(dataGridViewInput); } private void toolStripButtonFind_Click(object sender, EventArgs e) { if (dataGridViewInput.RowCount == 0) return; if (dataGridViewInput.CurrentCell == null || dataGridViewInput.CurrentCell.RowIndex < 0 || dataGridViewInput.CurrentCell.ColumnIndex < 0) dataGridViewInput.CurrentCell = dataGridViewInput.Rows[0].Cells[0]; if (toolStripTextBoxFind.Text.Length > 0) { // case-insensitive, with local language support string whatToFind = toolStripTextBoxFind.Text.ToLowerInvariant(); // find down if (findDown) { // first row if (dataGridViewInput.CurrentCell.ColumnIndex != dataGridViewInput.ColumnCount) for (int i = dataGridViewInput.CurrentCell.RowIndex, j = dataGridViewInput.CurrentCell.ColumnIndex + 1; j < dataGridViewInput.ColumnCount; j++) if (IsFound(whatToFind, i, j)) { SelectDataGridViewCell(i, j); return; } // second to last row if (dataGridViewInput.CurrentCell.RowIndex != dataGridViewInput.RowCount - 1) for (int i = dataGridViewInput.CurrentCell.RowIndex + 1; i < dataGridViewInput.RowCount; i++) for (int j = 0; j < dataGridViewInput.ColumnCount; j++) if (IsFound(whatToFind, i, j)) { SelectDataGridViewCell(i, j); return; } } // find up else { // last row if (dataGridViewInput.CurrentCell.ColumnIndex != 0) for (int i = dataGridViewInput.CurrentCell.RowIndex, j = dataGridViewInput.CurrentCell.ColumnIndex - 1; j >= 0; j--) if (IsFound(whatToFind, i, j)) { SelectDataGridViewCell(i, j); return; } // next to last row to first row if (dataGridViewInput.CurrentCell.RowIndex != 0) for (int i = dataGridViewInput.CurrentCell.RowIndex - 1; i >= 0; i--) for (int j = dataGridViewInput.ColumnCount - 1; j >= 0; j--) if (IsFound(whatToFind, i, j)) { SelectDataGridViewCell(i, j); return; } } // nothing found MessageBox.Show("Cannot find \"" + toolStripTextBoxFind.Text + "\" " + (findDown ? "downward!" : "upward!"), "Search", MessageBoxButtons.OK, MessageBoxIcon.Information); } } private void toolStripButtonFindDirection_Click(object sender, EventArgs e) { // change button image toolStripButtonFindDirection.Image = findDown ? global::FIS.iDET.Properties.Resources.arrowUp : global::FIS.iDET.Properties.Resources.arrowDown; // change direction findDown = !findDown; } private void toolStripButtonNextPage_Click(object sender, EventArgs e) { if (GlobalConstants.TemplatePageCol == 0) { if (dataGridViewInput.CurrentCell.RowIndex < dataGridViewInput.RowCount) { //DataGridViewCellEventArgs egv = new DataGridViewCellEventArgs(0, tifImage.CurrentFrame + 1); //dataGridViewInput_RowEnter(sender, egv); SelectDataGridViewCell(dataGridViewInput.CurrentCell.RowIndex + 1, dataGridViewInput.CurrentCell.ColumnIndex); } } else { int currentPageNumber = 0; int.TryParse(dataGridViewInput.Rows[dataGridViewInput.CurrentRow.Index].Cells[GlobalConstants.TemplatePageCol - 1].Value.ToString(), out currentPageNumber); do { currentPageNumber++; if (FindPageInMultiMode(currentPageNumber) != -1) break; } while ( DialogResult.Yes == MessageBox.Show("Can't find page " + currentPageNumber.ToString()+". Do you want to go to page "+ (currentPageNumber+1).ToString() +" ?","Can not find required page",MessageBoxButtons.YesNo,MessageBoxIcon.Question)); if (FindPageInMultiMode(currentPageNumber)>-1) SelectDataGridViewCell(FindPageInMultiMode(currentPageNumber), dataGridViewInput.CurrentCell.ColumnIndex); // toolStripTextBoxPageNumber.Text = (++currentPageNumber).ToString(); // KeyPressEventArgs key = new KeyPressEventArgs((char) Keys.Enter ); // toolStripTextBoxPageNumber_KeyPress(sender, key); } } private void toolStripButtonPreviousPage_Click(object sender, EventArgs e) { if (dataGridViewInput.CurrentCell.RowIndex > 0) { if (GlobalConstants.TemplatePageCol == 0) //DataGridViewCellEventArgs egv = new DataGridViewCellEventArgs(0, tifImage.CurrentFrame - 1); //dataGridViewInput_RowEnter(sender, egv); SelectDataGridViewCell(dataGridViewInput.CurrentCell.RowIndex - 1, dataGridViewInput.CurrentCell.ColumnIndex); else { int currentPageNumber = 0; int.TryParse(dataGridViewInput.Rows[dataGridViewInput.CurrentRow.Index].Cells[GlobalConstants.TemplatePageCol - 1].Value.ToString(), out currentPageNumber); do { currentPageNumber--; if (FindPageInMultiMode(currentPageNumber) != -1) break; } while (currentPageNumber>0 || DialogResult.Yes == MessageBox.Show("Can't find page " + currentPageNumber.ToString() + ". Do you want to go to page " + (currentPageNumber - 1).ToString() + " ?", "Can not find required page", MessageBoxButtons.YesNo, MessageBoxIcon.Question)); if (FindPageInMultiMode(currentPageNumber) > -1) SelectDataGridViewCell(FindPageInMultiMode(currentPageNumber), dataGridViewInput.CurrentCell.ColumnIndex); } } } private void toolStripOpenExcelFileButton_Click(object sender, EventArgs e) { OpenExcelFile(); } private void toolStripTextBoxFind_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) toolStripButtonFind_Click(null, null); } #region Zoom and pan // tell us if our image has been clicked on public static Point startPoint; public static double zoomFactor = 1; private bool isMouseOverPicture = false; private void dataGridViewInput_MouseEnter(object sender, EventArgs e) { if (!dataGridViewInput.Focused) dataGridViewInput.Focus(); } private void InputToolForm_MouseWheel(object sender, MouseEventArgs e) { if (isMouseOverPicture) { if (e.Delta > 0) { toolStripButtonZoomIn_Click(null, null); } else { toolStripButtonZoomOut_Click(null, null); } } // note: no really need this. More bugs to handle. Use in careful. // toolStripComboBoxZoomRatio.Focus(); } /// <summary> /// limit the moving area of Zoomed Image /// </summary> private void PictBox_MouseDown(object sender, MouseEventArgs e) { PictBox.Focus(); if (e.Button == MouseButtons.Left) { PictBox.Cursor = Cursors.SizeAll; startPoint = e.Location; panelPictBox.AutoScroll.ToString(); } } private void PictBox_MouseEnter(object sender, EventArgs e) { isMouseOverPicture = true; } private void PictBox_MouseLeave(object sender, EventArgs e) { isMouseOverPicture = false; } /// <summary> /// Listen to mouse Event in PictBox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PictBox_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { Point changePoint = new Point(e.Location.X - startPoint.X, e.Location.Y - startPoint.Y); panelPictBox.AutoScrollPosition = new Point(-panelPictBox.AutoScrollPosition.X - changePoint.X, -panelPictBox.AutoScrollPosition.Y - changePoint.Y); } } private void RedrawPicture() { //DateTime t1 = new DateTime(); if (navigationToolStripMenuItem.Checked) { DoubleRectangle rect; if (GlobalConstants.TemplatePageCol == 0) { rect = GetCurrentCellRectSingleLine(); } else { rect = GetCurrentCellRectMultiLine(); } PictBox.Image = tifImage.GetImageZoom(zoomFactor, rect); } else { PictBox.Image = tifImage.GetImageZoom(zoomFactor); } PictBox.Refresh(); GC.Collect(); // DateTime t2 = new DateTime(); } private void PictBox_MouseUp(object sender, MouseEventArgs e) { PictBox.Cursor = Cursors.Default; } private void toolStripButtonZoomIn_Click(object sender, EventArgs e) { if (toolStripComboBoxZoomRatio.SelectedIndex < GlobalConstants.maxZoomIndex) toolStripComboBoxZoomRatio.SelectedIndex++; } private void toolStripButtonZoomOut_Click(object sender, EventArgs e) { if (toolStripComboBoxZoomRatio.SelectedIndex > 0) toolStripComboBoxZoomRatio.SelectedIndex--; } private void toolStripComboBoxZoomRatio_SelectedIndexChanged(object sender, EventArgs e) { if (dataGridViewInput.CurrentCell == null) return; //PictBox.Focus(); if (toolStripComboBoxZoomRatio.SelectedIndex < 0) toolStripComboBoxZoomRatio.SelectedIndex = 4; //handle exception // else init zoom int pos = toolStripComboBoxZoomRatio.Text.IndexOf('%'); string zoomFactorString = toolStripComboBoxZoomRatio.Text.Remove(pos); zoomFactor = Convert.ToDouble(zoomFactorString) / 100; // active zoom buttons if (zoomFactor == GlobalConstants.minZoomFactor) { toolStripButtonZoomIn.Enabled = true; toolStripButtonZoomOut.Enabled = false; } else if (zoomFactor == GlobalConstants.maxZoomFactor) { toolStripButtonZoomIn.Enabled = false; toolStripButtonZoomOut.Enabled = true; } else { toolStripButtonZoomOut.Enabled = true; toolStripButtonZoomIn.Enabled = true; } RedrawPicture(); } #endregion Zoom and pan private DoubleRectangle GetCurrentCellRectSingleLine() { return GlobalConstants.Columns[dataGridViewInput.CurrentCell.ColumnIndex].Rect; } private DoubleRectangle GetCurrentCellRectMultiLine() { DoubleRectangle sourceRect = GetCurrentCellRectSingleLine(); int destCellRowIndex = dataGridViewInput.CurrentCell.RowIndex; if (dataGridViewInput.Rows[destCellRowIndex].Cells[GlobalConstants.TemplatePageCol - 1].Value == null) return sourceRect; object destPage = dataGridViewInput.Rows[destCellRowIndex].Cells[GlobalConstants.TemplatePageCol - 1].Value; int sourceCellRowIndex = destCellRowIndex; while (--sourceCellRowIndex >= 0) { if (dataGridViewInput.Rows[sourceCellRowIndex].Cells[GlobalConstants.TemplatePageCol - 1].Value!=null) // handle exception if ((dataGridViewInput.Rows[sourceCellRowIndex].Cells[GlobalConstants.TemplatePageCol - 1].Value.ToString()) != destPage.ToString()) { int paddingLine = destCellRowIndex - sourceCellRowIndex - 1; sourceRect.Y += sourceRect.Height * paddingLine; return sourceRect; } } sourceRect.Y += sourceRect.Height * destCellRowIndex; return sourceRect; } #region zoom shortcut private void zoomIn2ToolStripMenuItem_Click(object sender, EventArgs e) { toolStripButtonZoomIn_Click(null, null); } private void zoomInToolStripMenuItem_Click(object sender, EventArgs e) { toolStripButtonZoomIn_Click(null, null); } private void zoomOut2ToolStripMenuItem_Click(object sender, EventArgs e) { toolStripButtonZoomOut_Click(null, null); } private void zoomOutToolStripMenuItem_Click(object sender, EventArgs e) { toolStripButtonZoomOut_Click(null, null); } #endregion zoom shortcut private void toolStripTextBoxPageNumber_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { try { int page = Convert.ToInt32(toolStripTextBoxPageNumber.Text); int page_out=0; if (GlobalConstants.TemplatePageCol == 0) // single mode { if (page > 0 && page <= dataGridViewInput.RowCount) SelectDataGridViewCell(page - 1, dataGridViewInput.CurrentCell.ColumnIndex); else toolStripTextBoxPageNumber.Undo(); } else { if (FindPageInMultiMode(page)>-1 ) { SelectDataGridViewCell(FindPageInMultiMode(page), dataGridViewInput.CurrentCell.ColumnIndex); return; } else toolStripTextBoxPageNumber.Undo(); } } catch { toolStripTextBoxPageNumber.Undo(); } } } private int FindPageInMultiMode(int pageNumber) { int page_out = 0; for (int i = 0; i < dataGridViewInput.RowCount; i++) { Int32.TryParse((dataGridViewInput.Rows[i].Cells[GlobalConstants.TemplatePageCol - 1].Value.ToString()), out page_out); if (page_out == pageNumber) return i; } return -1; } private bool LoadTemplate() { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "FIS.iDET Template|*.fis"; openFileDialog.Title = "Load template"; openFileDialog.ShowDialog(); if (openFileDialog.FileName != null && openFileDialog.FileName != "") { // reset vars GlobalConstants.Columns = null; GlobalConstants.DateColumnIndices = new List<int>(); // get template info from XML (.fis file) bool ok = XmlService.ReadXml(openFileDialog.FileName); if (!ok) { // cannot load data MessageBox.Show("Cannot load template, please make sure that it is valid!"); return false; } else { if (GlobalConstants.TemplatePageCol != 0) { dataGridViewInput.AllowUserToAddRows = true; dataGridViewInput.AllowUserToDeleteRows = true; toolStripInsertNewRow.Enabled = true; toolStripInsertNewRows.Enabled = true; } else { dataGridViewInput.AllowUserToAddRows = false; dataGridViewInput.AllowUserToDeleteRows = false; toolStripInsertNewRow.Enabled = false; toolStripInsertNewRows.Enabled = false; } // set date column index array for (int i = 0; i < GlobalConstants.Columns.Count; i++) { if (GlobalConstants.Columns[i].Type == DataTypeEnum.COLUMN_TYPE_DATE) GlobalConstants.DateColumnIndices.Add(i); } return true; } } else return false; } private void toolStripButtonLoadTemplate_Click(object sender, EventArgs e) { LoadTemplate(); } private void compareToolToolStripMenuItem_Click(object sender, EventArgs e) { FormMergeTool formCompare = new FormMergeTool(); formCompare.ShowDialog(); } private void dataGridViewInput_CellEnter(object sender, DataGridViewCellEventArgs e) { try { // var t1 = DateTime.Now; // get image frame for current row int frameToDisplay = 0; if (GlobalConstants.TemplatePageCol == 0) { frameToDisplay = e.RowIndex; } else { if (dataGridViewInput.Rows[e.RowIndex].Cells[GlobalConstants.TemplatePageCol - 1].Value != null) frameToDisplay = Convert.ToInt32(dataGridViewInput.Rows[e.RowIndex].Cells[GlobalConstants.TemplatePageCol - 1].Value) - 1; } if (frameToDisplay > tifImage.TotalFrames) return; // if image frame has changed if (navigationToolStripMenuItem.Checked && tifImage.CurrentFrame != frameToDisplay) { for (int i = 0; i < GlobalConstants.ColumnsOriginalRects.Count; i++) GlobalConstants.Columns[i].Rect = GlobalConstants.ColumnsOriginalRects[i]; } /* var t2 = DateTime.Now; var t3 = DateTime.Now; */ // get image if (tifImage.CurrentFrame != frameToDisplay || navigationToolStripMenuItem.Checked) { tifImage.SetImageFrame(frameToDisplay); // t3 = DateTime.Now; RedrawPicture(); } /* var t4 = DateTime.Now; Debug.WriteLine("time1: " + (t2.Subtract(t1).TotalMilliseconds.ToString()) + " time 2: "+ (t3.Subtract(t2).TotalMilliseconds.ToString()) + " time 3: "+ (t4.Subtract(t3).TotalMilliseconds.ToString())) ; Debug.WriteLine("finish"); */ // update page number toolStripTextBoxPageNumber.Text = (frameToDisplay + 1).ToString(); // update next & previous buttons state if (frameToDisplay == 0) toolStripButtonPreviousPage.Enabled = false; else if (!toolStripButtonPreviousPage.Enabled) toolStripButtonPreviousPage.Enabled = true; if (frameToDisplay == tifImage.TotalFrames - 1) toolStripButtonNextPage.Enabled = false; else if (!toolStripButtonNextPage.Enabled) toolStripButtonNextPage.Enabled = true; // tooltip if (navigationToolStripMenuItem.Checked) { if (dataGridViewInput.CurrentCell != null && dataGridViewInput.CurrentCell.ColumnIndex != GlobalConstants.TemplatePageCol - 1) { toolTipPictBoxDraw(dataGridViewInput.CurrentCell.Value); } else toolTipPictBox.Hide(PictBox); } } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } } private void moveTooltipLeftToolStripMenuItem_Click(object sender, EventArgs e) { if (navigationToolStripMenuItem.Checked) { GlobalConstants.Columns[dataGridViewInput.CurrentCell.ColumnIndex].X -= Convert.ToInt32(toolStripComboBoxPosSpin.Text); RedrawPicture(); } } private void moveTooltipRightToolStripMenuItem_Click(object sender, EventArgs e) { if (navigationToolStripMenuItem.Checked) { GlobalConstants.Columns[dataGridViewInput.CurrentCell.ColumnIndex].X += Convert.ToInt32(toolStripComboBoxPosSpin.Text); RedrawPicture(); } } private void moveTooltipUpToolStripMenuItem_Click(object sender, EventArgs e) { if (navigationToolStripMenuItem.Checked) { GlobalConstants.Columns[dataGridViewInput.CurrentCell.ColumnIndex].Y-=Convert.ToInt32(toolStripComboBoxPosSpin.Text); RedrawPicture(); } } private void moveTooltipDownToolStripMenuItem_Click(object sender, EventArgs e) { if (navigationToolStripMenuItem.Checked) { GlobalConstants.Columns[dataGridViewInput.CurrentCell.ColumnIndex].Y += Convert.ToInt32(toolStripComboBoxPosSpin.Text); RedrawPicture(); } } private void increaseTooltipHeightToolStripMenuItem_Click(object sender, EventArgs e) { if (navigationToolStripMenuItem.Checked) { GlobalConstants.Columns[dataGridViewInput.CurrentCell.ColumnIndex].H++; RedrawPicture(); } } private void increaseTooltipWidthToolStripMenuItem_Click(object sender, EventArgs e) { if (navigationToolStripMenuItem.Checked) { GlobalConstants.Columns[dataGridViewInput.CurrentCell.ColumnIndex].W++; RedrawPicture(); } } private void decreaseTooltipHeightToolStripMenuItem_Click(object sender, EventArgs e) { if (navigationToolStripMenuItem.Checked) { GlobalConstants.Columns[dataGridViewInput.CurrentCell.ColumnIndex].H--; RedrawPicture(); } } private void decreaseTooltipWidthToolStripMenuItem_Click(object sender, EventArgs e) { if (navigationToolStripMenuItem.Checked) { GlobalConstants.Columns[dataGridViewInput.CurrentCell.ColumnIndex].W--; RedrawPicture(); } } private void dataGridViewInput_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { TextBox tb = (TextBox)e.Control; tb.TextChanged -= new EventHandler(dataGridCell_TextChanged); tb.TextChanged += new EventHandler(dataGridCell_TextChanged); } private void dataGridCell_TextChanged(object sender, EventArgs e) { if (navigationToolStripMenuItem.Checked) { toolTipPictBoxDraw(((TextBox)sender).Text); } } private void toolTipPictBoxDraw(object text) { if (text == null) text = ""; DoubleRectangle rect; if (GlobalConstants.TemplatePageCol == 0) { rect = GetCurrentCellRectSingleLine(); } else { rect = GetCurrentCellRectMultiLine(); } int x = (int)((rect.X + rect.Width) * zoomFactor) + 10; int y = (int)((rect.Y + rect.Height / 2) * zoomFactor) - 10; if (x > PictBox.Width || y > PictBox.Height) return; // in case image box has a scroll bar if ((PictBox.Width > panelPictBox.Width || PictBox.Height > panelPictBox.Height) && rect.X!=0 && rect.Y!=0 && rect.Width!=0 && rect.Height!=0 ) { // get image visible area int offsetX = panelPictBox.HorizontalScroll.Value; int offsetY = panelPictBox.VerticalScroll.Value; int edgeX = offsetX + panelPictBox.Width - 20; int edgeY = offsetY + panelPictBox.Height - 20; // move tooltip in case it is outside of visible image area int rectXScaled = (int)(rect.X * zoomFactor) - (int)(GlobalConstants.offsetX * zoomFactor); if (rectXScaled < 0) rectXScaled = 0; int rectYScaled = (int)(rect.Y * zoomFactor) - (int)(GlobalConstants.offsetY * zoomFactor); if (rectYScaled < 0) rectYScaled = 0; if (rectXScaled < offsetX || rectXScaled + (rect.Width + GlobalConstants.offsetX) * zoomFactor > edgeX) { // panelPictBox.HorizontalScroll.Value = rectXScaled; panelPictBox.HorizontalScroll.Value = rectXScaled ; } if (rectYScaled < offsetY || rectYScaled + (rect.Height + GlobalConstants.offsetY) * zoomFactor > edgeY) { panelPictBox.VerticalScroll.Value = rectYScaled ; } } if (rect.X != 0 && rect.Y != 0 && rect.Width != 0 && rect.Height != 0) { toolTipText = text is DateTime ? ((DateTime)text).ToString(comboBoxDateFormat.Text) : text.ToString(); toolTipPictBox.Show(toolTipText, PictBox, x, y); } } private void toolStripComboBoxZoomRatio_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { int pos = toolStripComboBoxZoomRatio.Text.IndexOf('%'); string zoomFactorString = toolStripComboBoxZoomRatio.Text; if (pos > -1) zoomFactorString = toolStripComboBoxZoomRatio.Text.Remove(pos); else toolStripComboBoxZoomRatio.Text += "%"; double dzoomFactor = 0; // Ugly code here, use for identify the index of zoomComboBox int nzoomFactor =0; Int32.TryParse(zoomFactorString, out nzoomFactor); if (nzoomFactor > 0 && nzoomFactor <= GlobalConstants.maxZoomFactor*100) { toolStripComboBoxZoomRatio.SelectedIndex = (nzoomFactor / 20)-1; toolStripComboBoxZoomRatio.Text = zoomFactorString + "%"; } // end zoomComboBox if (double.TryParse(zoomFactorString, out dzoomFactor) && dzoomFactor > 0 && dzoomFactor < (GlobalConstants.maxZoomFactor * 100)) { zoomFactor = Convert.ToDouble(zoomFactorString) / 100; RedrawPicture(); } else toolStripComboBoxZoomRatio.SelectedIndex = 4; } } private void toolStripButtonZoomFit_Click(object sender, EventArgs e) { // Calculate zoom factor int odd = 15; GlobalVariables.zoomMode = Math.Abs(GlobalVariables.zoomMode - 1); if (GlobalVariables.zoomMode == 0) // Fit width ( maybe ? ) zoomFactor = (double)(panelPictBox.Width - odd) / (double)tifImage.Width; else zoomFactor = (double)(panelPictBox.Height - odd) / (double)tifImage.Height; int nzoomFactor = (int)(zoomFactor * 100); toolStripComboBoxZoomRatio.Text = nzoomFactor.ToString() + "%"; KeyPressEventArgs key = new KeyPressEventArgs((char)Keys.Enter); toolStripComboBoxZoomRatio_KeyPress(null, key); } private void navigationToolStripMenuItem_Click(object sender, EventArgs e) { RedrawPicture(); } private void zoomFitToolStripMenuItem_Click(object sender, EventArgs e) { toolStripButtonZoomFit_Click(null, null); } private void toolStripButtonNavigationGuide_Click(object sender, EventArgs e) { navigationToolStripMenuItem.Checked = !navigationToolStripMenuItem.Checked; // change button image toolStripButtonNavigationGuide.Image = navigationToolStripMenuItem.Checked ? global::FIS.iDET.Properties.Resources.balloon : global::FIS.iDET.Properties.Resources.balloonOff; if (!navigationToolStripMenuItem.Checked) toolTipPictBox.Hide(PictBox); else if (dataGridViewInput.CurrentCell != null) toolTipPictBoxDraw(dataGridViewInput.CurrentCell.Value); RedrawPicture(); } private void openToolStripMenuItem_Click(object sender, EventArgs e) { toolStripButtonLoadTemplate_Click(null, null); } private string toolTipText; private Font toolTipFont = new Font("Arial", 16); private void toolTipPictBox_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(toolTipText, toolTipFont, Brushes.DarkOrange, 2, 2); } private Graphics gTooltip; private void toolTipPictBox_Popup(object sender, PopupEventArgs e) { SizeF size = gTooltip.MeasureString(toolTipText, toolTipFont); size.Width += 4; /*Graphics g = Graphics.FromImage(new Bitmap(1, 1)); size.Width = _MeasureDisplayStringWidth(g, toolTipText,toolTipFont); size.Width += 6; */ size.Height += 2; e.ToolTipSize = size.ToSize(); } protected int _MeasureDisplayStringWidth(Graphics graphics, string text, Font font) { if (text == "") return 0; StringFormat format = new StringFormat(StringFormat.GenericDefault); RectangleF rect = new RectangleF(0, 0, 1000, 1000); CharacterRange[] ranges = { new CharacterRange(0, text.Length) }; Region[] regions = new Region[1]; format.SetMeasurableCharacterRanges(ranges); format.FormatFlags = StringFormatFlags.MeasureTrailingSpaces; regions = graphics.MeasureCharacterRanges(text, font, rect, format); rect = regions[0].GetBounds(graphics); return (int)(rect.Right); } private void toolStripInsertNewRow_Click(object sender, EventArgs e) { if (dataGridViewInput.CurrentCell != null) { int rowIndex = dataGridViewInput.CurrentCell.RowIndex + 1; if (rowIndex == dataGridViewInput.RowCount) rowIndex--; object[] newRowData = new object[dataGridViewInput.ColumnCount]; newRowData[GlobalConstants.TemplatePageCol - 1] = dataGridViewInput.Rows[rowIndex].Cells[GlobalConstants.TemplatePageCol - 1].Value; dataGridViewInput.Rows.Insert(rowIndex, newRowData); } } private void deleteRowsToolStripMenuItem_Click(object sender, EventArgs e) { foreach (DataGridViewRow item in dataGridViewInput.SelectedRows) { dataGridViewInput.Rows.RemoveAt(item.Index); dataGridViewInput.ClearSelection(); } } private void dataGridViewInput_UserDeletedRow(object sender, DataGridViewRowEventArgs e) { dataGridViewInput.ClearSelection(); } private void toolStripMenuItem1_Click(object sender, EventArgs e) { string rows; rows = Interaction.InputBox("Number of new rows","Insert new rows", "1"); int rowsNumber; if (int.TryParse(rows, out rowsNumber)) { if (rowsNumber > 0) { for (int i = 1; i <= rowsNumber; i++) toolStripInsertNewRow_Click(sender, e); } } } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/InputToolForm.cs
C#
Microsoft Reciprocal License (Ms-RL)
64,057
namespace FIS.iDET { partial class InputToolForm { /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InputToolForm)); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.menuStripApp = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.loadImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.moveTooltipLeftToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.moveTooltipRightToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.moveTooltipUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.moveTooltipDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.increaseTooltipHeightToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.increaseTooltipWidthToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.decreaseTooltipHeightToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.decreaseTooltipWidthToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); this.navigationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveDataAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.newExcelFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.loadExcelFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripInsertNewRow = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripInsertNewRows = new System.Windows.Forms.ToolStripMenuItem(); this.deleteRowsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.findToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.goToPageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); this.zoomInToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.zoomOutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.zoomFitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.zoomIn2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.zoomOut2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.compareToolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpsubToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.timerAutosave = new System.Windows.Forms.Timer(this.components); this.toolStripApp = new System.Windows.Forms.ToolStrip(); this.toolStripButtonLoadTemplate = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonLoadImage = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripOpenExcelFileButton = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonSaveData = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonNewData = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripButtonPreviousPage = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonNextPage = new System.Windows.Forms.ToolStripButton(); this.toolStripTextBoxPageNumber = new System.Windows.Forms.ToolStripTextBox(); this.toolStripLabelPage = new System.Windows.Forms.ToolStripLabel(); this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripButtonZoomOut = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonZoomIn = new System.Windows.Forms.ToolStripButton(); this.toolStripComboBoxZoomRatio = new System.Windows.Forms.ToolStripComboBox(); this.toolStripButtonZoomFit = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); this.comboBoxDateFormat = new System.Windows.Forms.ToolStripComboBox(); this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); this.toolStripLabelFind = new System.Windows.Forms.ToolStripLabel(); this.toolStripTextBoxFind = new System.Windows.Forms.ToolStripTextBox(); this.toolStripButtonFind = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonFindDirection = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); this.toolStripComboBoxPosSpin = new System.Windows.Forms.ToolStripComboBox(); this.toolStripLabel3 = new System.Windows.Forms.ToolStripLabel(); this.toolStripButtonNavigationGuide = new System.Windows.Forms.ToolStripButton(); this.splitContainerApp = new System.Windows.Forms.SplitContainer(); this.panelPictBox = new System.Windows.Forms.Panel(); this.PictBox = new System.Windows.Forms.PictureBox(); this.dataGridViewInput = new System.Windows.Forms.DataGridView(); this.label1 = new System.Windows.Forms.Label(); this.toolTipPictBox = new System.Windows.Forms.ToolTip(this.components); this.menuStripApp.SuspendLayout(); this.toolStripApp.SuspendLayout(); this.splitContainerApp.Panel1.SuspendLayout(); this.splitContainerApp.Panel2.SuspendLayout(); this.splitContainerApp.SuspendLayout(); this.panelPictBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PictBox)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewInput)).BeginInit(); this.SuspendLayout(); // // menuStripApp // this.menuStripApp.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.editToolStripMenuItem, this.toolsToolStripMenuItem, this.toolToolStripMenuItem, this.helpToolStripMenuItem}); this.menuStripApp.Location = new System.Drawing.Point(0, 0); this.menuStripApp.Name = "menuStripApp"; this.menuStripApp.Size = new System.Drawing.Size(1276, 24); this.menuStripApp.TabIndex = 10; this.menuStripApp.Text = "menuStripApp"; // // fileToolStripMenuItem // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.openToolStripMenuItem, this.loadImageToolStripMenuItem, this.toolStripSeparator2, this.moveTooltipLeftToolStripMenuItem, this.moveTooltipRightToolStripMenuItem, this.moveTooltipUpToolStripMenuItem, this.moveTooltipDownToolStripMenuItem, this.increaseTooltipHeightToolStripMenuItem, this.increaseTooltipWidthToolStripMenuItem, this.decreaseTooltipHeightToolStripMenuItem, this.decreaseTooltipWidthToolStripMenuItem, this.toolStripSeparator10, this.navigationToolStripMenuItem, this.toolStripSeparator11, this.exitToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(52, 20); this.fileToolStripMenuItem.Text = "&Image"; // // openToolStripMenuItem // this.openToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.application_import3; this.openToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.openToolStripMenuItem.Name = "openToolStripMenuItem"; this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T))); this.openToolStripMenuItem.Size = new System.Drawing.Size(280, 22); this.openToolStripMenuItem.Text = "L&oad Template"; this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); // // loadImageToolStripMenuItem // this.loadImageToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("loadImageToolStripMenuItem.Image"))); this.loadImageToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.loadImageToolStripMenuItem.Name = "loadImageToolStripMenuItem"; this.loadImageToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); this.loadImageToolStripMenuItem.Size = new System.Drawing.Size(280, 22); this.loadImageToolStripMenuItem.Text = "&Load Image"; this.loadImageToolStripMenuItem.Click += new System.EventHandler(this.loadImageToolStripMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Size = new System.Drawing.Size(277, 6); this.toolStripSeparator2.Visible = false; // // moveTooltipLeftToolStripMenuItem // this.moveTooltipLeftToolStripMenuItem.Enabled = false; this.moveTooltipLeftToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.arrow_180_medium; this.moveTooltipLeftToolStripMenuItem.Name = "moveTooltipLeftToolStripMenuItem"; this.moveTooltipLeftToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.Left))); this.moveTooltipLeftToolStripMenuItem.Size = new System.Drawing.Size(280, 22); this.moveTooltipLeftToolStripMenuItem.Text = "Move tooltip left"; this.moveTooltipLeftToolStripMenuItem.Visible = false; this.moveTooltipLeftToolStripMenuItem.Click += new System.EventHandler(this.moveTooltipLeftToolStripMenuItem_Click); // // moveTooltipRightToolStripMenuItem // this.moveTooltipRightToolStripMenuItem.Enabled = false; this.moveTooltipRightToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.arrow_000_medium; this.moveTooltipRightToolStripMenuItem.Name = "moveTooltipRightToolStripMenuItem"; this.moveTooltipRightToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.Right))); this.moveTooltipRightToolStripMenuItem.Size = new System.Drawing.Size(280, 22); this.moveTooltipRightToolStripMenuItem.Text = "Move tooltip right"; this.moveTooltipRightToolStripMenuItem.Visible = false; this.moveTooltipRightToolStripMenuItem.Click += new System.EventHandler(this.moveTooltipRightToolStripMenuItem_Click); // // moveTooltipUpToolStripMenuItem // this.moveTooltipUpToolStripMenuItem.Enabled = false; this.moveTooltipUpToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.arrow_090_medium; this.moveTooltipUpToolStripMenuItem.Name = "moveTooltipUpToolStripMenuItem"; this.moveTooltipUpToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.Up))); this.moveTooltipUpToolStripMenuItem.Size = new System.Drawing.Size(280, 22); this.moveTooltipUpToolStripMenuItem.Text = "Move tooltip up"; this.moveTooltipUpToolStripMenuItem.Visible = false; this.moveTooltipUpToolStripMenuItem.Click += new System.EventHandler(this.moveTooltipUpToolStripMenuItem_Click); // // moveTooltipDownToolStripMenuItem // this.moveTooltipDownToolStripMenuItem.Enabled = false; this.moveTooltipDownToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.arrow_270_medium; this.moveTooltipDownToolStripMenuItem.Name = "moveTooltipDownToolStripMenuItem"; this.moveTooltipDownToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.Down))); this.moveTooltipDownToolStripMenuItem.Size = new System.Drawing.Size(280, 22); this.moveTooltipDownToolStripMenuItem.Text = "Move tooltip down"; this.moveTooltipDownToolStripMenuItem.Visible = false; this.moveTooltipDownToolStripMenuItem.Click += new System.EventHandler(this.moveTooltipDownToolStripMenuItem_Click); // // increaseTooltipHeightToolStripMenuItem // this.increaseTooltipHeightToolStripMenuItem.Enabled = false; this.increaseTooltipHeightToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.application_dock_090; this.increaseTooltipHeightToolStripMenuItem.Name = "increaseTooltipHeightToolStripMenuItem"; this.increaseTooltipHeightToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) | System.Windows.Forms.Keys.Down))); this.increaseTooltipHeightToolStripMenuItem.Size = new System.Drawing.Size(280, 22); this.increaseTooltipHeightToolStripMenuItem.Text = "Increase tooltip height"; this.increaseTooltipHeightToolStripMenuItem.Visible = false; this.increaseTooltipHeightToolStripMenuItem.Click += new System.EventHandler(this.increaseTooltipHeightToolStripMenuItem_Click); // // increaseTooltipWidthToolStripMenuItem // this.increaseTooltipWidthToolStripMenuItem.Enabled = false; this.increaseTooltipWidthToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.application_dock; this.increaseTooltipWidthToolStripMenuItem.Name = "increaseTooltipWidthToolStripMenuItem"; this.increaseTooltipWidthToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) | System.Windows.Forms.Keys.Right))); this.increaseTooltipWidthToolStripMenuItem.Size = new System.Drawing.Size(280, 22); this.increaseTooltipWidthToolStripMenuItem.Text = "Increase tooltip width"; this.increaseTooltipWidthToolStripMenuItem.Visible = false; this.increaseTooltipWidthToolStripMenuItem.Click += new System.EventHandler(this.increaseTooltipWidthToolStripMenuItem_Click); // // decreaseTooltipHeightToolStripMenuItem // this.decreaseTooltipHeightToolStripMenuItem.Enabled = false; this.decreaseTooltipHeightToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.application_dock_270; this.decreaseTooltipHeightToolStripMenuItem.Name = "decreaseTooltipHeightToolStripMenuItem"; this.decreaseTooltipHeightToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) | System.Windows.Forms.Keys.Up))); this.decreaseTooltipHeightToolStripMenuItem.Size = new System.Drawing.Size(280, 22); this.decreaseTooltipHeightToolStripMenuItem.Text = "Decrease tooltip height"; this.decreaseTooltipHeightToolStripMenuItem.Visible = false; this.decreaseTooltipHeightToolStripMenuItem.Click += new System.EventHandler(this.decreaseTooltipHeightToolStripMenuItem_Click); // // decreaseTooltipWidthToolStripMenuItem // this.decreaseTooltipWidthToolStripMenuItem.Enabled = false; this.decreaseTooltipWidthToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.application_dock_180; this.decreaseTooltipWidthToolStripMenuItem.Name = "decreaseTooltipWidthToolStripMenuItem"; this.decreaseTooltipWidthToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Alt) | System.Windows.Forms.Keys.Left))); this.decreaseTooltipWidthToolStripMenuItem.Size = new System.Drawing.Size(280, 22); this.decreaseTooltipWidthToolStripMenuItem.Text = "Decrease tooltip width"; this.decreaseTooltipWidthToolStripMenuItem.Visible = false; this.decreaseTooltipWidthToolStripMenuItem.Click += new System.EventHandler(this.decreaseTooltipWidthToolStripMenuItem_Click); // // toolStripSeparator10 // this.toolStripSeparator10.Name = "toolStripSeparator10"; this.toolStripSeparator10.Size = new System.Drawing.Size(277, 6); // // navigationToolStripMenuItem // this.navigationToolStripMenuItem.Checked = true; this.navigationToolStripMenuItem.CheckOnClick = true; this.navigationToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.navigationToolStripMenuItem.Enabled = false; this.navigationToolStripMenuItem.Name = "navigationToolStripMenuItem"; this.navigationToolStripMenuItem.Size = new System.Drawing.Size(280, 22); this.navigationToolStripMenuItem.Text = "Navigation Guide"; this.navigationToolStripMenuItem.Click += new System.EventHandler(this.navigationToolStripMenuItem_Click); // // toolStripSeparator11 // this.toolStripSeparator11.Name = "toolStripSeparator11"; this.toolStripSeparator11.Size = new System.Drawing.Size(277, 6); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("exitToolStripMenuItem.Image"))); this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Size = new System.Drawing.Size(280, 22); this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // // editToolStripMenuItem // this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.saveDataToolStripMenuItem, this.saveDataAsToolStripMenuItem, this.toolStripSeparator3, this.newExcelFileToolStripMenuItem, this.loadExcelFileToolStripMenuItem, this.toolStripSeparator1, this.toolStripInsertNewRow, this.toolStripInsertNewRows, this.deleteRowsToolStripMenuItem}); this.editToolStripMenuItem.Name = "editToolStripMenuItem"; this.editToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete))); this.editToolStripMenuItem.Size = new System.Drawing.Size(43, 20); this.editToolStripMenuItem.Text = "&Data"; // // saveDataToolStripMenuItem // this.saveDataToolStripMenuItem.Enabled = false; this.saveDataToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveDataToolStripMenuItem.Image"))); this.saveDataToolStripMenuItem.Name = "saveDataToolStripMenuItem"; this.saveDataToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); this.saveDataToolStripMenuItem.Size = new System.Drawing.Size(242, 22); this.saveDataToolStripMenuItem.Text = "&Save data"; this.saveDataToolStripMenuItem.Click += new System.EventHandler(this.saveDataToolStripMenuItem_Click); // // saveDataAsToolStripMenuItem // this.saveDataAsToolStripMenuItem.Enabled = false; this.saveDataAsToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveDataAsToolStripMenuItem.Image"))); this.saveDataAsToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.saveDataAsToolStripMenuItem.Name = "saveDataAsToolStripMenuItem"; this.saveDataAsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.S))); this.saveDataAsToolStripMenuItem.Size = new System.Drawing.Size(242, 22); this.saveDataAsToolStripMenuItem.Text = "S&ave data as"; this.saveDataAsToolStripMenuItem.Click += new System.EventHandler(this.saveDataAsToolStripMenuItem_Click); // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Size = new System.Drawing.Size(239, 6); // // newExcelFileToolStripMenuItem // this.newExcelFileToolStripMenuItem.Enabled = false; this.newExcelFileToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newExcelFileToolStripMenuItem.Image"))); this.newExcelFileToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; this.newExcelFileToolStripMenuItem.Name = "newExcelFileToolStripMenuItem"; this.newExcelFileToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); this.newExcelFileToolStripMenuItem.Size = new System.Drawing.Size(242, 22); this.newExcelFileToolStripMenuItem.Text = "&New Excel File"; this.newExcelFileToolStripMenuItem.Click += new System.EventHandler(this.newExcelFileToolStripMenuItem_Click); // // loadExcelFileToolStripMenuItem // this.loadExcelFileToolStripMenuItem.Enabled = false; this.loadExcelFileToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("loadExcelFileToolStripMenuItem.Image"))); this.loadExcelFileToolStripMenuItem.Name = "loadExcelFileToolStripMenuItem"; this.loadExcelFileToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.O))); this.loadExcelFileToolStripMenuItem.Size = new System.Drawing.Size(242, 22); this.loadExcelFileToolStripMenuItem.Text = "&Load Excel File"; this.loadExcelFileToolStripMenuItem.Click += new System.EventHandler(this.loadExcelFileToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(239, 6); // // toolStripInsertNewRow // this.toolStripInsertNewRow.Enabled = false; this.toolStripInsertNewRow.Name = "toolStripInsertNewRow"; this.toolStripInsertNewRow.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Insert))); this.toolStripInsertNewRow.Size = new System.Drawing.Size(242, 22); this.toolStripInsertNewRow.Text = "Insert New Row"; this.toolStripInsertNewRow.Click += new System.EventHandler(this.toolStripInsertNewRow_Click); // // toolStripInsertNewRows // this.toolStripInsertNewRows.Enabled = false; this.toolStripInsertNewRows.Name = "toolStripInsertNewRows"; this.toolStripInsertNewRows.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.Insert))); this.toolStripInsertNewRows.Size = new System.Drawing.Size(242, 22); this.toolStripInsertNewRows.Text = "Insert New Rows"; this.toolStripInsertNewRows.Click += new System.EventHandler(this.toolStripMenuItem1_Click); // // deleteRowsToolStripMenuItem // this.deleteRowsToolStripMenuItem.Enabled = false; this.deleteRowsToolStripMenuItem.Name = "deleteRowsToolStripMenuItem"; this.deleteRowsToolStripMenuItem.Size = new System.Drawing.Size(242, 22); this.deleteRowsToolStripMenuItem.Text = "Delete Row(s)"; this.deleteRowsToolStripMenuItem.Visible = false; this.deleteRowsToolStripMenuItem.Click += new System.EventHandler(this.deleteRowsToolStripMenuItem_Click); // // toolsToolStripMenuItem // this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.findToolStripMenuItem, this.goToPageToolStripMenuItem, this.toolStripSeparator9, this.zoomInToolStripMenuItem, this.zoomOutToolStripMenuItem, this.zoomFitToolStripMenuItem, this.zoomIn2ToolStripMenuItem, this.zoomOut2ToolStripMenuItem}); this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; this.toolsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z))); this.toolsToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.toolsToolStripMenuItem.Text = "&View"; // // findToolStripMenuItem // this.findToolStripMenuItem.Enabled = false; this.findToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("findToolStripMenuItem.Image"))); this.findToolStripMenuItem.Name = "findToolStripMenuItem"; this.findToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); this.findToolStripMenuItem.Size = new System.Drawing.Size(226, 22); this.findToolStripMenuItem.Text = "&Find"; this.findToolStripMenuItem.Click += new System.EventHandler(this.findToolStripMenuItem_Click); // // goToPageToolStripMenuItem // this.goToPageToolStripMenuItem.Enabled = false; this.goToPageToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("goToPageToolStripMenuItem.Image"))); this.goToPageToolStripMenuItem.Name = "goToPageToolStripMenuItem"; this.goToPageToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G))); this.goToPageToolStripMenuItem.Size = new System.Drawing.Size(226, 22); this.goToPageToolStripMenuItem.Text = "&Go to Page"; this.goToPageToolStripMenuItem.Click += new System.EventHandler(this.goToPageToolStripMenuItem_Click); // // toolStripSeparator9 // this.toolStripSeparator9.Name = "toolStripSeparator9"; this.toolStripSeparator9.Size = new System.Drawing.Size(223, 6); // // zoomInToolStripMenuItem // this.zoomInToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.zoomInSmall; this.zoomInToolStripMenuItem.Name = "zoomInToolStripMenuItem"; this.zoomInToolStripMenuItem.ShortcutKeyDisplayString = "Ctr + ="; this.zoomInToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Add))); this.zoomInToolStripMenuItem.Size = new System.Drawing.Size(226, 22); this.zoomInToolStripMenuItem.Text = "Zoom &in"; this.zoomInToolStripMenuItem.Click += new System.EventHandler(this.zoomInToolStripMenuItem_Click); // // zoomOutToolStripMenuItem // this.zoomOutToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.zoomOutSmall; this.zoomOutToolStripMenuItem.Name = "zoomOutToolStripMenuItem"; this.zoomOutToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl + -"; this.zoomOutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Subtract))); this.zoomOutToolStripMenuItem.Size = new System.Drawing.Size(226, 22); this.zoomOutToolStripMenuItem.Text = "Zoom &out"; this.zoomOutToolStripMenuItem.Click += new System.EventHandler(this.zoomOutToolStripMenuItem_Click); // // zoomFitToolStripMenuItem // this.zoomFitToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.zoomFitSmall; this.zoomFitToolStripMenuItem.Name = "zoomFitToolStripMenuItem"; this.zoomFitToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl + ~"; this.zoomFitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Oemtilde))); this.zoomFitToolStripMenuItem.Size = new System.Drawing.Size(226, 22); this.zoomFitToolStripMenuItem.Text = "Zoom fit"; this.zoomFitToolStripMenuItem.Click += new System.EventHandler(this.zoomFitToolStripMenuItem_Click); // // zoomIn2ToolStripMenuItem // this.zoomIn2ToolStripMenuItem.Name = "zoomIn2ToolStripMenuItem"; this.zoomIn2ToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Oemplus))); this.zoomIn2ToolStripMenuItem.Size = new System.Drawing.Size(226, 22); this.zoomIn2ToolStripMenuItem.Text = "Zoom in2"; this.zoomIn2ToolStripMenuItem.Visible = false; this.zoomIn2ToolStripMenuItem.Click += new System.EventHandler(this.zoomIn2ToolStripMenuItem_Click); // // zoomOut2ToolStripMenuItem // this.zoomOut2ToolStripMenuItem.Name = "zoomOut2ToolStripMenuItem"; this.zoomOut2ToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.OemMinus))); this.zoomOut2ToolStripMenuItem.Size = new System.Drawing.Size(226, 22); this.zoomOut2ToolStripMenuItem.Text = "Zoom out2"; this.zoomOut2ToolStripMenuItem.Visible = false; this.zoomOut2ToolStripMenuItem.Click += new System.EventHandler(this.zoomOut2ToolStripMenuItem_Click); // // toolToolStripMenuItem // this.toolToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.compareToolToolStripMenuItem}); this.toolToolStripMenuItem.Name = "toolToolStripMenuItem"; this.toolToolStripMenuItem.Size = new System.Drawing.Size(48, 20); this.toolToolStripMenuItem.Text = "Tools"; // // compareToolToolStripMenuItem // this.compareToolToolStripMenuItem.Image = global::FIS.iDET.Properties.Resources.compareSmall; this.compareToolToolStripMenuItem.Name = "compareToolToolStripMenuItem"; this.compareToolToolStripMenuItem.Size = new System.Drawing.Size(134, 22); this.compareToolToolStripMenuItem.Text = "Merge Files"; this.compareToolToolStripMenuItem.Click += new System.EventHandler(this.compareToolToolStripMenuItem_Click); // // helpToolStripMenuItem // this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.helpsubToolStripMenuItem, this.toolStripSeparator5, this.aboutToolStripMenuItem}); this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.helpToolStripMenuItem.Text = "&Help"; // // helpsubToolStripMenuItem // this.helpsubToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("helpsubToolStripMenuItem.Image"))); this.helpsubToolStripMenuItem.Name = "helpsubToolStripMenuItem"; this.helpsubToolStripMenuItem.Size = new System.Drawing.Size(116, 22); this.helpsubToolStripMenuItem.Text = "H&elp"; this.helpsubToolStripMenuItem.Click += new System.EventHandler(this.helpsubToolStripMenuItem_Click); // // toolStripSeparator5 // this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Size = new System.Drawing.Size(113, 6); // // aboutToolStripMenuItem // this.aboutToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("aboutToolStripMenuItem.Image"))); this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; this.aboutToolStripMenuItem.Size = new System.Drawing.Size(116, 22); this.aboutToolStripMenuItem.Text = "&About..."; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // // timerAutosave // this.timerAutosave.Interval = 300000; this.timerAutosave.Tick += new System.EventHandler(this.timerAutosave_Tick); // // toolStripApp // this.toolStripApp.ImageScalingSize = new System.Drawing.Size(24, 24); this.toolStripApp.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripButtonLoadTemplate, this.toolStripButtonLoadImage, this.toolStripSeparator4, this.toolStripOpenExcelFileButton, this.toolStripButtonSaveData, this.toolStripButtonNewData, this.toolStripSeparator6, this.toolStripButtonPreviousPage, this.toolStripButtonNextPage, this.toolStripTextBoxPageNumber, this.toolStripLabelPage, this.toolStripSeparator7, this.toolStripButtonZoomOut, this.toolStripButtonZoomIn, this.toolStripComboBoxZoomRatio, this.toolStripButtonZoomFit, this.toolStripSeparator8, this.comboBoxDateFormat, this.toolStripLabel1, this.toolStripLabelFind, this.toolStripTextBoxFind, this.toolStripButtonFind, this.toolStripButtonFindDirection, this.toolStripSeparator12, this.toolStripLabel2, this.toolStripComboBoxPosSpin, this.toolStripLabel3, this.toolStripButtonNavigationGuide}); this.toolStripApp.Location = new System.Drawing.Point(0, 24); this.toolStripApp.Name = "toolStripApp"; this.toolStripApp.Size = new System.Drawing.Size(1276, 31); this.toolStripApp.TabIndex = 11; this.toolStripApp.Text = "toolStripApp"; // // toolStripButtonLoadTemplate // this.toolStripButtonLoadTemplate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonLoadTemplate.Image = global::FIS.iDET.Properties.Resources.application_import3; this.toolStripButtonLoadTemplate.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonLoadTemplate.Name = "toolStripButtonLoadTemplate"; this.toolStripButtonLoadTemplate.Size = new System.Drawing.Size(28, 28); this.toolStripButtonLoadTemplate.Text = "Load Template"; this.toolStripButtonLoadTemplate.ToolTipText = "Load Template file"; this.toolStripButtonLoadTemplate.Click += new System.EventHandler(this.toolStripButtonLoadTemplate_Click); // // toolStripButtonLoadImage // this.toolStripButtonLoadImage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonLoadImage.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonLoadImage.Image"))); this.toolStripButtonLoadImage.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonLoadImage.Name = "toolStripButtonLoadImage"; this.toolStripButtonLoadImage.Size = new System.Drawing.Size(28, 28); this.toolStripButtonLoadImage.Text = "toolStripButtonLoadImage"; this.toolStripButtonLoadImage.ToolTipText = "Load Tiff Image"; this.toolStripButtonLoadImage.Click += new System.EventHandler(this.loadImageToolStripMenuItem_Click); // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Size = new System.Drawing.Size(6, 31); // // toolStripOpenExcelFileButton // this.toolStripOpenExcelFileButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripOpenExcelFileButton.Enabled = false; this.toolStripOpenExcelFileButton.Image = ((System.Drawing.Image)(resources.GetObject("toolStripOpenExcelFileButton.Image"))); this.toolStripOpenExcelFileButton.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripOpenExcelFileButton.Name = "toolStripOpenExcelFileButton"; this.toolStripOpenExcelFileButton.Size = new System.Drawing.Size(28, 28); this.toolStripOpenExcelFileButton.Text = "toolStripButton1"; this.toolStripOpenExcelFileButton.ToolTipText = "Open Excel File"; this.toolStripOpenExcelFileButton.Click += new System.EventHandler(this.toolStripOpenExcelFileButton_Click); // // toolStripButtonSaveData // this.toolStripButtonSaveData.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonSaveData.Enabled = false; this.toolStripButtonSaveData.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonSaveData.Image"))); this.toolStripButtonSaveData.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonSaveData.Name = "toolStripButtonSaveData"; this.toolStripButtonSaveData.Size = new System.Drawing.Size(28, 28); this.toolStripButtonSaveData.Text = "toolStripButtonSaveData"; this.toolStripButtonSaveData.ToolTipText = "Save data to Excel File"; this.toolStripButtonSaveData.Click += new System.EventHandler(this.saveDataToolStripMenuItem_Click); // // toolStripButtonNewData // this.toolStripButtonNewData.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonNewData.Enabled = false; this.toolStripButtonNewData.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonNewData.Image"))); this.toolStripButtonNewData.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonNewData.Name = "toolStripButtonNewData"; this.toolStripButtonNewData.Size = new System.Drawing.Size(28, 28); this.toolStripButtonNewData.Text = "toolStripButtonNewData"; this.toolStripButtonNewData.ToolTipText = "New data"; this.toolStripButtonNewData.Click += new System.EventHandler(this.newExcelFileToolStripMenuItem_Click); // // toolStripSeparator6 // this.toolStripSeparator6.Name = "toolStripSeparator6"; this.toolStripSeparator6.Size = new System.Drawing.Size(6, 31); // // toolStripButtonPreviousPage // this.toolStripButtonPreviousPage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonPreviousPage.Enabled = false; this.toolStripButtonPreviousPage.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonPreviousPage.Image"))); this.toolStripButtonPreviousPage.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonPreviousPage.Name = "toolStripButtonPreviousPage"; this.toolStripButtonPreviousPage.Size = new System.Drawing.Size(28, 28); this.toolStripButtonPreviousPage.Text = "Previous Page"; this.toolStripButtonPreviousPage.Click += new System.EventHandler(this.toolStripButtonPreviousPage_Click); // // toolStripButtonNextPage // this.toolStripButtonNextPage.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonNextPage.Enabled = false; this.toolStripButtonNextPage.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonNextPage.Image"))); this.toolStripButtonNextPage.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonNextPage.Name = "toolStripButtonNextPage"; this.toolStripButtonNextPage.Size = new System.Drawing.Size(28, 28); this.toolStripButtonNextPage.Text = "Next Page"; this.toolStripButtonNextPage.Click += new System.EventHandler(this.toolStripButtonNextPage_Click); // // toolStripTextBoxPageNumber // this.toolStripTextBoxPageNumber.Enabled = false; this.toolStripTextBoxPageNumber.Name = "toolStripTextBoxPageNumber"; this.toolStripTextBoxPageNumber.Size = new System.Drawing.Size(30, 31); this.toolStripTextBoxPageNumber.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.toolStripTextBoxPageNumber.ToolTipText = "Enter page to navigate"; this.toolStripTextBoxPageNumber.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.toolStripTextBoxPageNumber_KeyPress); // // toolStripLabelPage // this.toolStripLabelPage.Name = "toolStripLabelPage"; this.toolStripLabelPage.Size = new System.Drawing.Size(0, 28); // // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; this.toolStripSeparator7.Size = new System.Drawing.Size(6, 31); // // toolStripButtonZoomOut // this.toolStripButtonZoomOut.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonZoomOut.Enabled = false; this.toolStripButtonZoomOut.Image = global::FIS.iDET.Properties.Resources.zoomOut; this.toolStripButtonZoomOut.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonZoomOut.Name = "toolStripButtonZoomOut"; this.toolStripButtonZoomOut.Size = new System.Drawing.Size(28, 28); this.toolStripButtonZoomOut.Text = "toolStripButtonZoomOut"; this.toolStripButtonZoomOut.ToolTipText = "Zoom Out"; this.toolStripButtonZoomOut.Click += new System.EventHandler(this.toolStripButtonZoomOut_Click); // // toolStripButtonZoomIn // this.toolStripButtonZoomIn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonZoomIn.Enabled = false; this.toolStripButtonZoomIn.Image = global::FIS.iDET.Properties.Resources.zoomIn; this.toolStripButtonZoomIn.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonZoomIn.Name = "toolStripButtonZoomIn"; this.toolStripButtonZoomIn.Size = new System.Drawing.Size(28, 28); this.toolStripButtonZoomIn.Text = "toolStripButtonZoomIn"; this.toolStripButtonZoomIn.ToolTipText = "Zoom In"; this.toolStripButtonZoomIn.Click += new System.EventHandler(this.toolStripButtonZoomIn_Click); // // toolStripComboBoxZoomRatio // this.toolStripComboBoxZoomRatio.Enabled = false; this.toolStripComboBoxZoomRatio.Items.AddRange(new object[] { "20%", "40%", "60%", "80%", "100%", "120%", "140%", "160%", "180%", "200%"}); this.toolStripComboBoxZoomRatio.MaxDropDownItems = 7; this.toolStripComboBoxZoomRatio.Name = "toolStripComboBoxZoomRatio"; this.toolStripComboBoxZoomRatio.Size = new System.Drawing.Size(75, 31); this.toolStripComboBoxZoomRatio.SelectedIndexChanged += new System.EventHandler(this.toolStripComboBoxZoomRatio_SelectedIndexChanged); this.toolStripComboBoxZoomRatio.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.toolStripComboBoxZoomRatio_KeyPress); // // toolStripButtonZoomFit // this.toolStripButtonZoomFit.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonZoomFit.Enabled = false; this.toolStripButtonZoomFit.Image = global::FIS.iDET.Properties.Resources.zoomFit; this.toolStripButtonZoomFit.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonZoomFit.Name = "toolStripButtonZoomFit"; this.toolStripButtonZoomFit.Size = new System.Drawing.Size(28, 28); this.toolStripButtonZoomFit.Text = "toolStripButtonZoomFit"; this.toolStripButtonZoomFit.ToolTipText = "Zoom fit"; this.toolStripButtonZoomFit.Click += new System.EventHandler(this.toolStripButtonZoomFit_Click); // // toolStripSeparator8 // this.toolStripSeparator8.Name = "toolStripSeparator8"; this.toolStripSeparator8.Size = new System.Drawing.Size(6, 31); // // comboBoxDateFormat // this.comboBoxDateFormat.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; this.comboBoxDateFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxDateFormat.Enabled = false; this.comboBoxDateFormat.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.comboBoxDateFormat.Items.AddRange(new object[] { "yyyy/MM/dd", "yyyy-MMM-dd", "MM/dd/yyyy", "MMM-dd-yyyy", "dd/MM/yyyy", "dd-MMM-yyyy"}); this.comboBoxDateFormat.Name = "comboBoxDateFormat"; this.comboBoxDateFormat.Size = new System.Drawing.Size(121, 31); this.comboBoxDateFormat.ToolTipText = "Choose date format"; this.comboBoxDateFormat.SelectedIndexChanged += new System.EventHandler(this.comboBoxDateFormat_SelectedIndexChanged); // // toolStripLabel1 // this.toolStripLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; this.toolStripLabel1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.toolStripLabel1.Name = "toolStripLabel1"; this.toolStripLabel1.Size = new System.Drawing.Size(72, 28); this.toolStripLabel1.Text = "Date Format"; // // toolStripLabelFind // this.toolStripLabelFind.Name = "toolStripLabelFind"; this.toolStripLabelFind.Size = new System.Drawing.Size(30, 28); this.toolStripLabelFind.Text = "Find"; // // toolStripTextBoxFind // this.toolStripTextBoxFind.Enabled = false; this.toolStripTextBoxFind.MaxLength = 100; this.toolStripTextBoxFind.Name = "toolStripTextBoxFind"; this.toolStripTextBoxFind.Size = new System.Drawing.Size(150, 31); this.toolStripTextBoxFind.ToolTipText = "What to find"; this.toolStripTextBoxFind.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.toolStripTextBoxFind_KeyPress); // // toolStripButtonFind // this.toolStripButtonFind.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonFind.Enabled = false; this.toolStripButtonFind.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonFind.Image"))); this.toolStripButtonFind.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonFind.Name = "toolStripButtonFind"; this.toolStripButtonFind.Size = new System.Drawing.Size(28, 28); this.toolStripButtonFind.Text = "toolStripButtonFind"; this.toolStripButtonFind.ToolTipText = "Start finding"; this.toolStripButtonFind.Click += new System.EventHandler(this.toolStripButtonFind_Click); // // toolStripButtonFindDirection // this.toolStripButtonFindDirection.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonFindDirection.Enabled = false; this.toolStripButtonFindDirection.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonFindDirection.Image"))); this.toolStripButtonFindDirection.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonFindDirection.Name = "toolStripButtonFindDirection"; this.toolStripButtonFindDirection.Size = new System.Drawing.Size(28, 28); this.toolStripButtonFindDirection.Text = "toolStripButtonFindDirection"; this.toolStripButtonFindDirection.ToolTipText = "Find downward or upward"; this.toolStripButtonFindDirection.Click += new System.EventHandler(this.toolStripButtonFindDirection_Click); // // toolStripSeparator12 // this.toolStripSeparator12.Name = "toolStripSeparator12"; this.toolStripSeparator12.Size = new System.Drawing.Size(6, 31); // // toolStripLabel2 // this.toolStripLabel2.Name = "toolStripLabel2"; this.toolStripLabel2.Size = new System.Drawing.Size(76, 28); this.toolStripLabel2.Text = "Position Spin"; this.toolStripLabel2.Visible = false; // // toolStripComboBoxPosSpin // this.toolStripComboBoxPosSpin.Enabled = false; this.toolStripComboBoxPosSpin.Items.AddRange(new object[] { "1", "5", "10", "20", "50", "100"}); this.toolStripComboBoxPosSpin.Name = "toolStripComboBoxPosSpin"; this.toolStripComboBoxPosSpin.Size = new System.Drawing.Size(75, 31); this.toolStripComboBoxPosSpin.Visible = false; // // toolStripLabel3 // this.toolStripLabel3.Name = "toolStripLabel3"; this.toolStripLabel3.Size = new System.Drawing.Size(19, 28); this.toolStripLabel3.Text = "px"; this.toolStripLabel3.Visible = false; // // toolStripButtonNavigationGuide // this.toolStripButtonNavigationGuide.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonNavigationGuide.Enabled = false; this.toolStripButtonNavigationGuide.Image = global::FIS.iDET.Properties.Resources.balloon; this.toolStripButtonNavigationGuide.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonNavigationGuide.Name = "toolStripButtonNavigationGuide"; this.toolStripButtonNavigationGuide.Size = new System.Drawing.Size(28, 28); this.toolStripButtonNavigationGuide.Text = "Tooltip & navigation"; this.toolStripButtonNavigationGuide.ToolTipText = "Turn navigation guide on or off"; this.toolStripButtonNavigationGuide.Click += new System.EventHandler(this.toolStripButtonNavigationGuide_Click); // // splitContainerApp // this.splitContainerApp.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.splitContainerApp.Location = new System.Drawing.Point(0, 58); this.splitContainerApp.Name = "splitContainerApp"; // // splitContainerApp.Panel1 // this.splitContainerApp.Panel1.Controls.Add(this.panelPictBox); this.splitContainerApp.Panel1MinSize = 500; // // splitContainerApp.Panel2 // this.splitContainerApp.Panel2.Controls.Add(this.dataGridViewInput); this.splitContainerApp.Panel2MinSize = 100; this.splitContainerApp.Size = new System.Drawing.Size(1276, 567); this.splitContainerApp.SplitterDistance = 864; this.splitContainerApp.TabIndex = 12; // // panelPictBox // this.panelPictBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panelPictBox.AutoScroll = true; this.panelPictBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panelPictBox.Controls.Add(this.PictBox); this.panelPictBox.Location = new System.Drawing.Point(3, 3); this.panelPictBox.Name = "panelPictBox"; this.panelPictBox.Size = new System.Drawing.Size(858, 561); this.panelPictBox.TabIndex = 2; // // PictBox // this.PictBox.Cursor = System.Windows.Forms.Cursors.NoMove2D; this.PictBox.Enabled = false; this.PictBox.ErrorImage = ((System.Drawing.Image)(resources.GetObject("PictBox.ErrorImage"))); this.PictBox.InitialImage = ((System.Drawing.Image)(resources.GetObject("PictBox.InitialImage"))); this.PictBox.Location = new System.Drawing.Point(0, 0); this.PictBox.Margin = new System.Windows.Forms.Padding(0); this.PictBox.Name = "PictBox"; this.PictBox.Size = new System.Drawing.Size(700, 400); this.PictBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.PictBox.TabIndex = 0; this.PictBox.TabStop = false; this.PictBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PictBox_MouseDown); this.PictBox.MouseEnter += new System.EventHandler(this.PictBox_MouseEnter); this.PictBox.MouseLeave += new System.EventHandler(this.PictBox_MouseLeave); this.PictBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PictBox_MouseMove); this.PictBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PictBox_MouseUp); // // dataGridViewInput // this.dataGridViewInput.AllowUserToAddRows = false; this.dataGridViewInput.AllowUserToResizeRows = false; this.dataGridViewInput.BorderStyle = System.Windows.Forms.BorderStyle.None; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridViewInput.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; this.dataGridViewInput.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; this.dataGridViewInput.DefaultCellStyle = dataGridViewCellStyle2; this.dataGridViewInput.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridViewInput.Location = new System.Drawing.Point(0, 0); this.dataGridViewInput.Margin = new System.Windows.Forms.Padding(0); this.dataGridViewInput.Name = "dataGridViewInput"; dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle3.Font = new System.Drawing.Font("Arial Narrow", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridViewInput.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; this.dataGridViewInput.RowHeadersWidth = 30; dataGridViewCellStyle4.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle4.NullValue = null; this.dataGridViewInput.RowsDefaultCellStyle = dataGridViewCellStyle4; this.dataGridViewInput.RowTemplate.Height = 24; this.dataGridViewInput.Size = new System.Drawing.Size(408, 567); this.dataGridViewInput.TabIndex = 4; this.dataGridViewInput.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewInput_CellEndEdit); this.dataGridViewInput.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewInput_CellEnter); this.dataGridViewInput.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.dataGridViewInput_CellPainting); this.dataGridViewInput.ColumnAdded += new System.Windows.Forms.DataGridViewColumnEventHandler(this.dataGridViewInput_ColumnAdded); this.dataGridViewInput.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.dataGridViewInput_EditingControlShowing); this.dataGridViewInput.UserDeletedRow += new System.Windows.Forms.DataGridViewRowEventHandler(this.dataGridViewInput_UserDeletedRow); this.dataGridViewInput.KeyUp += new System.Windows.Forms.KeyEventHandler(this.dataGridViewInput_KeyUp); this.dataGridViewInput.MouseEnter += new System.EventHandler(this.dataGridViewInput_MouseEnter); // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 622); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(324, 13); this.label1.TabIndex = 1; this.label1.Text = "Copyright © by FPT Information System, FPT BPO Services Center."; // // toolTipPictBox // this.toolTipPictBox.AutomaticDelay = 0; this.toolTipPictBox.ForeColor = System.Drawing.Color.Crimson; this.toolTipPictBox.OwnerDraw = true; this.toolTipPictBox.Draw += new System.Windows.Forms.DrawToolTipEventHandler(this.toolTipPictBox_Draw); this.toolTipPictBox.Popup += new System.Windows.Forms.PopupEventHandler(this.toolTipPictBox_Popup); // // InputToolForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Control; this.ClientSize = new System.Drawing.Size(1276, 637); this.Controls.Add(this.label1); this.Controls.Add(this.splitContainerApp); this.Controls.Add(this.toolStripApp); this.Controls.Add(this.menuStripApp); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStripApp; this.Name = "InputToolForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = " "; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InputToolForm_FormClosing); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.InputToolForm_FormClosed); this.Load += new System.EventHandler(this.InputToolForm_Load); this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.InputToolForm_MouseWheel); this.menuStripApp.ResumeLayout(false); this.menuStripApp.PerformLayout(); this.toolStripApp.ResumeLayout(false); this.toolStripApp.PerformLayout(); this.splitContainerApp.Panel1.ResumeLayout(false); this.splitContainerApp.Panel2.ResumeLayout(false); this.splitContainerApp.ResumeLayout(false); this.panelPictBox.ResumeLayout(false); this.panelPictBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.PictBox)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridViewInput)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.PictureBox PictBox; private System.Windows.Forms.MenuStrip menuStripApp; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem loadImageToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem loadExcelFileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem saveDataToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; private System.Windows.Forms.ToolStripMenuItem saveDataAsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem newExcelFileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem goToPageToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem findToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem helpsubToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem zoomInToolStripMenuItem; private System.Windows.Forms.Timer timerAutosave; private System.Windows.Forms.ToolStrip toolStripApp; private System.Windows.Forms.ToolStripButton toolStripButtonLoadImage; private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; private System.Windows.Forms.ToolStripButton toolStripButtonNewData; private System.Windows.Forms.ToolStripButton toolStripButtonSaveData; private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; private System.Windows.Forms.ToolStripTextBox toolStripTextBoxPageNumber; private System.Windows.Forms.ToolStripLabel toolStripLabelPage; private System.Windows.Forms.ToolStripMenuItem zoomOutToolStripMenuItem; private System.Windows.Forms.ToolStripButton toolStripButtonPreviousPage; private System.Windows.Forms.ToolStripButton toolStripButtonNextPage; private System.Windows.Forms.ToolStripSeparator toolStripSeparator7; private System.Windows.Forms.ToolStripButton toolStripButtonZoomOut; private System.Windows.Forms.ToolStripButton toolStripButtonZoomIn; private System.Windows.Forms.ToolStripComboBox toolStripComboBoxZoomRatio; private System.Windows.Forms.SplitContainer splitContainerApp; private System.Windows.Forms.DataGridView dataGridViewInput; private System.Windows.Forms.ToolStripSeparator toolStripSeparator8; private System.Windows.Forms.ToolStripComboBox comboBoxDateFormat; private System.Windows.Forms.ToolStripLabel toolStripLabel1; private System.Windows.Forms.ToolStripLabel toolStripLabelFind; private System.Windows.Forms.ToolStripTextBox toolStripTextBoxFind; private System.Windows.Forms.ToolStripButton toolStripButtonFind; private System.Windows.Forms.ToolStripButton toolStripButtonFindDirection; private System.Windows.Forms.Label label1; private System.Windows.Forms.ToolStripButton toolStripOpenExcelFileButton; private System.Windows.Forms.ToolStripMenuItem zoomIn2ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem zoomOut2ToolStripMenuItem; private System.Windows.Forms.ToolStripButton toolStripButtonLoadTemplate; private System.Windows.Forms.ToolStripMenuItem toolToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem compareToolToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator9; private System.Windows.Forms.ToolStripMenuItem moveTooltipLeftToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem moveTooltipRightToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem moveTooltipUpToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem moveTooltipDownToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem increaseTooltipHeightToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem increaseTooltipWidthToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem decreaseTooltipHeightToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem decreaseTooltipWidthToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator10; private System.Windows.Forms.ToolTip toolTipPictBox; private System.Windows.Forms.Panel panelPictBox; private System.Windows.Forms.ToolStripButton toolStripButtonZoomFit; private System.Windows.Forms.ToolStripMenuItem navigationToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator11; private System.Windows.Forms.ToolStripMenuItem zoomFitToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator12; private System.Windows.Forms.ToolStripButton toolStripButtonNavigationGuide; private System.Windows.Forms.ToolStripLabel toolStripLabel2; private System.Windows.Forms.ToolStripComboBox toolStripComboBoxPosSpin; private System.Windows.Forms.ToolStripLabel toolStripLabel3; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem toolStripInsertNewRow; private System.Windows.Forms.ToolStripMenuItem deleteRowsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem toolStripInsertNewRows; } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/InputToolForm.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
75,272
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.Win32; using System.Text.RegularExpressions; namespace FIS.iDET { public partial class LicenseKeyForm : Form { public LicenseKeyForm() { InitializeComponent(); } private void LicenseKeyForm_Load(object sender, EventArgs e) { textBoxMachineID.Text = LicenseService.GetMachineID(); } private void buttonExit_Click(object sender, EventArgs e) { Application.ExitThread(); } private void buttonActivate_Click(object sender, EventArgs e) { string serialToCheck = textBoxLicenseKey.Text.Trim().ToUpper(); if (LicenseService.IsSerialNumberCorrect(serialToCheck)) { // activation succeeds // informs user MessageBox.Show("Activation succeeds! Application will now close, please re-open application to start using it.", "Activation succeeds", MessageBoxButtons.OK, MessageBoxIcon.Information); // add valid serial number to registry RegistryService.SetValue(GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY, serialToCheck); // add user name to registry RegistryService.SetValue(GlobalConstants.REGISTRY_USER_NAME, textBoxUserName.Text); // exit app to finish activation Application.ExitThread(); } else { // activation fails MessageBox.Show("Wrong serial number!", "Activation fails", MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxLicenseKey.Focus(); } } private void textBoxLicenseKey_TextChanged(object sender, EventArgs e) { // check if serial number form is valid string serial = textBoxLicenseKey.Text.Trim().ToUpper(); Match match = Regex.Match( serial, @"[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}" ); // change activate button status due to validation of user input's serial number labelActivate.Enabled = match.Success; } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/LicenseKeyForm.cs
C#
Microsoft Reciprocal License (Ms-RL)
2,601
namespace FIS.iDET { partial class LicenseKeyForm { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LicenseKeyForm)); this.label1 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.textBoxLicenseKey = new System.Windows.Forms.TextBox(); this.textBoxMachineID = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.labelActivate = new System.Windows.Forms.Label(); this.labelExit = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.textBoxUserName = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Arial", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(7)))), ((int)(((byte)(101))))); this.label1.Location = new System.Drawing.Point(32, 20); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(568, 29); this.label1.TabIndex = 0; this.label1.Text = "Application is not activated for this machine yet!"; // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(59)))), ((int)(((byte)(74))))); this.label3.Location = new System.Drawing.Point(35, 64); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(133, 19); this.label3.TabIndex = 0; this.label3.Text = "Your machine ID"; // // textBoxLicenseKey // this.textBoxLicenseKey.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.textBoxLicenseKey.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxLicenseKey.Location = new System.Drawing.Point(37, 220); this.textBoxLicenseKey.MaxLength = 39; this.textBoxLicenseKey.Name = "textBoxLicenseKey"; this.textBoxLicenseKey.Size = new System.Drawing.Size(626, 29); this.textBoxLicenseKey.TabIndex = 2; this.textBoxLicenseKey.TextChanged += new System.EventHandler(this.textBoxLicenseKey_TextChanged); // // textBoxMachineID // this.textBoxMachineID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.textBoxMachineID.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxMachineID.Location = new System.Drawing.Point(37, 86); this.textBoxMachineID.MaxLength = 39; this.textBoxMachineID.Name = "textBoxMachineID"; this.textBoxMachineID.ReadOnly = true; this.textBoxMachineID.Size = new System.Drawing.Size(626, 29); this.textBoxMachineID.TabIndex = 3; // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(59)))), ((int)(((byte)(74))))); this.label2.Location = new System.Drawing.Point(33, 198); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(289, 19); this.label2.TabIndex = 0; this.label2.Text = "Serial Number (from IT administrator)"; // // labelActivate // this.labelActivate.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(8)))), ((int)(((byte)(96)))), ((int)(((byte)(76))))); this.labelActivate.Enabled = false; this.labelActivate.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelActivate.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(163)))), ((int)(((byte)(223)))), ((int)(((byte)(47))))); this.labelActivate.Location = new System.Drawing.Point(158, 267); this.labelActivate.Name = "labelActivate"; this.labelActivate.Size = new System.Drawing.Size(121, 37); this.labelActivate.TabIndex = 4; this.labelActivate.Text = "Activate"; this.labelActivate.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.labelActivate.Click += new System.EventHandler(this.buttonActivate_Click); // // labelExit // this.labelExit.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(36)))), ((int)(((byte)(46)))), ((int)(((byte)(63))))); this.labelExit.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelExit.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(167)))), ((int)(((byte)(173)))), ((int)(((byte)(184))))); this.labelExit.Location = new System.Drawing.Point(408, 267); this.labelExit.Name = "labelExit"; this.labelExit.Size = new System.Drawing.Size(121, 37); this.labelExit.TabIndex = 4; this.labelExit.Text = "Exit"; this.labelExit.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.labelExit.Click += new System.EventHandler(this.buttonExit_Click); // // label6 // this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(59)))), ((int)(((byte)(74))))); this.label6.Location = new System.Drawing.Point(33, 131); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(117, 19); this.label6.TabIndex = 0; this.label6.Text = "Your full name"; // // textBoxUserName // this.textBoxUserName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.textBoxUserName.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxUserName.Location = new System.Drawing.Point(37, 153); this.textBoxUserName.MaxLength = 50; this.textBoxUserName.Name = "textBoxUserName"; this.textBoxUserName.Size = new System.Drawing.Size(626, 29); this.textBoxUserName.TabIndex = 2; // // LicenseKeyForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(118)))), ((int)(((byte)(164)))), ((int)(((byte)(200))))); this.ClientSize = new System.Drawing.Size(703, 323); this.Controls.Add(this.labelExit); this.Controls.Add(this.labelActivate); this.Controls.Add(this.textBoxMachineID); this.Controls.Add(this.textBoxUserName); this.Controls.Add(this.label6); this.Controls.Add(this.textBoxLicenseKey); this.Controls.Add(this.label2); this.Controls.Add(this.label3); this.Controls.Add(this.label1); this.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "LicenseKeyForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "FIS.iDET Registration"; this.Load += new System.EventHandler(this.LicenseKeyForm_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox textBoxLicenseKey; private System.Windows.Forms.TextBox textBoxMachineID; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label labelActivate; private System.Windows.Forms.Label labelExit; private System.Windows.Forms.Label label6; private System.Windows.Forms.TextBox textBoxUserName; } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/LicenseKeyForm.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
10,579
using System; using System.Collections.Generic; using System.Text; using System.Management; using System.Security.Cryptography; using System.Security; using System.Collections; using System.Diagnostics; namespace FIS.iDET { /// <summary> /// Generates a 16 byte Unique Identification code of a computer /// Example: 1234-8DB5-5763-69D3-FE52-8CF7-395D-2EA9 /// </summary> public class LicenseService { private static string MachineID = null; private static string ValidSerial = null; public static Boolean AppIsActivated() { string serialToCheck = RegistryService.GetValue(GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY); return IsSerialNumberCorrect(serialToCheck); } /// <summary> /// gets the unique ID of current machine /// </summary> public static string GetMachineID() { // calculate machine ID for first time if (MachineID == null) { MachineID = GetHash( "CPU >> " + cpuId() + "\nBIOS >> " + biosId() //"\nBASE >> " + baseId() + //"\nDISK >> "+ diskId() + //"\nVIDEO >> " + videoId() + //"\nMAC >> " + macId() ); } return MachineID; } /// <summary> /// calculate serial number for a machine ID /// </summary> /// <param name="machineID"></param> /// <returns></returns> public static string GenerateSerialNumberFrom(string anyMachineID) { String serial = GetHash( "ID >> " + anyMachineID + "Secret >> " + GlobalConstants.SERIAL_SECRET_KEY ); return serial; } public static Boolean IsSerialNumberCorrect(string serialToCheck) { if (String.IsNullOrEmpty(serialToCheck)) return false; // normalize input serial serialToCheck = serialToCheck.Trim().ToUpper(); // calculate valid serial if needed if (ValidSerial == null) { if (MachineID == null) { GetMachineID(); } ValidSerial = GenerateSerialNumberFrom(MachineID); } return serialToCheck == ValidSerial; } /// <summary> /// generate 16-byte hash of a string /// </summary> /// <param name="s">input string</param> /// <returns>16-byte hash string</returns> private static string GetHash(string s) { MD5 sec = new MD5CryptoServiceProvider(); ASCIIEncoding enc = new ASCIIEncoding(); byte[] bt = enc.GetBytes(s); return GetHexString(sec.ComputeHash(bt)); } /// <summary> /// intended to be used by GetHash() /// </summary> /// <param name="bt">input string</param> /// <returns>hex string</returns> private static string GetHexString(byte[] bt) { string s = string.Empty; for (int i = 0; i < bt.Length; i++) { byte b = bt[i]; int n, n1, n2; n = (int)b; n1 = n & 15; n2 = (n >> 4) & 15; if (n2 > 9) s += ((char)(n2 - 10 + (int)'A')).ToString(); else s += n2.ToString(); if (n1 > 9) s += ((char)(n1 - 10 + (int)'A')).ToString(); else s += n1.ToString(); if ((i + 1) != bt.Length && (i + 1) % 2 == 0) s += "-"; } return s; } #region Original Device ID Getting Code //Return a hardware identifier private static string identifier(string wmiClass, string wmiProperty, string wmiMustBeTrue) { string result = ""; System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass); System.Management.ManagementObjectCollection moc = mc.GetInstances(); foreach (System.Management.ManagementObject mo in moc) { if (mo[wmiMustBeTrue].ToString() == "True") { //Only get the first one if (result == "") { try { result = mo[wmiProperty].ToString(); break; } catch { } } } } return result; } //Return a hardware identifier private static string identifier(string wmiClass, string wmiProperty) { string result = ""; System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass); System.Management.ManagementObjectCollection moc = mc.GetInstances(); foreach (System.Management.ManagementObject mo in moc) { //Only get the first one if (result == "") { try { if (mo[wmiProperty]!=null) result = mo[wmiProperty].ToString(); break; } catch { } } } return result; } private static string cpuId() { //Uses first CPU identifier available in order of preference //Don't get all identifiers, as it is very time consuming string retVal = identifier("Win32_Processor", "UniqueId"); if (retVal == "") //If no UniqueID, use ProcessorID { retVal = identifier("Win32_Processor", "ProcessorId"); if (retVal == "") //If no ProcessorId, use Name { retVal = identifier("Win32_Processor", "Name"); if (retVal == "") //If no Name, use Manufacturer { retVal = identifier("Win32_Processor", "Manufacturer"); } //Add clock speed for extra security retVal += identifier("Win32_Processor", "MaxClockSpeed"); } } return retVal; } //BIOS Identifier private static string biosId() { return identifier("Win32_BIOS", "Manufacturer") + identifier("Win32_BIOS", "SMBIOSBIOSVersion") + identifier("Win32_BIOS", "IdentificationCode") + identifier("Win32_BIOS", "SerialNumber") + identifier("Win32_BIOS", "ReleaseDate") + identifier("Win32_BIOS", "Version"); } //Main physical hard drive ID private static string diskId() { return identifier("Win32_DiskDrive", "Model") + identifier("Win32_DiskDrive", "Manufacturer") + identifier("Win32_DiskDrive", "Signature") + identifier("Win32_DiskDrive", "TotalHeads"); } //Motherboard ID private static string baseId() { return identifier("Win32_BaseBoard", "Model") + identifier("Win32_BaseBoard", "Manufacturer") + identifier("Win32_BaseBoard", "Name") + identifier("Win32_BaseBoard", "SerialNumber"); } //Primary video controller ID private static string videoId() { return identifier("Win32_VideoController", "DriverVersion") + identifier("Win32_VideoController", "Name"); } //First enabled network card ID private static string macId() { return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled"); } #endregion } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/LicenseService.cs
C#
Microsoft Reciprocal License (Ms-RL)
8,569
using System; using System.Collections.Generic; using System.Text; namespace FIS.iDET { public enum CompareMode { COMPARE=1, DISPLAY=2, NONE=3 }; public enum FileSource { FILE1=1, FILE2=2 } public class ColumnCompareInfo { public CompareMode mode = CompareMode.COMPARE; public FileSource source = FileSource.FILE1; public string fieldName=""; public int column = 0; } public class PageCompareInfo { public List<ColumnCompareInfo> listColumnCompare = new List<ColumnCompareInfo>(); public int pageID = 0; public int startRow = 0, endRow = 0; } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/PageCompareInfo.cs
C#
Microsoft Reciprocal License (Ms-RL)
738
using System; using System.Collections.Generic; using System.Windows.Forms; using System.Threading; namespace FIS.iDET { static class Program { // Setup a unique Name for your Application static Mutex mutex = new Mutex(true, "{8C6524D3-7CC9-4148-80AE-FEEA035FFE01}"); /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { if (GlobalConstants.IsTri && DateTime.Now.CompareTo(GlobalConstants.ExpDate) > 0) { MessageBox.Show("Date_Time_Problem, contact Developer"); return; } if (mutex.WaitOne(TimeSpan.Zero, true)) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new InputToolForm()); mutex.ReleaseMutex(); } else { MessageBox.Show("The application is running already!", "Warning",MessageBoxButtons.OK,MessageBoxIcon.Error); } } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/Program.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,192
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("FIS.iDET")] [assembly: AssemblyDescription("FPT BPO Data Entry Tool")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Developed by Revo21 Studio <hoang@revo21studio.com>")] [assembly: AssemblyProduct("FPT BPO Data Entry Tool")] [assembly: AssemblyCopyright("Copyright © 2013 by FPT BPO")] [assembly: AssemblyTrademark("FPT BPO")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("b24471ac-d3ae-47a4-abec-aed4512580c0")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.1.1.0")] [assembly: AssemblyFileVersion("2.1.1.0")]
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/Properties/AssemblyInfo.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,534
using System; using System.Collections.Generic; using System.Text; using Microsoft.Win32; using System.Windows.Forms; namespace FIS.iDET { public class RegistryService { private static RegistryKey appRegistryKey = Registry.CurrentUser.OpenSubKey(GlobalConstants.REGISTRY_PATH, true); private static RegistryKey appRegistryLicenseKey = Registry.LocalMachine.OpenSubKey(GlobalConstants.REGISTRY_PATH, false); public static void Init() { // in case key does not exist if (appRegistryKey == null) { // create new one Registry.CurrentUser.CreateSubKey(GlobalConstants.REGISTRY_PATH); appRegistryKey = Registry.CurrentUser.OpenSubKey(GlobalConstants.REGISTRY_PATH, true); } try { if (appRegistryLicenseKey == null) { Registry.LocalMachine.CreateSubKey(GlobalConstants.REGISTRY_PATH); appRegistryLicenseKey = Registry.LocalMachine.OpenSubKey(GlobalConstants.REGISTRY_PATH, true); } } catch { MessageBox.Show("Your application hasn't been activated. Please run under administrative rights to active it!","Administrator Request",MessageBoxButtons.OK,MessageBoxIcon.Stop); Application.Exit(); } } /// <summary> /// gets application registry value from a key /// </summary> /// <param name="name">key name</param> /// <returns>key's value</returns> public static string GetValue(string name) { try { if (name == GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY || name == GlobalConstants.REGISTRY_USER_NAME) return appRegistryLicenseKey.GetValue(name) as string; else return appRegistryKey.GetValue(name) as string; } catch (Exception ex) { MessageBox.Show("Error while reading from registry key \"" + appRegistryKey.ToString() + "\": " + ex.Message); return null; } } /// <summary> /// set application registry value to a key /// </summary> /// <param name="name">key name</param> /// <param name="value">new value to set to key</param> public static void SetValue(string name, string value) { try { if (name == GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY || name == GlobalConstants.REGISTRY_USER_NAME) { //grant write permisson appRegistryLicenseKey = Registry.LocalMachine.OpenSubKey(GlobalConstants.REGISTRY_PATH, true); appRegistryLicenseKey.SetValue(name, value); appRegistryLicenseKey.Flush(); } else { appRegistryKey.SetValue(name, value); appRegistryKey.Flush(); } } catch { MessageBox.Show("Error while writing to registry key. Please call IT for support.", "Administrative Rights Needed",MessageBoxButtons.OK,MessageBoxIcon.Warning); } } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/RegistryService.cs
C#
Microsoft Reciprocal License (Ms-RL)
3,500
using System; using System.Collections.Generic; using System.Xml; using System.IO; using System.Text; using System.Windows.Forms; namespace FIS.iDET { class XmlService { public static void ExportAddressNumber(string stringInput, out int col, out int row) { col = 0; row = 0; //foreach (char c in stringInput) int baseNumber = 0; string s1 = ""; if (stringInput != "") { while (stringInput[0] >= 'A' && stringInput[0] <= 'Z') { s1 = s1 + stringInput[0]; stringInput = stringInput.Remove(0, 1); } // Process col value while (s1.Length > 0) { col = col + ((int)s1[s1.Length - 1] - 64) * (int)Math.Pow(26, baseNumber); s1 = s1.Remove(s1.Length - 1, 1); baseNumber++; } // row value row = Convert.ToInt32(stringInput); } return; } public static void CalculateAddressNumber(string stringAdress, out int col, out int row1, out int row2) { col = 0; row1 = 0; row2 = 0; int temp = 0; stringAdress = stringAdress.Trim(); char[] delimiter = { ' ' }; string[] pieces = stringAdress.Split(delimiter, 2, StringSplitOptions.None); pieces[0] = pieces[0].Trim(); if (pieces.Length > 1) pieces[1] = pieces[1].Trim(); // first is 1st Cell ExportAddressNumber(pieces[0], out col, out row1); // second is 2nd Cell if (pieces.Length > 1) ExportAddressNumber(pieces[1], out temp, out row2); return; } public static void CalculateColNumber(string s, out int col) { int baseNumber = 0; col = 0; if (s != "") { // Process col value s = s.ToUpper(); while (s.Length > 0) { col = col + ((int)s[s.Length - 1] - 64) * (int)Math.Pow(26, baseNumber); s = s.Remove(s.Length - 1, 1); baseNumber++; } } } public static List<int> ConvertToPageNumbers(string s) { List<int> result = new List<int>(); char[] delimiter = { ',' }; string[] parts = s.Split(delimiter, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < parts.Length; i++) { int num = 0; if (Int32.TryParse(parts[i], out num)) { result.Add(num); } else MessageBox.Show("Please check again !\nWrong in identify page number:" + parts[i].ToString()); } return result; } public static List<DataColumn> ReadPageCompareXML(string fromFile, out PageCompareInfo pageAll, out List<PageCompareInfo> listPages) { pageAll = new PageCompareInfo(); listPages = new List<PageCompareInfo>(); try { FileStream fs = new FileStream(fromFile, FileMode.Open,FileAccess.Read, FileShare.ReadWrite); XmlDocument r = new XmlDocument(); r.Load(fs); // array to store field data List<DataColumn> columns = new List<DataColumn>(); // PAGEALL NODE XmlNode pageAllNode = r.SelectSingleNode("//form/pageall"); // Read Start Row & End Row Int32.TryParse(pageAllNode.Attributes["startrow"].InnerText, out pageAll.startRow); if (pageAllNode.Attributes["endrow"] != null) Int32.TryParse(pageAllNode.Attributes["endrow"].InnerText, out pageAll.endRow); else pageAll.endRow = 0; for (int i = 0; i < pageAllNode.ChildNodes.Count; i++) { // Create new ColumnCompareInfo ColumnCompareInfo colCompare = new ColumnCompareInfo(); // MODE // add an column to file result ! if (pageAllNode.ChildNodes[i].Attributes["mode"] == null) { colCompare.fieldName = pageAllNode.ChildNodes[i].Attributes["fieldname"].InnerText; colCompare.mode = CompareMode.NONE; pageAll.listColumnCompare.Add(colCompare); columns.Add(new DataColumn(pageAllNode.ChildNodes[i].Attributes["fieldname"].InnerText)); continue; } if (pageAllNode.ChildNodes[i].Attributes["mode"].InnerText == "compare") { // Add value to colCompare.mode = CompareMode.COMPARE; } else { colCompare.mode = CompareMode.DISPLAY; if (pageAllNode.ChildNodes[i].Attributes["source"].InnerText == "file1") colCompare.source = FileSource.FILE1; else colCompare.source = FileSource.FILE2; } // FieldName colCompare.fieldName = pageAllNode.ChildNodes[i].Attributes["fieldname"].InnerText; // column CalculateColNumber(pageAllNode.ChildNodes[i].Attributes["colname"].InnerText.Trim(), out colCompare.column); // identify maxcolumn of excel data to read into memory if (colCompare.column > GlobalVariables.lastColumn) GlobalVariables.lastColumn = colCompare.column; // CalculateAddressNumber(pageAllNode.ChildNodes[i].InnerText, out colCompare.column, out colCompare.startRow, out colCompare.endRow); // Add columnInfo to page All pageAll.listColumnCompare.Add(colCompare); // Add field to GridView columns.Add(new DataColumn(pageAllNode.ChildNodes[i].Attributes["fieldname"].InnerText)); } // Process OTHER PAGE NODES XmlNodeList pagesNode = r.GetElementsByTagName("page"); // Process all page nodes for (int i = 0; i < pagesNode.Count; i++) { List<int> pageNumbers = new List<int>(ConvertToPageNumbers(pagesNode[i].Attributes["number"].InnerText)); for (int m = 0; m < pageNumbers.Count; m++) { PageCompareInfo page = new PageCompareInfo(); page.pageID = pageNumbers[m]; // Assign Start row & End row to page Int32.TryParse(pagesNode[i].Attributes["startrow"].InnerText, out page.startRow); if (pagesNode[i].Attributes["endrow"] != null) { Int32.TryParse(pagesNode[i].Attributes["endrow"].InnerText, out page.endRow); } else page.endRow = 0; // Process per page for (int j = 0; j < pagesNode[i].ChildNodes.Count; j++) { // Create new ColumnCompareInfo ColumnCompareInfo colCompare = new ColumnCompareInfo(); // identify Mode if (pagesNode[i].ChildNodes[j].Attributes["mode"] == null) { colCompare.fieldName = pagesNode[i].ChildNodes[i].Attributes["fieldname"].InnerText; colCompare.mode = CompareMode.NONE; page.listColumnCompare.Add(colCompare); continue; } if (pagesNode[i].ChildNodes[j].Attributes["mode"].InnerText == "compare") { // Add value to colCompare.mode = CompareMode.COMPARE; } else { colCompare.mode = CompareMode.DISPLAY; if (pagesNode[i].ChildNodes[j].Attributes["source"].InnerText == "file1") colCompare.source = FileSource.FILE1; else colCompare.source = FileSource.FILE2; } // Field name colCompare.fieldName = pagesNode[i].ChildNodes[j].Attributes["fieldname"].InnerText; // Column CalculateColNumber(pagesNode[i].ChildNodes[j].Attributes["colname"].InnerText.Trim(), out colCompare.column); // identify maxcolumn of excel data to read into memory if (colCompare.column > GlobalVariables.lastColumn) GlobalVariables.lastColumn = colCompare.column; //CalculateAddressNumber(pagesNode[i].ChildNodes[j].InnerText, out colCompare.column, out colCompare.startRow, out colCompare.endRow); // Add column to pages page.listColumnCompare.Add(colCompare); } listPages.Add(page); } } // process charsRemove Node XmlNode charsRemoveNode = r.SelectSingleNode("//form/remove"); if (charsRemoveNode != null) GlobalVariables.charsRemove = charsRemoveNode.Attributes["chars"].Value.ToString(); // Upgrade: Remove attribute moved to form tag XmlNode formNode = r.SelectSingleNode("//form"); if (formNode.Attributes["removecharacters"] != null) { GlobalVariables.charsRemove = formNode.Attributes["removecharacters"].InnerText.ToString(); } fs.Close(); return columns; } catch (Exception ex) { MessageBox.Show("Unexpected error while loading template file \"" + fromFile + "\"\nError details: " + ex.Message); return null; } } public static bool ReadXml(string fromFile) { try { FileStream fs = new FileStream(fromFile, FileMode.Open); XmlTextReader r = new XmlTextReader(fs); // get root node //r.Read(); // <?xml version="1.0" encoding="utf-8"?> while (r.Read()) { if (r.NodeType == XmlNodeType.Element && r.Name == "template") { // set template properties to global vars //GlobalConstants.TemplateName = r.GetAttribute("name"); GlobalConstants.TemplateZoom = Convert.ToDouble(r.GetAttribute("zoom")) / 100; GlobalConstants.TemplateVersion = r.GetAttribute("version"); GlobalConstants.TemplatePageCol = Convert.ToInt32(r.GetAttribute("pagecol")); break; } } // array to store processed data List<DataColumn> columns = new List<DataColumn>(); GlobalConstants.ColumnsOriginalRects = new List<DoubleRectangle>(); // read column nodes while (r.Read()) { // get header text from current node's name if (r.NodeType == XmlNodeType.Element && r.Name == "col") { double x = Convert.ToDouble(r.GetAttribute("x")); double y = Convert.ToDouble(r.GetAttribute("y")); double w = Convert.ToDouble(r.GetAttribute("w")); double h = Convert.ToDouble(r.GetAttribute("h")); columns.Add( new DataColumn( r.GetAttribute("fieldname"), Convert.ToInt32(r.GetAttribute("datatype")), Convert.ToInt32(r.GetAttribute("colwidth")), x, y, w, h)); GlobalConstants.ColumnsOriginalRects.Add(new DoubleRectangle(x, y, w, h)); } // no need to read for text node since we use none of these in our template /* else if (r.NodeType == XmlNodeType.Text) { Console.WriteLine("\tVALUE: " + r.Value); } */ } // set template's columns info to global vars GlobalConstants.Columns = columns; fs.Close(); return true; } catch (Exception ex) { MessageBox.Show("Unexpected error while loading template file \"" + fromFile + "\"\nError details: " + ex.Message); return false; } } public static string getDataTypeShortNameOf(string longName) { if (longName == "Date Time") return DataTypeEnum.COLUMN_TYPE_DATE.ToString(); else if (longName == "Number") return DataTypeEnum.COLUMN_TYPE_NUMBER.ToString(); else return DataTypeEnum.COLUMN_TYPE_TEXT.ToString(); } public static string getDataTypeLongNameOf(int shortName) { switch (shortName) { case DataTypeEnum.COLUMN_TYPE_DATE: return "Date Time"; case DataTypeEnum.COLUMN_TYPE_NUMBER: return "Number"; default: return "General Text"; } } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/XmlService.cs
C#
Microsoft Reciprocal License (Ms-RL)
15,396
<?PHP /* $Id$ */ # This file is part of Chatty :) # Copyright (C) 2003, 2004, 2005 Marco Olivo # # Chatty :) is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. include("config.inc.php"); include("connect.inc.php"); include("utils.inc.php"); include("lang.inc.php"); /* html code for the chat */ function chat() { global $username, $password; global $chat_title; $password = md5($password); $username = urlencode($username); echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\r\n"; echo "<HTML>\r\n"; echo "<HEAD>\r\n"; echo "<LINK REL=\"stylesheet\" HREF=\"style.css.php\" TYPE=\"text/css\">\r\n"; echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=iso-8859-1\">\r\n"; echo "<TITLE>$chat_title Chat!</TITLE>\r\n"; echo "</HEAD>\r\n\r\n"; echo "<FRAMESET ROWS=\"*,80\" COLS=\"*,150\" FRAMESPACING=\"0\" FRAMEBORDER=\"0\" BORDER=\"0\">\r\n"; echo "<FRAME NAME=\"talk\" NORESIZE SRC=\"talk.php?username=$username&password=$password\" MARGINWIDTH=\"12\" MARGINHEIGHT=\"12\">\r\n"; echo "<FRAME NAME=\"users\" SCROLLING=\"no\" NORESIZE SRC=\"users.php?username=$username&password=$password\" MARGINWIDTH=\"12\" MARGINHEIGHT=\"12\">\r\n"; /* pick a random color for the current user */ $color = random(9); echo "<FRAME NAME=\"your_msg\" SCROLLING=\"no\" NORESIZE SRC=\"sendmsg.php?color=$color&username=$username&password=$password\" MARGINWIDTH=\"12\" MARGINHEIGHT=\"12\">\r\n"; echo "<FRAME SRC=\"logo.php\" MARGINWIDTH=\"0\" MARGINHEIGHT=\"0\" FRAMEBORDER=\"0\" SCROLLING=\"no\">\r\n"; echo "<NOFRAMES>\r\n"; echo "<BODY>\r\n"; echo "Your browser doesn't support frames. Sorry :-(\r\n"; echo "</BODY>\r\n"; echo "</NOFRAMES>\r\n"; echo "</FRAMESET>\r\n"; echo "</HTML>\r\n"; } header("Expires: Sun, 28 Dec 1997 09:32:45 GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); /* is this the first enter on this page? */ $first_enter = !isset($username) && !isset($password); $failed_data = false; /* routine-checks */ if (!isset($username)) { $username = ""; } if (!isset($password)) { $password = ""; } if (!isset($email)) { $email = ""; } /* security checks */ $username = htmlentities(urldecode(mysql_real_escape_string($username)), ENT_QUOTES); $password = mysql_real_escape_string(stripslashes($password)); /* ok, let's see if the user can log in */ if (!$first_enter && !$failed_data) { if ($username == "") { $first_enter = true; } else if ($password == "") { $failed_data = true; } else if (isset($enter)) { /* user seems to be registered: mmhh, is that true? */ $query = "SELECT * FROM users WHERE username = '$username' AND password = '" . md5("$password") . "'"; $result = do_the_query($chat_db, $query); if (mysql_num_rows($result) != 0) { /* login ok! */ $failed_data = false; /* register the successful login */ $query = "UPDATE users SET active = 'y', sent_on = DATE_ADD(NOW(), INTERVAL $diff_timezone HOUR) WHERE username = '$username'"; do_the_query($chat_db, $query); /* we warn the other users of the chat */ $query = "INSERT INTO msg(username, msg, color, sent_on) VALUES ('', '$username', '', DATE_ADD(NOW(), INTERVAL $diff_timezone HOUR))"; do_the_query($chat_db, $query); } else { $failed_data = true; } mysql_free_result($result); } else if (isset($subscribe)) { $query = "SELECT * FROM users WHERE username = '$username'"; $result = do_the_query($chat_db, $query); if (mysql_num_rows($result) != 0 || $email == "") { /* wrong registration: the email is empty or there is another user registered with that nickname */ $failed_data = true; mysql_free_result($result); } else { $failed_data = false; /* register the new user */ $query = "REPLACE INTO users (username, password, email, active, sent_on) VALUES ('$username', '" . md5("$password") . "', '$email', 'y', DATE_ADD(NOW(), INTERVAL $diff_timezone HOUR))"; do_the_query($chat_db, $query); /* we warn the other users of the chat */ $query = "INSERT INTO msg(username, msg, color, sent_on) VALUES ('', '$username', '', DATE_ADD(NOW(), INTERVAL $diff_timezone HOUR))"; do_the_query($chat_db, $query); /* send a welcome message */ $msg = "Dear user,\r\nwelcome in our chat.\r\nHere is the data you entered:\r\n\r\nusername: " . stripslashes($username) . "\r\npassword: $password\r\n\r\nI hope to see you soon in our chat.\r\nBye!\r\n\r\n"; mail($email, "Welcome!", $msg, "From: $mail_address\r\n"); mysql_free_result($result); } } } if (!$first_enter && !$failed_data) { /* everything is ok: let's enter the chat! */ chat(); exit; } echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\r\n"; echo "<HTML>\r\n"; echo "<HEAD>\r\n"; echo "<LINK REL=\"stylesheet\" HREF=\"style.css.php\" TYPE=\"text/css\">\r\n"; echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=iso-8859-1\">\r\n"; echo "<TITLE>$lang[register_title]</TITLE>\r\n"; echo "</HEAD>\r\n\r\n"; echo "<BODY>\r\n"; echo "\r\n"; echo "<!--begin login table-->\r\n"; echo "<DIV CLASS=\"center\"><TABLE BORDER=\"0\" BGCOLOR=\"$index_table_bgcolor\" CELLSPACING=\"0\" CELLPADDING=\"10\" WIDTH=\"65%\">\r\n"; echo "<TR>\r\n"; echo "<TD COLSPAN=\"2\" VALIGN=\"top\">\r\n"; echo "<DIV CLASS=\"center\"><TABLE BORDER=\"0\" BGCOLOR=\"$index_header_bgcolor\" WIDTH=\"95%\" CELLSPACING=\"0\" CELLPADDING=\"3\">\r\n"; echo "<TD WIDTH=\"50%\" VALIGN=\"top\" CLASS=\"center\">\r\n"; echo "<SPAN CLASS=\"bigwhite\">$lang[new_user]</SPAN>\r\n"; echo "</TD>\r\n"; echo "<TD WIDTH=\"50%\" VALIGN=\"top\" CLASS=\"center\">\r\n"; echo "<SPAN CLASS=\"bigwhite\">$lang[existing_user]</SPAN>\r\n"; echo "</TD>\r\n"; echo "</TR>\r\n"; echo "</TABLE></DIV>\r\n"; echo "</TD>\r\n"; echo "</TR>\r\n"; echo "<TR>\r\n"; echo "<TD WIDTH=\"50%\" VALIGN=\"top\">\r\n"; if ($failed_data && isset($subscribe)) { if ($email == "") { echo "<SPAN CLASS=\"highlight\"><B>$lang[email_reason]</B></SPAN><BR>&nbsp;<BR>\r\n"; } else if ($password == "") { echo "<SPAN CLASS=\"highlight\"><B>$lang[pass_reason]</B></SPAN><BR>&nbsp;<BR>\r\n"; } else /*if ($username == "")*/ { echo "<SPAN CLASS=\"highlight\"><B>$lang[dup_user]</B><BR>Thanks.</SPAN><BR>&nbsp;<BR>\r\n"; } } else { echo "$lang[new_user_instructions] <BR>&nbsp;<BR>\r\n"; } echo "</TD>\r\n"; echo "<TD WIDTH=\"50%\" VALIGN=\"top\">\r\n"; if ($failed_data && isset($enter)) { echo "<SPAN CLASS=\"highlight\"><B>$lang[wrong_login]</B></SPAN><BR>&nbsp;<BR>\r\n"; } else { echo "$lang[existing_user_instructions]<BR>&nbsp;<BR>\r\n"; } echo "</TD>\r\n"; echo "</TR>\r\n"; echo "<TR>\r\n"; echo "<TD WIDTH=\"50%\" VALIGN=\"top\">\r\n"; echo "<FORM METHOD=\"post\" ACTION=\"$PHP_SELF\">\r\n"; echo "<SPAN CLASS=\"highlight\">$lang[new_username]</SPAN><BR>\r\n"; echo "<INPUT TYPE=\"text\" NAME=\"username\" SIZE=\"15\" VALUE=\"$username\"><BR>&nbsp;<BR>\r\n"; echo "<SPAN CLASS=\"highlight\">$lang[new_password]:</SPAN><BR>\r\n"; echo "<INPUT TYPE=\"password\" NAME=\"password\" SIZE=\"15\" VALUE=\"$password\"><BR>&nbsp;<BR>\r\n"; echo "<SPAN CLASS=\"highlight\">$lang[new_email]</SPAN><BR>\r\n"; echo "<INPUT TYPE=\"text\" NAME=\"email\" SIZE=\"15\" VALUE=\"$email\"><BR>\r\n"; echo "$lang[email_disclaimer]<BR>&nbsp;<BR>\r\n"; echo "<INPUT TYPE=\"submit\" NAME=\"subscribe\" VALUE=\"$lang[subscribe]\">\r\n"; echo "</FORM>\r\n"; echo "</TD>\r\n"; echo "<TD WIDTH=\"50%\" VALIGN=\"top\">\r\n"; echo "<FORM METHOD=\"post\" ACTION=\"$PHP_SELF\">\r\n"; echo "<SPAN CLASS=\"highlight\">$lang[enter_username]</SPAN><BR>\r\n"; echo "<INPUT TYPE=\"text\" NAME=\"username\" SIZE=\"15\" VALUE=\"$username\"><BR>&nbsp;<BR>\r\n"; echo "<SPAN CLASS=\"highlight\">$lang[enter_password]</SPAN><BR>\r\n"; echo "<INPUT TYPE=\"password\" NAME=\"password\" SIZE=\"15\" VALUE=\"$password\">\r\n"; echo "<BR>&nbsp;<BR>\r\n"; echo "<INPUT TYPE=\"submit\" NAME=\"enter\" VALUE=\"$lang[enter_chat]\">\r\n"; echo "</FORM>\r\n"; echo "</TD>\r\n"; echo "</TR>\r\n"; echo "<TR>\r\n"; echo "<TD COLSPAN=\"2\" VALIGN=\"top\">\r\n"; echo "$lang[email_comments]<A HREF=\"mailto:$mail_address\">$mail_address</A>\r\n"; echo "</TD>\r\n"; echo "</TR>\r\n"; echo "<TR>\r\n"; echo "<TD COLSPAN=\"2\" VALIGN=\"top\">\r\n"; echo "<A href=\"http://www.olivo.net/software/chatty/\">Chatty :)</A> is a GPL program developed by <A href=\"http://www.olivo.net/\">Marco Olivo</A>.\r\n"; echo "</TD>\r\n"; echo "</TR>\r\n"; echo "</TABLE></DIV>\r\n"; echo "<!--end login table-->\r\n"; echo "\r\n"; echo "</BODY>\r\n"; echo "</HTML>\r\n"; ?>
6hkmgxh3
6hkmgxh3/fwfw.php
PHP
Apache License 2.0 (Apache)
9,410
<?PHP /* $Id$ */ # This file is part of Chatty :) # Copyright (C) 2003, 2004, 2005 Marco Olivo # # Chatty :) is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. include("config.inc.php"); include("connect.inc.php"); include("utils.inc.php"); include("lang.inc.php"); /* html code for the chat */ function chat() { global $username, $password; global $chat_title; $password = md5($password); $username = urlencode($username); echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\r\n"; echo "<HTML>\r\n"; echo "<HEAD>\r\n"; echo "<LINK REL=\"stylesheet\" HREF=\"style.css.php\" TYPE=\"text/css\">\r\n"; echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=iso-8859-1\">\r\n"; echo "<TITLE>$chat_title Chat!</TITLE>\r\n"; echo "</HEAD>\r\n\r\n"; echo "<FRAMESET ROWS=\"*,80\" COLS=\"*,150\" FRAMESPACING=\"0\" FRAMEBORDER=\"0\" BORDER=\"0\">\r\n"; echo "<FRAME NAME=\"talk\" NORESIZE SRC=\"talk.php?username=$username&password=$password\" MARGINWIDTH=\"12\" MARGINHEIGHT=\"12\">\r\n"; echo "<FRAME NAME=\"users\" SCROLLING=\"no\" NORESIZE SRC=\"users.php?username=$username&password=$password\" MARGINWIDTH=\"12\" MARGINHEIGHT=\"12\">\r\n"; /* pick a random color for the current user */ $color = random(9); echo "<FRAME NAME=\"your_msg\" SCROLLING=\"no\" NORESIZE SRC=\"sendmsg.php?color=$color&username=$username&password=$password\" MARGINWIDTH=\"12\" MARGINHEIGHT=\"12\">\r\n"; echo "<FRAME SRC=\"logo.php\" MARGINWIDTH=\"0\" MARGINHEIGHT=\"0\" FRAMEBORDER=\"0\" SCROLLING=\"no\">\r\n"; echo "<NOFRAMES>\r\n"; echo "<BODY>\r\n"; echo "Your browser doesn't support frames. Sorry :-(\r\n"; echo "</BODY>\r\n"; echo "</NOFRAMES>\r\n"; echo "</FRAMESET>\r\n"; echo "</HTML>\r\n"; } header("Expires: Sun, 28 Dec 1997 09:32:45 GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); /* is this the first enter on this page? */ $first_enter = !isset($username) && !isset($password); $failed_data = false; /* routine-checks */ if (!isset($username)) { $username = ""; } if (!isset($password)) { $password = ""; } if (!isset($email)) { $email = ""; } /* security checks */ $username = htmlentities(urldecode(mysql_real_escape_string($username)), ENT_QUOTES); $password = mysql_real_escape_string(stripslashes($password)); /* ok, let's see if the user can log in */ if (!$first_enter && !$failed_data) { if ($username == "") { $first_enter = true; } else if ($password == "") { $failed_data = true; } else if (isset($enter)) { /* user seems to be registered: mmhh, is that true? */ $query = "SELECT * FROM users WHERE username = '$username' AND password = '" . md5("$password") . "'"; $result = do_the_query($chat_db, $query); if (mysql_num_rows($result) != 0) { /* login ok! */ $failed_data = false; /* register the successful login */ $query = "UPDATE users SET active = 'y', sent_on = DATE_ADD(NOW(), INTERVAL $diff_timezone HOUR) WHERE username = '$username'"; do_the_query($chat_db, $query); /* we warn the other users of the chat */ $query = "INSERT INTO msg(username, msg, color, sent_on) VALUES ('', '$username', '', DATE_ADD(NOW(), INTERVAL $diff_timezone HOUR))"; do_the_query($chat_db, $query); } else { $failed_data = true; } mysql_free_result($result); } else if (isset($subscribe)) { $query = "SELECT * FROM users WHERE username = '$username'"; $result = do_the_query($chat_db, $query); if (mysql_num_rows($result) != 0 || $email == "") { /* wrong registration: the email is empty or there is another user registered with that nickname */ $failed_data = true; mysql_free_result($result); } else { $failed_data = false; /* register the new user */ $query = "REPLACE INTO users (username, password, email, active, sent_on) VALUES ('$username', '" . md5("$password") . "', '$email', 'y', DATE_ADD(NOW(), INTERVAL $diff_timezone HOUR))"; do_the_query($chat_db, $query); /* we warn the other users of the chat */ $query = "INSERT INTO msg(username, msg, color, sent_on) VALUES ('', '$username', '', DATE_ADD(NOW(), INTERVAL $diff_timezone HOUR))"; do_the_query($chat_db, $query); /* send a welcome message */ $msg = "Dear user,\r\nwelcome in our chat.\r\nHere is the data you entered:\r\n\r\nusername: " . stripslashes($username) . "\r\npassword: $password\r\n\r\nI hope to see you soon in our chat.\r\nBye!\r\n\r\n"; mail($email, "Welcome!", $msg, "From: $mail_address\r\n"); mysql_free_result($result); } } } if (!$first_enter && !$failed_data) { /* everything is ok: let's enter the chat! */ chat(); exit; } echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\r\n"; echo "<HTML>\r\n"; echo "<HEAD>\r\n"; echo "<LINK REL=\"stylesheet\" HREF=\"style.css.php\" TYPE=\"text/css\">\r\n"; echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; CHARSET=iso-8859-1\">\r\n"; echo "<TITLE>$lang[register_title]</TITLE>\r\n"; echo "</HEAD>\r\n\r\n"; echo "<BODY>\r\n"; echo "\r\n"; echo "<!--begin login table-->\r\n"; echo "<DIV CLASS=\"center\"><TABLE BORDER=\"0\" BGCOLOR=\"$index_table_bgcolor\" CELLSPACING=\"0\" CELLPADDING=\"10\" WIDTH=\"65%\">\r\n"; echo "<TR>\r\n"; echo "<TD COLSPAN=\"2\" VALIGN=\"top\">\r\n"; echo "<DIV CLASS=\"center\"><TABLE BORDER=\"0\" BGCOLOR=\"$index_header_bgcolor\" WIDTH=\"95%\" CELLSPACING=\"0\" CELLPADDING=\"3\">\r\n"; echo "<TD WIDTH=\"50%\" VALIGN=\"top\" CLASS=\"center\">\r\n"; echo "<SPAN CLASS=\"bigwhite\">$lang[new_user]</SPAN>\r\n"; echo "</TD>\r\n"; echo "<TD WIDTH=\"50%\" VALIGN=\"top\" CLASS=\"center\">\r\n"; echo "<SPAN CLASS=\"bigwhite\">$lang[existing_user]</SPAN>\r\n"; echo "</TD>\r\n"; echo "</TR>\r\n"; echo "</TABLE></DIV>\r\n"; echo "</TD>\r\n"; echo "</TR>\r\n"; echo "<TR>\r\n"; echo "<TD WIDTH=\"50%\" VALIGN=\"top\">\r\n"; if ($failed_data && isset($subscribe)) { if ($email == "") { echo "<SPAN CLASS=\"highlight\"><B>$lang[email_reason]</B></SPAN><BR>&nbsp;<BR>\r\n"; } else if ($password == "") { echo "<SPAN CLASS=\"highlight\"><B>$lang[pass_reason]</B></SPAN><BR>&nbsp;<BR>\r\n"; } else /*if ($username == "")*/ { echo "<SPAN CLASS=\"highlight\"><B>$lang[dup_user]</B><BR>Thanks.</SPAN><BR>&nbsp;<BR>\r\n"; } } else { echo "$lang[new_user_instructions] <BR>&nbsp;<BR>\r\n"; } echo "</TD>\r\n"; echo "<TD WIDTH=\"50%\" VALIGN=\"top\">\r\n"; if ($failed_data && isset($enter)) { echo "<SPAN CLASS=\"highlight\"><B>$lang[wrong_login]</B></SPAN><BR>&nbsp;<BR>\r\n"; } else { echo "$lang[existing_user_instructions]<BR>&nbsp;<BR>\r\n"; } echo "</TD>\r\n"; echo "</TR>\r\n"; echo "<TR>\r\n"; echo "<TD WIDTH=\"50%\" VALIGN=\"top\">\r\n"; echo "<FORM METHOD=\"post\" ACTION=\"$PHP_SELF\">\r\n"; echo "<SPAN CLASS=\"highlight\">$lang[new_username]</SPAN><BR>\r\n"; echo "<INPUT TYPE=\"text\" NAME=\"username\" SIZE=\"15\" VALUE=\"$username\"><BR>&nbsp;<BR>\r\n"; echo "<SPAN CLASS=\"highlight\">$lang[new_password]:</SPAN><BR>\r\n"; echo "<INPUT TYPE=\"password\" NAME=\"password\" SIZE=\"15\" VALUE=\"$password\"><BR>&nbsp;<BR>\r\n"; echo "<SPAN CLASS=\"highlight\">$lang[new_email]</SPAN><BR>\r\n"; echo "<INPUT TYPE=\"text\" NAME=\"email\" SIZE=\"15\" VALUE=\"$email\"><BR>\r\n"; echo "$lang[email_disclaimer]<BR>&nbsp;<BR>\r\n"; echo "<INPUT TYPE=\"submit\" NAME=\"subscribe\" VALUE=\"$lang[subscribe]\">\r\n"; echo "</FORM>\r\n"; echo "</TD>\r\n"; echo "<TD WIDTH=\"50%\" VALIGN=\"top\">\r\n"; echo "<FORM METHOD=\"post\" ACTION=\"$PHP_SELF\">\r\n"; echo "<SPAN CLASS=\"highlight\">$lang[enter_username]</SPAN><BR>\r\n"; echo "<INPUT TYPE=\"text\" NAME=\"username\" SIZE=\"15\" VALUE=\"$username\"><BR>&nbsp;<BR>\r\n"; echo "<SPAN CLASS=\"highlight\">$lang[enter_password]</SPAN><BR>\r\n"; echo "<INPUT TYPE=\"password\" NAME=\"password\" SIZE=\"15\" VALUE=\"$password\">\r\n"; echo "<BR>&nbsp;<BR>\r\n"; echo "<INPUT TYPE=\"submit\" NAME=\"enter\" VALUE=\"$lang[enter_chat]\">\r\n"; echo "</FORM>\r\n"; echo "</TD>\r\n"; echo "</TR>\r\n"; echo "<TR>\r\n"; echo "<TD COLSPAN=\"2\" VALIGN=\"top\">\r\n"; echo "$lang[email_comments]<A HREF=\"mailto:$mail_address\">$mail_address</A>\r\n"; echo "</TD>\r\n"; echo "</TR>\r\n"; echo "<TR>\r\n"; echo "<TD COLSPAN=\"2\" VALIGN=\"top\">\r\n"; echo "<A href=\"http://www.olivo.net/software/chatty/\">Chatty :)</A> is a GPL program developed by <A href=\"http://www.olivo.net/\">Marco Olivo</A>.\r\n"; echo "</TD>\r\n"; echo "</TR>\r\n"; echo "</TABLE></DIV>\r\n"; echo "<!--end login table-->\r\n"; echo "\r\n"; echo "</BODY>\r\n"; echo "</HTML>\r\n"; ?>
08ku907
08ku907/fwfw.php
PHP
Apache License 2.0 (Apache)
9,410
using namespace std; using namespace cv; class BeeHive { public: Conf conf; vector<Pair2i>* pairwiseMatches; const vector<KeyPoint>* keypoints1; const vector<KeyPoint>* keypoints2; int currentDance; int fieldSize; Outlier *biggestOutlier; Outlier **previousSolutions; vector<Outlier> outliers; vector<Outlier*> feasibleSolutions; vector<Outlier*> waggleList; double pFollowWaggleList; public: BeeHive(vector<Pair2i>* _pairwiseMatches, const vector<KeyPoint>* _keypoints1, const vector<KeyPoint>* _keypoints2); void init(int numberOfThreads, int population, double normDeviation, double suspectTresholdPct, double confirmTresholdPct) { this->fieldSize = this->pairwiseMatches->size(); int suspectAttempts, confirmAttempts; if(this->fieldSize <=20) { suspectAttempts = 3; confirmAttempts = 10; } else if(this->fieldSize > 20 && this->fieldSize <=50) { suspectAttempts = 4; confirmAttempts = 15; } else { suspectAttempts = 5; confirmAttempts = 20; } init(numberOfThreads, population, normDeviation, suspectTresholdPct, confirmTresholdPct, suspectAttempts, confirmAttempts); } void init(int numberOfThreads, int population, double normDeviation, double suspectTresholdPct, double confirmTresholdPct, int suspectAttempts, int confirmAttempts) { this->fieldSize = this->pairwiseMatches->size(); this->conf.NumberOfThreads = numberOfThreads; this->conf.Population = population; this->conf.NormDeviation = normDeviation; this->conf.OutlierSuspectAttempts = suspectAttempts; this->conf.OutlierConfirmAttempts = confirmAttempts; this->conf.OutlierSuspectTresholdPct = suspectTresholdPct; this->conf.OutlierConfirmTresholdPct = confirmTresholdPct; this->previousSolutions = new Outlier*[conf.Population]; for(int i = 0; i < conf.Population; i++) { this->previousSolutions[i] = NULL; } this->biggestOutlier = NULL; } void destroy() { delete[] previousSolutions; } void generateInitialSolutions() { biggestOutlier = new Outlier(); int scoutSearchSize = fieldSize / conf.Population; int module = fieldSize % conf.Population; int startIndex = 0; for(int i = 0; i < conf.Population; i++) { startIndex = i*scoutSearchSize; scout(i, startIndex, scoutSearchSize); } for(int i = 0; i < module; i++) { startIndex = i + conf.Population * scoutSearchSize; scout(i, startIndex, 1); } } void exploreBigValey() { if(conf.NumberOfThreads > 1) { //goToWorkParallel(); } else { goToWork(); } } void goToWork() { generateInitialSolutions(); if(biggestOutlier->suspectedAsOutlierCount > 0) { performWaggleDance(biggestOutlier); } else { return; } while(feasibleSolutions.size() > 0) { for(int foragingBee = 0; foragingBee < conf.Population; foragingBee++) { Outlier* followedOutlier = observeAndSelectDance(foragingBee); if(followedOutlier == NULL) continue; forage(followedOutlier); if(followedOutlier->suspectedAsOutlierPct() > biggestOutlier->suspectedAsOutlierPct()) { performWaggleDance(followedOutlier); biggestOutlier = followedOutlier; } previousSolutions[foragingBee] = followedOutlier; } cleanupOutliers(); if(pairwiseMatches->size() < conf.OutlierConfirmAttempts) { pairwiseMatches->clear(); destroyOutliers(); } } } void destroyOutliers() { for(int i = 0; i < conf.Population;i++) { previousSolutions[i] = NULL; } for(int i = feasibleSolutions.size() - 1; i > -1; i--) { Outlier* out = feasibleSolutions[i]; feasibleSolutions.erase(feasibleSolutions.begin() + i); delete out; } } void cleanupOutliers() { vector<Outlier> tempConfirmedOutliers; for(int i = waggleList.size() - 1; i > -1; i--) { Outlier *out = waggleList[i]; if(out->timesVisited >= conf.OutlierConfirmAttempts) { waggleList.erase(waggleList.begin() + i); } } for(int i = feasibleSolutions.size() - 1; i > -1; i--) { Outlier* out = feasibleSolutions[i]; if(out->timesVisited >= conf.OutlierConfirmAttempts) { if(out->pair == biggestOutlier->pair) { biggestOutlier = getFeasibleSolution(); } if(out->suspectedAsOutlierPct() >= conf.OutlierConfirmTresholdPct) { tempConfirmedOutliers.push_back(*out); outliers.push_back(*out); } feasibleSolutions.erase(feasibleSolutions.begin() + i); for(int i = 0; i < conf.Population;i++) { if(previousSolutions[i] == out) { previousSolutions[i] = NULL; } } delete out; } } if(tempConfirmedOutliers.size() > 0) { for(int j = 0; j < tempConfirmedOutliers.size(); j++) { for(int i = pairwiseMatches->size() - 1; i > -1; i--) { if(pairwiseMatches->at(i) == tempConfirmedOutliers.at(j).pair) { pairwiseMatches->erase(pairwiseMatches->begin() + i); } } } fieldSize = pairwiseMatches->size(); tempConfirmedOutliers.clear(); } } //void goToWorkParallel() //{ // /*omp_set_num_threads(conf.Number_Of_Threads); // generateInitialSolutions(); // Solution* followedSolution; // Solution newSolution; // // for(int i = 0; i < conf.NumberOfIterations; i++) // { // #pragma omp parallel for private(newSolution, followedSolution) // for(int foragingBee = 0; foragingBee < conf.Population; foragingBee++) // { // followedSolution = observeAndSelectDance(foragingBee); // // // newSolution = forage(*followedSolution); // if(newSolution.iPenalty < bestSolution.iPenalty) // { // #pragma omp critical // { // if(newSolution.iPenalty < bestSolution.iPenalty) // { // performWaggleDance(&newSolution); // bestSolution = newSolution; // } // } // } // // previousSolutions[foragingBee] = newSolution; // } // }*/ //} void performWaggleDance(Outlier *newSolution) { bool found = false; for(int i = 0; i < waggleList.size(); i++) { if(waggleList.at(i)->pair == newSolution->pair) { found = true; break; } } if(!found) { waggleList.push_back(newSolution); } double profitabilitySum = 0.0; for(int i = 0; i < waggleList.size(); i++) { profitabilitySum = profitabilitySum + (1.0 / ((double)waggleList.at(i)->suspectedAsOutlierPct())); } pFollowWaggleList = (double)profitabilitySum / (double)waggleList.size(); } Outlier* observeAndSelectDance(int foragingBee) { Outlier *followedSolution = previousSolutions[foragingBee]; if(followedSolution == NULL || followedSolution->timesVisited >= conf.OutlierConfirmAttempts) { followedSolution = getFeasibleSolution(); } if(followedSolution != NULL) // in case there are no feasible solutions { double currentPenalty = (double)(followedSolution->suspectedAsOutlierPct()); double pFollow = 1.0/currentPenalty; bool shouldFollow = pFollow > (1.2 * pFollowWaggleList); if(shouldFollow) { if(waggleList.size() > 0) { int randPeriod1 = rand() % 100; if(randPeriod1 <=60) { #pragma omp critical { Outlier* waggleSolution = getNextWaggleDanceSolution(); if(waggleSolution->timesVisited < conf.OutlierConfirmAttempts) { followedSolution = waggleSolution; } } } } } } return followedSolution; } Outlier* getFeasibleSolution() { int size = feasibleSolutions.size(); if(size == 0) { return NULL; } int idx = rand()%size; return feasibleSolutions.at(idx); } Outlier* getNextWaggleDanceSolution() { if(waggleList.size()<= currentDance) { currentDance = 0; } Outlier *next = waggleList.at(currentDance); currentDance++; return next; } void scout(int scoutNum, int startIndex, int scoutSearchSize) { int endIndex = startIndex + scoutSearchSize; for(int i = startIndex; i < endIndex; i++) { Outlier* out = new Outlier(); lookForNecterHere(i, out); if(out->suspectedAsOutlierPct() >= conf.OutlierSuspectTresholdPct) { if(previousSolutions[scoutNum] == NULL || out->suspectedAsOutlierCount > previousSolutions[scoutNum]->suspectedAsOutlierCount) { previousSolutions[scoutNum] = out; } feasibleSolutions.push_back(out); if(out->suspectedAsOutlierCount > biggestOutlier->suspectedAsOutlierCount) { biggestOutlier = out; } } else { out->tabooList.clear(); delete out; } } } void lookForNecterHere(int pairwiseMatch, Outlier* out) { Pair2i vec = pairwiseMatches->at(pairwiseMatch); Point2f first = keypoints1->at(vec.first).pt; Point2f second = keypoints2->at(vec.second).pt; double distance = norm(first - second); out->pair = vec; out->distance = distance; double tempDistance; int randomPairIdx; for(int i = 0; i < conf.OutlierSuspectAttempts; i++) { randomPairIdx = rand() % fieldSize; Pair2i randomVec = pairwiseMatches->at(randomPairIdx); int randomCount = 0; int randomCountMax = fieldSize*2; while(std::find(out->tabooList.begin(),out->tabooList.end(),randomVec) != out->tabooList.end()) { if(randomCount > randomCountMax) break; randomPairIdx = rand() % fieldSize; randomVec = pairwiseMatches->at(randomPairIdx); randomCount++; } out->tabooList.push_back(randomVec); out->timesVisited++; first = keypoints1->at(randomVec.first).pt; second = keypoints2->at(randomVec.second).pt; tempDistance = norm(first - second); if(fabs(distance - tempDistance) > conf.NormDeviation) { out->suspectedAsOutlierCount++; } } } void forage(Outlier* out) { int randomPairIdx = rand() % fieldSize; Pair2i randomVec = pairwiseMatches->at(randomPairIdx); int randomCount = 0; int randomCountMax = fieldSize*2; while(std::find(out->tabooList.begin(),out->tabooList.end(),randomVec) != out->tabooList.end()) { if(randomCount > randomCountMax) break; randomPairIdx = rand() % fieldSize; randomVec = pairwiseMatches->at(randomPairIdx); randomCount++; } out->tabooList.push_back(randomVec); out->timesVisited++; Point2f first = keypoints1->at(randomVec.first).pt; Point2f second = keypoints2->at(randomVec.second).pt; double tempDistance = norm(first - second); if(fabs(out->distance - tempDistance) > conf.NormDeviation) { out->suspectedAsOutlierCount++; } } }; BeeHive::BeeHive(vector<Pair2i>* _pairwiseMatches, const vector<KeyPoint>* _keypoints1, const vector<KeyPoint>* _keypoints2) { this->pairwiseMatches = _pairwiseMatches; this->keypoints1 = _keypoints1; this->keypoints2 = _keypoints2; }
3dReconstruction
Source/Build3dModel/Build3dModel/beehive.h
C
New BSD License (BSD)
11,122
class Conf { public: int NumberOfThreads; int NumberOfIterations; int Population; int MaxNumberOfAttempts; double NormDeviation; int OutlierSuspectAttempts; int OutlierConfirmAttempts; double OutlierSuspectTresholdPct; double OutlierConfirmTresholdPct; //double ReplacementTrashold; };
3dReconstruction
Source/Build3dModel/Build3dModel/beehiveConfiguration.h
C
New BSD License (BSD)
315
#include "opencv2/imgproc/imgproc.hpp" #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/nonfree/features2d.hpp" #include "opencv2/nonfree/nonfree.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/core/opengl_interop.hpp" #include "opencv2/contrib/contrib.hpp" #include <windows.h> #include <GL/freeglut.h> #include "customTypes.h" #include "outlier.h" #include "beehiveConfiguration.h" #include "beehive.h" #include <iostream> #include <ctime> // clock() #include <map> #include <ctype.h> #include <stdio.h> #include <stdlib.h> using namespace cv; using namespace std; static void outputMatrix(const Mat mat) { for(int i = 0; i < mat.rows; i++) { for(int j = 0; j < mat.cols; j++) { cout << mat.at<double>(i,j)<< " "; } cout<<endl; } cout<<endl; cout<<endl; } static bool readCameraMatrix(const string& filename, Mat_<double>& cameraMatrix, Mat_<double>& distCoeffs, Size& calibratedImageSize ) { FileStorage fs(filename, FileStorage::READ); fs["imageWidth"] >> calibratedImageSize.width; fs["imageHeight"] >> calibratedImageSize.height; fs["D"] >> distCoeffs; fs["K"] >> cameraMatrix; return true; } string getImagePath(string modelname, string nodename, string extension) { string path = modelname; path.append("\\"); path.append(nodename); path.append("."); path.append(extension); return path; } typedef Vec<double, 9> Vec9d; static bool readModelViews( const string& filename, string modelname, vector<Point3f>& box, vector<string>& imagelist, vector<Vec9d>& poseListRot, vector<Vec3d>& poseListTr) { imagelist.resize(0); poseListRot.resize(0); poseListTr.resize(0); box.resize(0); FileStorage fs(filename, FileStorage::READ); if( !fs.isOpened() ) return false; fs["box"] >> box; FileNode all = fs["images"]; FileNodeIterator it = all.begin(), it_end = all.end(); string extension = fs["extension"]; for(; it != it_end; ++it) { FileNode n = *it; string name = getImagePath(modelname, n.name(), extension); imagelist.push_back(name); Mat_<double> rotationMat, translationMat, rotationRodrigues(3,1,CV_64F); n["R"]>>rotationMat; n["T"]>>translationMat; Vec9d rotVec = Vec9d(rotationMat.at<double>(0,0), rotationMat.at<double>(0,1), rotationMat.at<double>(0,2), rotationMat.at<double>(1,0), rotationMat.at<double>(1,1), rotationMat.at<double>(1,2), rotationMat.at<double>(2,0), rotationMat.at<double>(2,1), rotationMat.at<double>(2,2)); Vec3d trVec = Vec3d(translationMat.at<double>(0,0), translationMat.at<double>(1,0), translationMat.at<double>(2,0)); poseListRot.push_back(rotVec); poseListTr.push_back(trVec); } return true; } struct PointModel { vector<Point3d> points; vector<vector<int> > didx; Mat descriptors; string name; }; static void writeModel(const string& modelFileName, const string& modelname, const PointModel& model) { FileStorage fs(modelFileName, FileStorage::WRITE); fs << modelname << "{" << "points" << "[:" << model.points << "]" << "idx" << "[:"; for( int i = 0; i < model.didx.size(); i++ ) fs << "[:" << model.didx[i] << "]"; fs << "]" << "descriptors" << model.descriptors; } static void unpackPose(const Vec9d& poseRot,const Vec3d& poseTr, Mat& R, Mat& t) { R = (Mat_<double>(3,3) << poseRot[0], poseRot[1], poseRot[2],poseRot[3], poseRot[4], poseRot[5],poseRot[6], poseRot[7], poseRot[8]); t = (Mat_<double>(3,1) << poseTr[0], poseTr[1], poseTr[2]); } static void findConstrainedCorrespondences(const vector<KeyPoint>& keypoints1, const vector<KeyPoint>& keypoints2, const Mat& descriptors1, const Mat& descriptors2, vector<Pair2i>& matches, double ratio) { int dsize = descriptors1.cols; matches.clear(); for( int i = 0; i < (int)keypoints1.size(); i++ ) { Point2f p1 = keypoints1[i].pt; double bestDist1 = DBL_MAX, bestDist2 = DBL_MAX; int bestIdx1 = -1; const float* d1 = descriptors1.ptr<float>(i); for( int j = 0; j < (int)keypoints2.size(); j++ ) { Point2f p2 = keypoints2[j].pt; const float* d2 = descriptors2.ptr<float>(j); double dist = 0; for( int k = 0; k <= dsize; k ++ ) { float t0 = d1[k] - d2[k]; dist += t0*t0; if( dist >= bestDist2 ) break; } if( dist < bestDist2 ) { if( dist < bestDist1 ) { bestDist2 = bestDist1; bestDist1 = dist; bestIdx1 = (int)j; } else if( dist < bestDist2 ) { bestDist2 = dist; } } } if( bestIdx1 >= 0 && bestDist1 < bestDist2*ratio ) { Point2f p2 = keypoints2[bestIdx1].pt; double threshold = bestDist1/ratio; const float* d22 = descriptors2.ptr<float>(bestIdx1); int i1 = 0; for( ; i1 < (int)keypoints1.size(); i1++ ) { if( i1 == i ) continue; Point2f pt1 = keypoints1[i1].pt; const float* d11 = descriptors1.ptr<float>(i1); double dist = 0; for( int k = 0; k < dsize; k++ ) { float t = d11[k] - d22[k]; dist += t*t; if( dist >= threshold ) break; } if( dist < threshold ) break; } if( i1 == (int)keypoints1.size() ) matches.push_back(Pair2i(i,bestIdx1)); } } } static Mat_<double> calculateProjectionMatrix(Mat_<double> R, Mat_<double> t, Mat_<double> K) { Mat_<double> Rt(3,4); for(int i = 0; i < 4; i++) { for(int j = 0; j < 3; j++) { if(i == 3) { double tj = t.at<double>(j,0); Rt.at<double>(j,3) = tj; } else { double rij = R.at<double>(i,j); Rt.at<double>(i,j) = rij; } } } return K*Rt; } static Point3d triangulatePointsPair(const vector<Point2f>& pts, const vector<Mat>& PMats) { if(pts.size() != 2 || PMats.size() != 2) { throw; } Mat_<double> A(4,4); for(int i = 0; i < 2; i++) { double u = pts[i].x; double v = pts[i].y; Mat_<double> P = PMats.at(i); for(int j = 0; j < 2; j++) { double factor = u; if(j == 1) factor = v; for(int k = 0; k < 4; k++) { A.at<double>(i*2+j,k) = (factor*P.at<double>(2,k)) - P.at<double>(j,k); } } } double xData[4]; Mat_<double> X(4,1,xData); SVD::solveZ(A,X); double x = X.at<double>(0,0); double y = X.at<double>(1,0); double z = X.at<double>(2,0); double w = X.at<double>(3,0); return Point3d(x/w, y/w, z/w); } static bool isTriangulationGood(Point3d& triangulatedPoint, const vector<Point2f> pairPts, const vector<Mat>& RMats, const vector<Mat>& tMats, const Mat& cameraMatrix) { vector<Point3f> objpts; objpts.push_back(triangulatedPoint); vector<Point2f> imgpts1, imgpts2; projectPoints(Mat(objpts), RMats[0], tMats[0], cameraMatrix, Mat(), imgpts1); projectPoints(Mat(objpts), RMats[1], tMats[1], cameraMatrix, Mat(), imgpts2); double e1 = norm(imgpts1[0] - pairPts[0]); double e2 = norm(imgpts2[0] - pairPts[1]); if( e1 + e2 < 5) { return true; } return false; } static Point3d triangulatePoints(const vector<Point2f>& pts, const vector<Mat>& PMats, vector<Mat>& RMats, vector<Mat>& tMats, Mat& cameraMatrix) { int numberOfPoints = pts.size(); if(numberOfPoints != PMats.size()) { throw; } vector<Mat> pairMatsP(2); vector<Mat> pairMatsR(2); vector<Mat> pairMatsT(2); vector<Point2f> pairPts(2); vector<Point3d> triangulatedPoints; for(int i = 0; i < numberOfPoints - 1; i++) { for(int j = i + 1; j < numberOfPoints; j++) { pairMatsR.clear(); pairMatsT.clear(); pairMatsP.clear(); pairPts.clear(); pairMatsP.push_back(PMats[i]); pairMatsP.push_back(PMats[j]); pairMatsR.push_back(RMats[i]); pairMatsR.push_back(RMats[j]); pairMatsT.push_back(tMats[i]); pairMatsT.push_back(tMats[j]); pairPts.push_back(pts[i]); pairPts.push_back(pts[j]); Point3d triangulatedPoint = triangulatePointsPair(pairPts, pairMatsP); if(isTriangulationGood(triangulatedPoint, pairPts, pairMatsR, pairMatsT, cameraMatrix)) { triangulatedPoints.push_back(triangulatedPoint); } } } int numberOfPairs = triangulatedPoints.size(); Point3d finalTriangulatedPoint; for(int i = 0; i < numberOfPairs; i++) { finalTriangulatedPoint = finalTriangulatedPoint + triangulatedPoints[i]; } double factor = 1.0 / numberOfPairs; return finalTriangulatedPoint * factor; } static void visualizePointCloud(int nimages, const vector<string>& imageList, const vector<Mat>& Rs, const vector<Mat>& ts, const Mat& cameraMatrix, PointModel& model) { Mat img(640,480,CV_8UC3); vector<Point2d> imagePoints; namedWindow("Test", 1); // visualize the cloud for( int i = 0; i < nimages; i++ ) { //img = imread(format("%s/frame%04d.jpg", model.name.c_str(), (int)i), 1); img = imread(imageList[i], 1); projectPoints(Mat(model.points), Rs[i], ts[i], cameraMatrix, Mat(), imagePoints); for( int k = 0; k < (int)imagePoints.size(); k++ ) { circle(img, imagePoints[k], 2, Scalar(0,255,0), -1, CV_AA, 0); } imshow("Test", img); int c = waitKey(); if( c == 'q' || c == 'Q' ) break; } } static void showMatchedKeypointsInfo(string firstImage, string secondImage, double deltaPercent, const vector<KeyPoint>& keypoints1, const vector<KeyPoint>& keypoints2, vector<Pair2i>& pairwiseMatches, bool visual) { if(visual) { namedWindow("img1"); namedWindow("img2"); } Mat img1, img2; if(visual) { img1 = imread(firstImage, CV_LOAD_IMAGE_COLOR); img2 = imread(secondImage, CV_LOAD_IMAGE_COLOR); } int pairsFoundBetweenTwoPictures = 0; for( int k = 0; k < pairwiseMatches.size(); k++ ) { int i1 = pairwiseMatches[k].first, i2 = pairwiseMatches[k].second; pairsFoundBetweenTwoPictures++; if(visual) { const Point2f* kpt1 = &keypoints1[i1].pt; const Point2f* kpt2 = &keypoints2[i2].pt; Scalar color(rand()%256,rand()%256, rand()%256); circle(img1, *kpt1 , 2, color, -1, CV_AA); circle(img2, *kpt2 , 2, color, -1, CV_AA); } } if(visual) { imshow("img1", img1); imshow("img2", img2); waitKey(); } cout<<"Pic 1: '"<<firstImage<<"' Pic 2: '"<<secondImage<<"' Delta T: "<<deltaPercent<<" Matches: "<<pairsFoundBetweenTwoPictures<<endl<<endl; } static void removeOutliers(const vector<KeyPoint>& keypoints1, const vector<KeyPoint>& keypoints2, const vector<Mat>& Ps, const vector<Mat>& Rs, const vector<Mat>& ts, const Mat_<double> cameraMatrix, vector<Pair2i>& pairwiseMatches, int& outliersFound) { BeeHive hive(&pairwiseMatches, &keypoints1, &keypoints2); hive.init(1, 10, 30.0, 60.0, 70.0); hive.exploreBigValey(); hive.init(1, 10, 30.0, 40.0, 80.0); hive.exploreBigValey(); outliersFound+= hive.outliers.size(); vector<Point2f> pts_k(2); for( int k = pairwiseMatches.size() - 1; k > -1; k-- ) { int i1 = pairwiseMatches[k].first, i2 = pairwiseMatches[k].second; pts_k[0] = keypoints1[i1].pt; pts_k[1] = keypoints2[i2].pt; Point3d objpt = triangulatePointsPair(pts_k, Ps); if(isTriangulationGood(objpt, pts_k, Rs, ts, cameraMatrix) == false) { pairwiseMatches.erase(pairwiseMatches.begin()+k); outliersFound++; } } } void mergeClusters(vector<vector<int>> clustersInt, int firstIndex, int secondIndex) { if(firstIndex > secondIndex) { int temp = firstIndex; firstIndex = secondIndex; secondIndex = temp; } vector<int> first = clustersInt.at(firstIndex); vector<int> second = clustersInt.at(secondIndex); for(int i = 0; i < second.size(); i++) { if(std::find(first.begin(), first.end(), second[i]) == first.end()) { first.push_back(second[i]); } } clustersInt.erase(clustersInt.begin() + secondIndex); } static vector<vector<Pair2i>> clusterizePairwiseMatches(vector<Pair2i> pairs, SetIntPair keypointsIdxMap) { vector<vector<int>> clustersInt; for( int i = 0; i < pairs.size(); i++) { Pair2i current = pairs[i]; int foundFirst = -1; int foundSecond = -1; for(int j = 0; j < clustersInt.size(); j++) { for(int k = 0; k < clustersInt[j].size(); k++) { if(clustersInt[j][k] == current.first) { foundFirst = j; } else if (clustersInt[j][k] == current.second) { foundSecond = j; } } if(foundFirst > -1 && foundSecond > -1) { break; } } if(foundFirst > -1 && foundSecond > -1) { if(foundFirst != foundSecond) { mergeClusters(clustersInt, foundFirst, foundSecond); } } else if(foundFirst > -1) { clustersInt[foundFirst].push_back(current.second); } else if (foundSecond > -1) { clustersInt[foundSecond].push_back(current.first); } else { vector<int> newVect; newVect.push_back(current.first); newVect.push_back(current.second); clustersInt.push_back(newVect); } } vector<vector<Pair2i>> clusters(clustersInt.size()); for( int i = 0; i < clustersInt.size(); i++ ) { vector<int> current = clustersInt[i]; for(int j = 0; j < current.size(); j++) { clusters[i].push_back(keypointsIdxMap[current[j]]); } } return clusters; } static void calculateKeyPointsAndDescriptors(const Ptr<FeatureDetector>& detector, const Ptr<DescriptorExtractor>& descriptorExtractor, const vector<string>& imageList, vector<vector<KeyPoint>>& allkeypoints, vector<int>& dstart, int& descriptorSize, vector<float>& alldescriptorsVec ) { int nimages = imageList.size(); Mat descriptorbuf; for( int i = 0; i < nimages; i++ ) { Mat img = imread(imageList[i], 1), gray; cvtColor(img, gray, CV_BGR2GRAY); vector<KeyPoint> keypoints; detector->detect(gray, keypoints); descriptorExtractor->compute(gray, keypoints, descriptorbuf); allkeypoints.push_back(keypoints); Mat buf = descriptorbuf; if( !buf.isContinuous() || buf.type() != CV_32F ) { buf.release(); descriptorbuf.convertTo(buf, CV_32F); } descriptorSize = buf.cols; int prev = alldescriptorsVec.size(); int delta = buf.rows*buf.cols; alldescriptorsVec.resize(prev + delta); std::copy(buf.ptr<float>(), buf.ptr<float>() + delta, alldescriptorsVec.begin() + prev); dstart.push_back(dstart.back() + (int)keypoints.size()); } } static void findPairwiseCorrespondencies(const vector<string>& imageList, const vector<Point3f>& modelBox, const vector<int>& dstart, const vector<Mat>& Rs, const vector<Mat>& ts, const vector<Mat>& Ps, const vector<vector<KeyPoint>>& allkeypoints, const Mat& alldescriptors, const Mat_<double>& cameraMatrix, SetIntPair& keypointsIdxMap, vector<Pair2i>& pairs) { int nimages = imageList.size(); int pairsFound = 0; int outliersFound = 0; vector<Point2f> pts_k(2); vector<Mat> Rs_k(2), ts_k(2), Ps_k(2); vector<Pair2i> pairwiseMatches; double boxDiagonal = norm(modelBox.at(0)-modelBox.at(1)); //biggest possible translation in the model box. const double DescriptorRatio = 0.7; for( int i = 0; i < nimages; i++ ) for( int j = i+1; j < nimages; j++ ) { double deltaT = norm(ts[i] - ts[j]); double deltaPercent = (deltaT/boxDiagonal)*100; if(deltaPercent > 15.0) continue; const vector<KeyPoint>& keypoints1 = allkeypoints[i]; const vector<KeyPoint>& keypoints2 = allkeypoints[j]; Mat descriptors1 = alldescriptors.rowRange(dstart[i], dstart[i+1]); Mat descriptors2 = alldescriptors.rowRange(dstart[j], dstart[j+1]); findConstrainedCorrespondences( keypoints1, keypoints2, descriptors1, descriptors2, pairwiseMatches, DescriptorRatio); Rs_k[0] = Rs[i]; Rs_k[1] = Rs[j]; ts_k[0] = ts[i]; ts_k[1] = ts[j]; Ps_k[0] = Ps[i]; Ps_k[1] = Ps[j]; removeOutliers(keypoints1, keypoints2, Ps_k, Rs_k, ts_k, cameraMatrix, pairwiseMatches, outliersFound); for( int k = 0; k < pairwiseMatches.size(); k++ ) { int i1 = pairwiseMatches[k].first, i2 = pairwiseMatches[k].second; pairsFound++; pairs.push_back(Pair2i(i1+dstart[i], i2+dstart[j])); keypointsIdxMap[i1+dstart[i]] = Pair2i((int)i,i1); keypointsIdxMap[i2+dstart[j]] = Pair2i((int)j,i2); } //showMatchedKeypointsInfo(imageList[i], imageList[j], deltaPercent, keypoints1, keypoints2, pairwiseMatches, true); } printf("Ok."); printf("\nTotal pairs = %d", pairsFound ); printf("\nTotal outliers = %d\n", outliersFound ); } static void compute3dPoints(const vector<vector<KeyPoint>>& allkeypoints, const Mat& alldescriptors, const vector<int>& dstart, const vector<Mat>& Ps, const vector<Mat>& Rs, const vector<Mat>& ts, Mat cameraMatrix, const vector<vector<Pair2i>>& clusters, PointModel& model ) { vector<Point2f> pts_k(2); vector<Mat> Ps_k(2); vector<Mat> Rs_k(2); vector<Mat> ts_k(2); int nclasses = clusters.size(); int globalDIdx = 0; for( int k = 0; k < nclasses; k++ ) { int i, n = (int)clusters[k].size(); pts_k.resize(n); Ps_k.resize(n); Rs_k.resize(n); ts_k.resize(n); model.didx[k].resize(n); for( i = 0; i < n; i++ ) { int imgidx = clusters[k][i].first, ptidx = clusters[k][i].second; Mat dstrow = model.descriptors.row(globalDIdx); alldescriptors.row(dstart[imgidx] + ptidx).copyTo(dstrow); model.didx[k][i] = globalDIdx++; pts_k[i] = allkeypoints[imgidx][ptidx].pt; Ps_k[i] = Ps[imgidx]; Rs_k[i] = Rs[imgidx]; ts_k[i] = ts[imgidx]; } Point3d objpt = triangulatePoints(pts_k, Ps_k, Rs_k, ts_k, cameraMatrix); model.points[k] = objpt; } } static void build3dmodel( const Ptr<FeatureDetector>& detector, const Ptr<DescriptorExtractor>& descriptorExtractor, const vector<Point3f>& modelBox, const vector<string>& imageList, const vector<Vec9d>& poseListRot, const vector<Vec3d>& poseListTr, const Mat_<double>& cameraMatrix, PointModel& model ) { model.points.clear(); model.didx.clear(); int nimages = imageList.size(); int nimagePairs = (nimages - 1)*nimages/2; vector<Mat> Rs, ts, Ps; for( int i = 0; i < nimages; i++ ) { Mat_<double> R, t, P; unpackPose(poseListRot[i],poseListTr[i], R, t); P = calculateProjectionMatrix(R, t, cameraMatrix); Rs.push_back(R); ts.push_back(t); Ps.push_back(P); } vector<vector<KeyPoint>> allkeypoints; int descriptorSize = 0; vector<float> alldescriptorsVec; vector<int> dstart; dstart.push_back(0); printf("\nComputing descriptors..."); int startTicks = clock(); //1. calculate keypoints and keypoint descriptors calculateKeyPointsAndDescriptors(detector, descriptorExtractor, imageList, allkeypoints, dstart, descriptorSize, alldescriptorsVec); Mat alldescriptors((int)alldescriptorsVec.size()/descriptorSize, descriptorSize, CV_32F, &alldescriptorsVec[0]); printf("Ok."); printf("\nTotal images = %d.",(int)nimages); printf("\nTotal keypoints = %d\n", alldescriptors.rows); cout << "Time taken to comute descriptors: " << clock() - startTicks << endl; printf("\nFinding correspondences..."); SetIntPair keypointsIdxMap; vector<Pair2i> pairs; startTicks = clock(); // 2. find pairwise correspondences findPairwiseCorrespondencies(imageList, modelBox, dstart, Rs, ts, Ps, allkeypoints, alldescriptors,cameraMatrix, keypointsIdxMap, pairs); cout<<"Time taken to compute pairwise correspondences: " << clock()- startTicks << endl; // 3. build the keypoint clusters printf("\nClustering correspondences..."); startTicks = clock(); vector<vector<Pair2i>> clusters = clusterizePairwiseMatches(pairs, keypointsIdxMap); int nclasses = clusters.size(); printf("Ok."); printf("\nTotal classes (i.e. 3d points) = %d\n", nclasses ); cout<<"Time taken to clusterize pairwise correspondencies: " << clock()-startTicks << endl; // 4. now compute 3D points corresponding to each cluster and fill in the model data printf("\nComputing 3D coordinates..."); startTicks = clock(); model.descriptors.create((int)keypointsIdxMap.size(), descriptorSize, CV_32F); model.didx.resize(nclasses); model.points.resize(nclasses); compute3dPoints(allkeypoints,alldescriptors,dstart,Ps,Rs,ts,cameraMatrix, clusters,model); printf("Ok.\n"); cout << "Time taken to compute 3d coordinates from clusters: "<<clock() - startTicks << endl; //visualizePointCloud(nimages, imageList, Rs, ts, cameraMatrix, model); } void init(void) { glClearColor(0.0, 0.0, 0.0, 0.0); glShadeModel(GL_FLAT); } void drawSphere(double x, double y, double z) { glPushMatrix(); glTranslated(x,y,z); glutSolidSphere(0.001,5,5); glPopMatrix(); } PointModel model; void drawSpheres() { for(int i = 0; i < model.points.size();i++) { Point3d point = model.points.at(i); drawSphere(point.x, point.y, point.z); } } double translateX = 0.0; double translateY = 0.0; double translateZ = 0.0; double rotateAngle = 0.0; double rotateX = 0.0; double rotateY = 0.0; double rotateZ = 0.0; void display(void) { glClear(GL_COLOR_BUFFER_BIT); glColor3f(255.0, 255.0, 255.0); glLoadIdentity(); /* clear the matrix */ /* viewing transformation */ gluLookAt(-0.0292149526928, 0.2141923869131, 0.52269561933, 0.0177525, -0.0118135, -0.0546675, 0.0, 1.0, 0.0); glScalef(1.0, 1.0, 1.0); /* modeling transformation */ //glTranslated(0.0277525, 0.0418135, -0.0546675); glRotated(rotateAngle, rotateX, rotateY, rotateZ); drawSpheres(); //glTranslated(0.0277525, 0.0418135, -0.0546675); glFlush(); } void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(30.0,1.0,0.05,1.0); //glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 20.0); glMatrixMode(GL_MODELVIEW); } void keyPressed(unsigned char key, int x, int y) { if (key == 'w') { rotateY = 0.0; rotateX = 1.0; rotateAngle+=10; } else if (key == 's') { rotateY = 0.0; rotateX = 1.0; rotateAngle-=10; } else if (key == 'a') { rotateY = 1.0; rotateX = 0.0; rotateAngle-=10; } else if (key == 'd') { rotateY = 1.0; rotateX = 0.0; rotateAngle+=10; } glutPostRedisplay(); } int main(int argc, char** argv) { initModule_nonfree(); int iGlobalSeed = 1234; srand((unsigned)time(0)+iGlobalSeed); const char* modelName = 0; const char* detectorName = "SURF"; const char* descriptorExtractorName = "SURF"; vector<Point3f> modelBox; vector<string> imageList; vector<Vec9d> poseListRot; vector<Vec3d> poseListTr; if(argc < 2) { return -1; } for( int i = 1; i < argc; i++ ) { if( strcmp(argv[i], "-m") == 0 ) modelName = argv[++i]; else if( strcmp(argv[i], "-d") == 0 ) detectorName = argv[++i]; else if( strcmp(argv[i], "-de") == 0 ) descriptorExtractorName = argv[++i]; else { printf("Incorrect option\n"); return -1; } } if( !modelName ) { printf("Some of the required parameters are missing\n"); return -1; } modelName = "TempleRingModel"; string modelFilename = format("%s\\%sCameraParameters.xml", modelName, modelName); Mat_<double> cameraMatrix, distCoeffs; Size calibratedImageSize; readCameraMatrix(modelFilename, cameraMatrix, distCoeffs, calibratedImageSize); Ptr<FeatureDetector> detector = FeatureDetector::create(detectorName); Ptr<DescriptorExtractor> descriptorExtractor = DescriptorExtractor::create(descriptorExtractorName); if(!readModelViews( modelFilename, modelName, modelBox, imageList, poseListRot, poseListTr)) { printf("Can not read the model. Check the parameters and the working directory\n"); return -1; } model.name = modelName; long startTicks = clock(); build3dmodel( detector, descriptorExtractor, modelBox, imageList, poseListRot, poseListTr, cameraMatrix, model ); long totalTicks = clock() - startTicks; cout<<endl<<"Total Time Taken: "<<totalTicks<<" ms"<<endl; int seconds = (totalTicks / 1000) % 60; int minutes = (totalTicks / (1000 * 60)) % 60; int hours = (totalTicks) / (1000 * 60 * 60) % 24; cout<<endl<<"Total Time Taken: "<<hours<<":"<<minutes<<":"<<seconds<<endl; /*string outputModelName = format("%s_model.xml", modelName); printf("\nDone! Now saving the model ...\n"); writeModel(outputModelName, modelName, model);*/ glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(600, 600); glutInitWindowPosition(100, 100); glutCreateWindow(argv[0]); init(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyPressed); glutMainLoop(); return 0; }
3dReconstruction
Source/Build3dModel/Build3dModel/build3dmodel.cpp
C++
New BSD License (BSD)
27,412
using namespace std; typedef pair<int, int> Pair2i; typedef map<int, Pair2i> SetIntPair;
3dReconstruction
Source/Build3dModel/Build3dModel/customTypes.h
C
New BSD License (BSD)
96
#include "opencv2/core/core.hpp" using namespace cv; class Outlier { public: int suspectedAsOutlierCount; Pair2i pair; double distance; vector<Pair2i> tabooList; int timesVisited; public: Outlier(Pair2i _pair, double _distance); Outlier(); double suspectedAsOutlierPct() { return ((double)(suspectedAsOutlierCount*100.0))/timesVisited;; } }; Outlier::Outlier() { distance = 0.0; suspectedAsOutlierCount = 0; timesVisited = 0; } Outlier::Outlier(Pair2i _pair, double _distance) { pair = _pair; distance = _distance; suspectedAsOutlierCount = 0; timesVisited = 0; }
3dReconstruction
Source/Build3dModel/Build3dModel/outlier.h
C
New BSD License (BSD)
628
<?xml version="1.0"?> <opencv_storage> <imageWidth>640</imageWidth> <imageHeight>480</imageHeight> <extension>png</extension> <box> -0.023121 -0.038009 -0.091940 0.078626 0.121636 -0.017395 </box> <K type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>1520.400000 0.000000 302.320000 0.000000 1525.900000 246.870000 0.000000 0.000000 1.000000</data> </K> <D type_id="opencv-matrix"> <rows>8</rows> <cols>1</cols> <dt>d</dt> <data>0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 </data> </D> <images> <templeR0001> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.02187598221295043000 0.98329680886213122000 -0.18068986436368856000 0.99856708067455469000 -0.01266114646423925600 0.05199500709979997700 0.04883878372068499500 -0.18156839221560722000 -0.98216479887691122000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0292149526928 -0.0241923869131 0.52269561933</data> </T> </templeR0001> <templeR0002> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.00272557078828676410 0.98353557606148900000 -0.18069405603193772000 0.99651741905514424000 -0.01773058775937118300 -0.08147797111723514800 -0.08334029507718225500 -0.17984270037758626000 -0.98015865977776562000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0288222339759 -0.0306361018019 0.525505113107</data> </T> </templeR0002> <templeR0003> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.01625331773280620100 0.98386957700862299000 -0.17814736905031653000 0.97668439268305030000 -0.02252259937820530100 -0.21349550254417543000 -0.21406407160478280000 -0.17746376518636725000 -0.96056399333613396000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0283090812583 -0.0366442193256 0.529139415773</data> </T> </templeR0003> <templeR0004> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.03472199972816788400 0.98429285136236500000 -0.17309524976677537000 0.93942192751145170000 -0.02695166652093134900 -0.34170169707277304000 -0.34099974317519038000 -0.17447403941185566000 -0.92373047190496216000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0276846518951 -0.0421095229316 0.533533672172</data> </T> </templeR0004> <templeR0005> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.05235090589954815400 0.98479784589115438000 -0.16562785206491965000 0.88539496349116698000 -0.03093875352325572600 -0.46380874523331522000 -0.46188217250287084000 -0.17092687400923678000 -0.87031538103463302000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0269600886818 -0.0469344855587 0.53860946783</data> </T> </templeR0005> <templeR0006> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.12459423323539082000 0.98895928871004091000 -0.08022345242268591500 0.28153512590579682000 -0.04229297064421112100 -0.95861842122676455000 -0.95142748011905343000 -0.14202404693648824000 -0.27315731761402628000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0213278189953 -0.0585886486063 0.577671141223</data> </T> </templeR0006> <templeR0007> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.12902889964175443000 0.98972522526380413000 -0.06160780416270468500 0.15113946088460242000 -0.04177353409104934300 -0.98762940175607139000 -0.98005530783764949000 -0.13674410526986550000 -0.14419654383234767000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0203322512475 -0.0573229419388 0.584525028903</data> </T> </templeR0007> <!--<templeR0008> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.13094087941651120000 0.99047594118902094000 -0.04256637197781731200 0.01804620524972981900 -0.04054762015799551900 -0.99901462700783672000 -0.99122591802964632000 -0.13158001529581215000 -0.01256499108788178600</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0193677533749 -0.0551454095765 0.591150514125</data> </T> </templeR0008> <templeR0009> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.13029605274095349000 0.99119803974812748000 -0.02343895559951655200 -0.11536955428847780000 -0.03863710562518051000 -0.99257092442413708000 -0.98473996800343433000 -0.12662393165740077000 0.11938833840965069000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0184515371141 -0.052094910199 0.597429363235</data> </T> </templeR0009> <templeR0010> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.12710592639585813000 0.99187863526170994000 -0.00456687928660556850 -0.24672704479464908000 -0.03607608317631801800 -0.96841328036616370000 -0.96071319801590616000 -0.12196429450467509000 0.24930876844593125000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0175999521295 -0.0482258792521 0.603249531644</data> </T> </templeR0010> <templeR0011> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.12142742908621770000 0.99250558231074071000 0.01371307943275649300 -0.37368215477705607000 -0.03291025497981744900 -0.92697279481025718000 -0.91957437255867858000 -0.11768425637773697000 0.37487783227890548000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0168281951954 -0.0436073606852 0.608507156804</data> </T> </templeR0011> <templeR0012> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.11336189346759781000 0.99306769310348053000 0.03107471678989884300 -0.49396938490232206000 -0.02919611501518744300 -0.86898897210910642000 -0.86205761285929272000 -0.11386019401947006000 0.49385476440871356000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0161500382152 -0.0383217716083 0.613108417072</data> </T> </templeR0012> <templeR0013> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.11541167827420966000 0.99138900083137627000 0.06187078105613172400 -0.68405289691836879000 0.03416081723372646500 0.72863205583031487000 0.72024424935956100000 -0.12641553542381334000 0.68210507523987296000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0193474918165 0.04321050765 0.589790751867</data> </T> </templeR0013> <templeR0014> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.12777196254899612000 0.99067700959105598000 0.04725873733079036200 -0.58073706790091917000 0.03610343749372974000 0.81329023095508723000 0.80400173106295025000 -0.13136058948124074000 0.57993586885009962000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.020311130356 0.0452044463785 0.583107596409</data> </T> </templeR0014> <templeR0015> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.13807231488914926000 0.98993281310425651000 0.03112975105337044400 -0.46705847237686349000 0.03736281839816532600 0.88343670015589459000 0.87337988254947896000 -0.13651756422101491000 0.46751527827122269000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0213062156734 0.0462806066905 0.576221332616</data> </T> </templeR0015> <templeR0016> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.14612892702451932000 0.98916969148300282000 0.01377164253398251200 -0.34504569459932793000 0.03791648656454157900 0.93781971011760457000 0.92714066102459869000 -0.14179443394584298000 0.34684943877257168000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.022314990573 0.046419784801 0.569254845159</data> </T> </templeR0016> <templeR0017> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.15179802911763335000 0.98840126254897120000 -0.00450583483961328880 -0.21687603817600701000 0.03775456170465282800 0.97546879864789560000 0.96432470798019132000 -0.14709703349180536000 0.22009161800675056000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.023319453575 0.0456194969081 0.56233245026</data> </T> </templeR0017> <templeR0018> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.15497845444162242000 0.98764123913336677000 -0.02337651432514656000 -0.08483672679970129200 0.03687993341332458700 0.99571210713606428000 0.98426846360370535000 -0.15233073647342665000 0.08950384506078289100</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0243016797537 0.0438940243752 0.555577680012</data> </T> </templeR0018> <templeR0019> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.15561344905257055000 0.98690318367577234000 -0.04250365307344607100 0.04871602898881084000 0.03530820922726550500 0.99818839849034746000 0.98661603625398486000 -0.15740214868860103000 -0.04258357188737407100</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0252441415132 0.0412741578549 0.549111071704</data> </T> </templeR0019> <templeR0020> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.15369168129242777000 0.98620026698413343000 -0.06154592189520560800 0.18139894256925762000 0.03306743700817096200 0.98285348259263228000 0.97132553283451883000 -0.16222076935502000000 -0.17381349560262413000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0261300203575 0.0378066496047 0.543048023786</data> </T> </templeR0020> <templeR0021> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.14924744465611009000 0.98554503244193847000 -0.08016351596979645600 0.31084431847048910000 0.03019760281070211000 0.94998100742020297000 0.93866980879233486000 -0.16670061131713207000 -0.30184415887715305000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0269435079864 0.033553376496 0.537496729928</data> </T> </templeR0021> <templeR0022> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.14236004780071046000 0.98494917289452277000 -0.09802419907642616300 0.43474216742556909000 0.02674991963607963000 0.90015759157026587000 0.88923161473954448000 -0.17076173053075644000 -0.42439081839012904000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0276700874835 0.0285902393879 0.532556254534</data> </T> </templeR0022> <templeR0023> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.13315239470762694000 0.98442332131574717000 -0.11480925151440334000 0.55088156138098920000 0.02278591058187676500 0.83427232221223668000 0.82389316365295051000 -0.17433165727608951000 -0.53926665774670712000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0282967932082 0.0230058042978 0.528314759229</data> </T> </templeR0023> <templeR0024> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.12178879854502510000 0.98397686167544829000 -0.13021913928564777000 0.65718996007304553000 0.01837631450844677200 0.75350094057292005000 0.74382043863297265000 -0.17734668520280353000 -0.64442168517161924000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.02881244142 0.0168997270462 0.524847934694</data> </T> </templeR0024> <templeR0025> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.10847204002101654000 0.98361776094118725000 -0.14397887655737707000 0.75177031506244740000 0.01359981962341879100 0.65928479301218457000 0.65044231867598168000 -0.17975301184474191000 -0.73797943386530540000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0292078304973 0.0103809691492 0.522217645599</data> </T> </templeR0025> <templeR0026> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.09343976044991392200 0.98335242736691753000 -0.15584291693450159000 0.83293481322054796000 0.00854166382610888240 0.55330519327431971000 0.54542516268715846000 -0.18150769562383026000 -0.81827033939708060000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0294759046107 0.00356585968151 0.520470830197</data> </T> </templeR0026> <templeR0027> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.07696020733473872600 0.98318559576803610000 -0.16559954939928406000 0.89923509311540939000 0.00329210872029469690 0.43745332245840185000 0.43064297718262490000 -0.18257942461960402000 -0.88386162939051693000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0296118800403 -0.00342398732706 0.519638659997</data> </T> </templeR0027> <templeR0028> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.05932746295193329400 0.98312024330151082000 -0.17307466409173006000 0.94948800754006690000 -0.00205516590155378630 0.31379658989656145000 0.30814408265822768000 -0.18294907352565445000 -0.93358280876354183000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0296133302663 -0.0104638360839 0.519735985312</data> </T> </templeR0028> <templeR0029> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.04085617948912668300 0.98315753616677781000 -0.17813486934349265000 0.98279680502378086000 -0.00740473917804992600 0.18454162097682264000 0.18011444315379183000 -0.18261004604395678000 -0.96654661473268999000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0294802294097 -0.017428062139 0.520761069394</data> </T> </templeR0029> <templeR0030> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.02187598221295046500 0.98329680886213122000 -0.18068986436368856000 0.99856708067455469000 -0.01266114646423924800 0.05199500709980022000 0.04883878372068523700 -0.18156839221560722000 -0.98216479887691122000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0292149526928 -0.0241923869131 0.52269561933</data> </T> </templeR0030> <templeR0031> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.00937296764199993530 0.98344162453868444000 -0.18098264724082042000 0.99925305205489368000 -0.01599729078633601100 -0.03517704715403165800 -0.03748980443482706500 -0.18051774929964823000 -0.98285698692700341000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0289726466043 -0.0284423587627 0.524433248357</data> </T> </templeR0031> <templeR0032> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.01469342934183854600 -0.99573306146750762000 -0.09110309234444970200 0.99863024345655671000 -0.01003794245248637200 -0.05135052643564889200 0.05021692929753969500 -0.09173281861943144400 0.99451664138920282000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0253214159027 -0.0293792487736 0.618360066</data> </T> </templeR0032> <templeR0033> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.00344069629113946850 -0.99586227407284378000 -0.09081020145059000300 0.99933561911064872000 -0.00671916164933668900 0.03582140761425173200 -0.03628335687017435900 -0.09062661830386635500 0.99522376080409014000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0251047679644 -0.0251578300064 0.620169213551</data> </T> </templeR0033> <templeR0034> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.01363654728930748000 -0.99598585067933787000 -0.08846598117119695800 0.98568300171389711000 -0.00148022139463806730 0.16860257731394196000 -0.16805673063078255000 -0.08949857088903123700 0.98170613785313243000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0248682934353 -0.0184255570846 0.6222160467</data> </T> </templeR0034> <templeR0035> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.03024984704142087700 -0.99601761198976480000 -0.08386813077789044600 0.95444181867062872000 0.00386319621827520880 0.29837206720415643000 -0.29685983481547856000 -0.08907296066251421700 0.95075772211018139000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.02475084721 -0.0114787519258 0.6233549331</data> </T> </templeR0035> <templeR0036> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.04610273394227399500 -0.99595699121457582000 -0.07709870020861223100 0.90616957770959716000 0.00921573639400264520 0.42281410411234677000 -0.42039414167737649000 -0.08935738275892947400 0.90293079678888799000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0247545251495 -0.00444138222871 0.623565549002</data> </T> </templeR0036> <templeR0037> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.06091231694352535600 -0.99580507011728536000 -0.06827848836405432700 0.84172768564816447000 0.01448188430858370400 0.53970804907862679000 -0.53645521048635192000 -0.09034676173267966500 0.83907882215347451000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0248792616217 0.00256097179509 0.622844136013</data> </T> </templeR0037> <templeR0038> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.07441431485673913300 -0.99556455977275171000 -0.05756489441395285000 0.76226612623790635000 0.01956766406619288600 0.64696789666354271000 -0.64297189871304494000 -0.09202344183674107700 0.76034125471255454000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0251228306692 0.00940335116174 0.621203567953</data> </T> </templeR0038> <templeR0039> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.08636778769614070200 -0.99523975203165982000 -0.04514909992939995800 0.66920287236824150000 0.02438232111996040500 0.74267962004547960000 -0.73804344104027464000 -0.09435750310793368500 0.66812314788867089000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0254808858594 0.0159636552164 0.618673120373</data> </T> </templeR0039> <templeR0040> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.10793659924390045000 -0.99055951509200579000 0.08450761861721302300 -0.32994878599451571000 0.04449292035991074500 0.94294972223262863000 -0.93780781035583538000 -0.12966197244580752000 -0.32203149494584499000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0313386715547 0.0461955496235 0.574657858455</data> </T> </templeR0040> <templeR0041> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.10064436337366003000 -0.98987287691280146000 0.10011193571939807000 -0.45281218231871551000 0.04402436503296685400 0.89051837871388495000 -0.88590735388350439000 -0.13495755938745446000 -0.44379569342131825000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0322465423181 0.0461686603603 0.567676168654</data> </T> </templeR0041> <templeR0042> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.09868778720769125200 -0.99342356952296929000 -0.05805456202825097500 0.72029150408413001000 -0.03105781339599184000 -0.69297587358527946000 0.68661551817612676000 -0.11020446335472237000 0.71861958396388448000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.028650693588 -0.0548464785114 0.59189613682</data> </T> </templeR0042> <templeR0043> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.08513547925382919400 -0.99399869748797920000 -0.06869162659612815200 0.80631333030563868000 -0.02823128526067348500 -0.59081452919165756000 0.58532961956802643000 -0.10568625229769273000 0.80387788409161853000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0278557511485 -0.0516471860246 0.598117193954</data> </T> </templeR0043> <templeR0044> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.07028452998918902100 -0.99451747087193221000 -0.07742793407223566600 0.87794743962593247000 -0.02482290748598041700 -0.47811307921684382000 0.47356982388922148000 -0.10158160952868461000 0.87487873360088786000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0271265258805 -0.0476405218956 0.603860347957</data> </T> </templeR0044> <templeR0045> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.05439995112000559800 -0.99497063228547356000 -0.08410758709882369700 0.93391553816646533000 -0.02089350177384347000 -0.35688265460073498000 0.35333045847956862000 -0.09796378143513864700 0.93035513898593913000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0264760306379 -0.042897984106 0.609023113594</data> </T> </templeR0045> <templeR0046> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.03776520743937929200 -0.99535009493528070000 -0.08861138538240269400 0.97321885941264064000 -0.01651318947821050300 -0.22928664648604202000 0.22675722875052765000 -0.09489732918046089900 0.96931710813530791000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0259158736918 -0.0375042045812 0.613513359853</data> </T> </templeR0046> <templeR0047> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.02067714204649669800 -0.99564908739937330000 -0.09085895969899916700 0.99515604481568609000 -0.01176013624456452200 -0.09760197570904494100 0.09610880429798678000 -0.09243697288587854300 0.99106937384832272000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0254560509115 -0.0315554340517 0.617250959345</data> </T> </templeR0047>--> </images> </opencv_storage>
3dReconstruction
Source/Build3dModel/Build3dModel/TempleModel/TempleModelCameraParameters.xml
XML
New BSD License (BSD)
27,564
<?xml version="1.0"?> <opencv_storage> <imageWidth>640</imageWidth> <imageHeight>480</imageHeight> <extension>png</extension> <K type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>1520.400000 0.000000 302.320000 0.000000 1525.900000 246.870000 0.000000 0.000000 1.000000</data> </K> <D type_id="opencv-matrix"> <rows>8</rows> <cols>1</cols> <dt>d</dt> <data>0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 </data> </D> <images> <templeR0001> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.02187598221295043000 0.98329680886213122000 -0.18068986436368856000 0.99856708067455469000 -0.01266114646423925600 0.05199500709979997700 0.04883878372068499500 -0.18156839221560722000 -0.98216479887691122000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0292149526928 -0.0241923869131 0.52269561933</data> </T> </templeR0001> <templeR0002> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.00272557078828676410 0.98353557606148900000 -0.18069405603193772000 0.99651741905514424000 -0.01773058775937118300 -0.08147797111723514800 -0.08334029507718225500 -0.17984270037758626000 -0.98015865977776562000</data> </R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0288222339759 -0.0306361018019 0.525505113107</data> </T> </templeR0002> </images> </opencv_storage>
3dReconstruction
Source/Build3dModel/Build3dModel/TempleModel/TempleModelCameraParameters123.xml
XML
New BSD License (BSD)
1,716
#include "opencv2/highgui/highgui.hpp" #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/nonfree/nonfree.hpp" #include <iostream> using namespace cv; using namespace std; static void help(char** argv) { cout << "\nThis program demonstrats keypoint finding and matching between 2 images using features2d framework.\n" << " In one case, the 2nd image is synthesized by homography from the first, in the second case, there are 2 images\n" << "\n" << "Case1: second image is obtained from the first (given) image using random generated homography matrix\n" << argv[0] << " [detectorType] [descriptorType] [matcherType] [matcherFilterType] [image] [evaluate(0 or 1)]\n" << "Example of case1:\n" << "./descriptor_extractor_matcher SURF SURF FlannBased NoneFilter cola.jpg 0\n" << "\n" << "Case2: both images are given. If ransacReprojThreshold>=0 then homography matrix are calculated\n" << argv[0] << " [detectorType] [descriptorType] [matcherType] [matcherFilterType] [image1] [image2] [ransacReprojThreshold]\n" << "\n" << "Matches are filtered using homography matrix in case1 and case2 (if ransacReprojThreshold>=0)\n" << "Example of case2:\n" << "./descriptor_extractor_matcher SURF SURF BruteForce CrossCheckFilter cola1.jpg cola2.jpg 3\n" << "\n" << "Possible detectorType values: see in documentation on createFeatureDetector().\n" << "Possible descriptorType values: see in documentation on createDescriptorExtractor().\n" << "Possible matcherType values: see in documentation on createDescriptorMatcher().\n" << "Possible matcherFilterType values: NoneFilter, CrossCheckFilter." << endl; } #define DRAW_RICH_KEYPOINTS_MODE 0 #define DRAW_OUTLIERS_MODE 0 const string winName = "correspondences"; enum { NONE_FILTER = 0, CROSS_CHECK_FILTER = 1 }; static int getMatcherFilterType( const string& str ) { if( str == "NoneFilter" ) return NONE_FILTER; if( str == "CrossCheckFilter" ) return CROSS_CHECK_FILTER; CV_Error(CV_StsBadArg, "Invalid filter name"); return -1; } static void simpleMatching( Ptr<DescriptorMatcher>& descriptorMatcher, const Mat& descriptors1, const Mat& descriptors2, vector<DMatch>& matches12 ) { vector<DMatch> matches; descriptorMatcher->match( descriptors1, descriptors2, matches12 ); } static void crossCheckMatching( Ptr<DescriptorMatcher>& descriptorMatcher, const Mat& descriptors1, const Mat& descriptors2, vector<DMatch>& filteredMatches12, int knn=1 ) { filteredMatches12.clear(); vector<vector<DMatch> > matches12, matches21; descriptorMatcher->knnMatch( descriptors1, descriptors2, matches12, knn ); descriptorMatcher->knnMatch( descriptors2, descriptors1, matches21, knn ); for( size_t m = 0; m < matches12.size(); m++ ) { bool findCrossCheck = false; for( size_t fk = 0; fk < matches12[m].size(); fk++ ) { DMatch forward = matches12[m][fk]; for( size_t bk = 0; bk < matches21[forward.trainIdx].size(); bk++ ) { DMatch backward = matches21[forward.trainIdx][bk]; if( backward.trainIdx == forward.queryIdx ) { filteredMatches12.push_back(forward); findCrossCheck = true; break; } } if( findCrossCheck ) break; } } } static void warpPerspectiveRand( const Mat& src, Mat& dst, Mat& H, RNG& rng ) { H.create(3, 3, CV_32FC1); H.at<float>(0,0) = rng.uniform( 0.8f, 1.2f); H.at<float>(0,1) = rng.uniform(-0.1f, 0.1f); H.at<float>(0,2) = rng.uniform(-0.1f, 0.1f)*src.cols; H.at<float>(1,0) = rng.uniform(-0.1f, 0.1f); H.at<float>(1,1) = rng.uniform( 0.8f, 1.2f); H.at<float>(1,2) = rng.uniform(-0.1f, 0.1f)*src.rows; H.at<float>(2,0) = rng.uniform( -1e-4f, 1e-4f); H.at<float>(2,1) = rng.uniform( -1e-4f, 1e-4f); H.at<float>(2,2) = rng.uniform( 0.8f, 1.2f); warpPerspective( src, dst, H, src.size() ); } static void doIteration( const Mat& img1, Mat& img2, bool isWarpPerspective, vector<KeyPoint>& keypoints1, const Mat& descriptors1, Ptr<FeatureDetector>& detector, Ptr<DescriptorExtractor>& descriptorExtractor, Ptr<DescriptorMatcher>& descriptorMatcher, int matcherFilter, bool eval, double ransacReprojThreshold, RNG& rng ) { assert( !img1.empty() ); Mat H12; if( isWarpPerspective ) warpPerspectiveRand(img1, img2, H12, rng ); else assert( !img2.empty()/* && img2.cols==img1.cols && img2.rows==img1.rows*/ ); cout << endl << "< Extracting keypoints from second image..." << endl; vector<KeyPoint> keypoints2; detector->detect( img2, keypoints2 ); cout << keypoints2.size() << " points" << endl << ">" << endl; if( !H12.empty() && eval ) { cout << "< Evaluate feature detector..." << endl; float repeatability; int correspCount; evaluateFeatureDetector( img1, img2, H12, &keypoints1, &keypoints2, repeatability, correspCount ); cout << "repeatability = " << repeatability << endl; cout << "correspCount = " << correspCount << endl; cout << ">" << endl; } cout << "< Computing descriptors for keypoints from second image..." << endl; Mat descriptors2; descriptorExtractor->compute( img2, keypoints2, descriptors2 ); cout << ">" << endl; cout << "< Matching descriptors..." << endl; vector<DMatch> filteredMatches; switch( matcherFilter ) { case CROSS_CHECK_FILTER : crossCheckMatching( descriptorMatcher, descriptors1, descriptors2, filteredMatches, 1 ); break; default : simpleMatching( descriptorMatcher, descriptors1, descriptors2, filteredMatches ); } cout << ">" << endl; /*if( !H12.empty() && eval ) { cout << "< Evaluate descriptor matcher..." << endl; vector<Point2f> curve; Ptr<GenericDescriptorMatcher> gdm = new VectorDescriptorMatcher( descriptorExtractor, descriptorMatcher ); evaluateGenericDescriptorMatcher( img1, img2, H12, keypoints1, keypoints2, 0, 0, curve, gdm ); Point2f firstPoint = *curve.begin(); Point2f lastPoint = *curve.rbegin(); int prevPointIndex = -1; cout << "1-precision = " << firstPoint.x << "; recall = " << firstPoint.y << endl; for( float l_p = 0; l_p <= 1 + FLT_EPSILON; l_p+=0.05f ) { int nearest = getNearestPoint( curve, l_p ); if( nearest >= 0 ) { Point2f curPoint = curve[nearest]; if( curPoint.x > firstPoint.x && curPoint.x < lastPoint.x && nearest != prevPointIndex ) { cout << "1-precision = " << curPoint.x << "; recall = " << curPoint.y << endl; prevPointIndex = nearest; } } } cout << "1-precision = " << lastPoint.x << "; recall = " << lastPoint.y << endl; cout << ">" << endl; }*/ vector<int> queryIdxs( filteredMatches.size() ), trainIdxs( filteredMatches.size() ); for( size_t i = 0; i < filteredMatches.size(); i++ ) { queryIdxs[i] = filteredMatches[i].queryIdx; trainIdxs[i] = filteredMatches[i].trainIdx; } if( !isWarpPerspective && ransacReprojThreshold >= 0 ) { cout << "< Computing homography (RANSAC)..." << endl; vector<Point2f> points1; KeyPoint::convert(keypoints1, points1, queryIdxs); vector<Point2f> points2; KeyPoint::convert(keypoints2, points2, trainIdxs); H12 = findHomography( Mat(points1), Mat(points2), CV_RANSAC, ransacReprojThreshold ); cout << ">" << endl; } Mat drawImg; if( !H12.empty() ) // filter outliers { vector<char> matchesMask( filteredMatches.size(), 0 ); vector<Point2f> points1; KeyPoint::convert(keypoints1, points1, queryIdxs); vector<Point2f> points2; KeyPoint::convert(keypoints2, points2, trainIdxs); Mat points1t; perspectiveTransform(Mat(points1), points1t, H12); double maxInlierDist = ransacReprojThreshold < 0 ? 3 : ransacReprojThreshold; int inlierCount = 0; for( size_t i1 = 0; i1 < points1.size(); i1++ ) { if( norm(points2[i1] - points1t.at<Point2f>((int)i1,0)) <= maxInlierDist ) // inlier { matchesMask[i1] = 1; inlierCount++; } } cout<<"\nInliers Count: "<<inlierCount<<endl; // draw inliers drawMatches( img1, keypoints1, img2, keypoints2, filteredMatches, drawImg, CV_RGB(0, 255, 0), CV_RGB(0, 0, 255), matchesMask #if DRAW_RICH_KEYPOINTS_MODE , DrawMatchesFlags::DRAW_RICH_KEYPOINTS #endif ); #if DRAW_OUTLIERS_MODE // draw outliers for( size_t i1 = 0; i1 < matchesMask.size(); i1++ ) matchesMask[i1] = !matchesMask[i1]; drawMatches( img1, keypoints1, img2, keypoints2, filteredMatches, drawImg, CV_RGB(0, 0, 255), CV_RGB(255, 0, 0), matchesMask, DrawMatchesFlags::DRAW_OVER_OUTIMG | DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS ); #endif } else drawMatches( img1, keypoints1, img2, keypoints2, filteredMatches, drawImg ); imshow( winName, drawImg ); } int main(int argc, char** argv) { if( argc != 7 && argc != 8 ) { help(argv); return -1; } cv::initModule_nonfree(); bool isWarpPerspective = argc == 7; double ransacReprojThreshold = -1; if( !isWarpPerspective ) ransacReprojThreshold = atof(argv[7]); cout << "< Creating detector, descriptor extractor and descriptor matcher ..." << endl; Ptr<FeatureDetector> detector = FeatureDetector::create( argv[1] ); Ptr<DescriptorExtractor> descriptorExtractor = DescriptorExtractor::create( argv[2] ); Ptr<DescriptorMatcher> descriptorMatcher = DescriptorMatcher::create( argv[3] ); int mactherFilterType = getMatcherFilterType( argv[4] ); bool eval = !isWarpPerspective ? false : (atoi(argv[6]) == 0 ? false : true); cout << ">" << endl; if( detector.empty() || descriptorExtractor.empty() || descriptorMatcher.empty() ) { cout << "Can not create detector or descriptor exstractor or descriptor matcher of given types" << endl; return -1; } cout << "< Reading the images..." << endl; Mat img1 = imread( argv[5] ), img2; if( !isWarpPerspective ) img2 = imread( argv[6] ); cout << ">" << endl; if( img1.empty() || (!isWarpPerspective && img2.empty()) ) { cout << "Can not read images" << endl; return -1; } cout << endl << "< Extracting keypoints from first image..." << endl; vector<KeyPoint> keypoints1; detector->detect( img1, keypoints1 ); cout << keypoints1.size() << " points" << endl << ">" << endl; cout << "< Computing descriptors for keypoints from first image..." << endl; Mat descriptors1; descriptorExtractor->compute( img1, keypoints1, descriptors1 ); cout << ">" << endl; namedWindow(winName, 1); RNG rng = theRNG(); doIteration( img1, img2, isWarpPerspective, keypoints1, descriptors1, detector, descriptorExtractor, descriptorMatcher, 0/*mactherFilterType*/, eval, ransacReprojThreshold, rng ); for(;;) { char c = (char)waitKey(0); if( c == '\x1b' ) // esc { cout << "Exiting ..." << endl; break; } else if( isWarpPerspective ) { doIteration( img1, img2, isWarpPerspective, keypoints1, descriptors1, detector, descriptorExtractor, descriptorMatcher, mactherFilterType, eval, ransacReprojThreshold, rng ); } } return 0; }
3dReconstruction
Spikes/DescriptorMatcher/descriptor_extractor_matcher.cpp
C++
New BSD License (BSD)
12,141
///* // * stereo_match.cpp // * calibration // * // * Created by Victor Eruhimov on 1/18/10. // * Copyright 2010 Argus Corp. All rights reserved. // * // */ // //#include "opencv2/calib3d/calib3d.hpp" //#include "opencv2/imgproc/imgproc.hpp" //#include "opencv2/highgui/highgui.hpp" //#include "opencv2/contrib/contrib.hpp" //#include <iostream> // //#include <stdio.h> // //using namespace std; //using namespace cv; // //static void print_help() //{ // printf("\nDemo stereo matching converting L and R images into disparity and point clouds\n"); // printf("\nUsage: stereo_match <left_image> <right_image> [--algorithm=bm|sgbm|hh|var] [--blocksize=<block_size>]\n" // "[--max-disparity=<max_disparity>] [--scale=scale_factor>] [-i <intrinsic_filename>] [-e <extrinsic_filename>]\n" // "[--no-display] [-o <disparity_image>] [-p <point_cloud_file>]\n"); //} // //static void calculateRotationAndTranslationMatNames(const char* imageName, char** rotationName, char** translationName) //{ // //*rotationName = new char[strlen(imageName)]; // //*translationName = new char[strlen(imageName)]; // // // char* tempR = new char[strlen(imageName)]; // char* tempT = new char[strlen(imageName)]; // strncpy(tempR, imageName, strlen(imageName) - 4); // tempR[strlen(imageName) - 4] = '\0'; // // strcat(tempR, "R"); // // // /*strncpy(*rotationName, imageName, strlen(imageName) - 4); // rotationName[strlen(imageName)-4] = '\0'; // strcat(*rotationName,"R");*/ // // strncpy(tempT, tempR, strlen(tempR) - 1 ); // tempT[strlen(tempR) - 1] = '\0'; // strcat(tempT,"T"); // // *rotationName = tempR; // *translationName = tempT; //} // //static void OutputMatrix(const Mat mat) //{ // for(int i = 0; i < mat.rows; i++) // { // for(int j = 0; j < mat.cols; j++) // { // cout << mat.at<double>(i,j)<< " "; // } // cout<<endl; // } // cout<<endl; // cout<<endl; //} // //static void computeRotationAnTranslationMat( const Mat& R1, const Mat& t1, // const Mat& R2, const Mat& t2, // const Mat& cameraMatrix, // Mat& R, Mat& t) //{ // R = R2*R1.t(); // t = t2 - R*t1; // // //OutputMatrix(R); // //OutputMatrix(t); // // // double tx = t.at<double>(0,0), ty = t.at<double>(1,0), tz = t.at<double>(2,0); // t.at<double>(0,0) = ty; // t.at<double>(1,0) = tz; // t.at<double>(2,0) = tx; // // Mat rRodrigues = Mat_<double>(3,1); // Rodrigues(R,rRodrigues); // // double rx = rRodrigues.at<double>(0,0); // double ry = rRodrigues.at<double>(1,0); // double rz = rRodrigues.at<double>(2,0); // // rRodrigues.at<double>(0,0) = ry; // rRodrigues.at<double>(1,0) = rz; // rRodrigues.at<double>(2,0) = rx; // // Rodrigues(rRodrigues,R); // // OutputMatrix(R); // OutputMatrix(t); //} // //static void saveXYZ(const char* filename, const Mat& mat) //{ // const double max_z = 1.0e4; // FILE* fp = fopen(filename, "wt"); // for(int y = 0; y < mat.rows; y++) // { // for(int x = 0; x < mat.cols; x++) // { // Vec3f point = mat.at<Vec3f>(y, x); // if(fabs(point[2] - max_z) < FLT_EPSILON || fabs(point[2]) > max_z) continue; // fprintf(fp, "%f %f %f\n", point[0], point[1], point[2]); // } // } // fclose(fp); //} // //int main(int argc, char** argv) //{ // const char* algorithm_opt = "--algorithm="; // const char* maxdisp_opt = "--max-disparity="; // const char* blocksize_opt = "--blocksize="; // const char* nodisplay_opt = "--no-display="; // const char* scale_opt = "--scale="; // // if(argc < 3) // { // print_help(); // return 0; // } // const char* img1_filename = 0; // const char* img2_filename = 0; // const char* intrinsic_filename = 0; // const char* extrinsic_filename = 0; // const char* disparity_filename = 0; // const char* point_cloud_filename = 0; // // enum { STEREO_BM=0, STEREO_SGBM=1, STEREO_HH=2, STEREO_VAR=3 }; // int alg = STEREO_BM; // int SADWindowSize = 0, numberOfDisparities = 0; // bool no_display = false; // float scale = 1.0f; // // StereoBM bm; // StereoSGBM sgbm; // StereoVar var; // // for( int i = 1; i < argc; i++ ) // { // if( argv[i][0] != '-' ) // { // if( !img1_filename ) // img1_filename = argv[i]; // else // img2_filename = argv[i]; // } // else if( strncmp(argv[i], algorithm_opt, strlen(algorithm_opt)) == 0 ) // { // char* _alg = argv[i] + strlen(algorithm_opt); // alg = strcmp(_alg, "bm") == 0 ? STEREO_BM : // strcmp(_alg, "sgbm") == 0 ? STEREO_SGBM : // strcmp(_alg, "hh") == 0 ? STEREO_HH : // strcmp(_alg, "var") == 0 ? STEREO_VAR : -1; // if( alg < 0 ) // { // printf("Command-line parameter error: Unknown stereo algorithm\n\n"); // print_help(); // return -1; // } // } // else if( strncmp(argv[i], maxdisp_opt, strlen(maxdisp_opt)) == 0 ) // { // if( sscanf( argv[i] + strlen(maxdisp_opt), "%d", &numberOfDisparities ) != 1 || // numberOfDisparities < 1 || numberOfDisparities % 16 != 0 ) // { // printf("Command-line parameter error: The max disparity (--maxdisparity=<...>) must be a positive integer divisible by 16\n"); // print_help(); // return -1; // } // } // else if( strncmp(argv[i], blocksize_opt, strlen(blocksize_opt)) == 0 ) // { // if( sscanf( argv[i] + strlen(blocksize_opt), "%d", &SADWindowSize ) != 1 || // SADWindowSize < 1 || SADWindowSize % 2 != 1 ) // { // printf("Command-line parameter error: The block size (--blocksize=<...>) must be a positive odd number\n"); // return -1; // } // } // else if( strncmp(argv[i], scale_opt, strlen(scale_opt)) == 0 ) // { // if( sscanf( argv[i] + strlen(scale_opt), "%f", &scale ) != 1 || scale < 0 ) // { // printf("Command-line parameter error: The scale factor (--scale=<...>) must be a positive floating-point number\n"); // return -1; // } // } // else if( strcmp(argv[i], nodisplay_opt) == 0 ) // no_display = true; // else if( strcmp(argv[i], "-i" ) == 0 ) // intrinsic_filename = argv[++i]; // else if( strcmp(argv[i], "-e" ) == 0 ) // extrinsic_filename = argv[++i]; // else if( strcmp(argv[i], "-o" ) == 0 ) // disparity_filename = argv[++i]; // else if( strcmp(argv[i], "-p" ) == 0 ) // point_cloud_filename = argv[++i]; // else // { // printf("Command-line parameter error: unknown option %s\n", argv[i]); // return -1; // } // } // // if( !img1_filename || !img2_filename ) // { // printf("Command-line parameter error: both left and right images must be specified\n"); // return -1; // } // // // if((intrinsic_filename != 0) && (extrinsic_filename == 0)) // { // extrinsic_filename = intrinsic_filename; // } // // if( (intrinsic_filename != 0) ^ (extrinsic_filename != 0) ) // { // printf("Command-line parameter error: either both intrinsic and extrinsic parameters must be specified, or none of them (when the stereo pair is already rectified)\n"); // return -1; // } // // if( extrinsic_filename == 0 && point_cloud_filename ) // { // printf("Command-line parameter error: extrinsic and intrinsic parameters must be specified to compute the point cloud\n"); // return -1; // } // // int color_mode = alg == STEREO_BM ? 0 : -1; // Mat img1 = imread(img1_filename, color_mode); // Mat img2 = imread(img2_filename, color_mode); // // if( scale != 1.f ) // { // Mat temp1, temp2; // int method = scale < 1 ? INTER_AREA : INTER_CUBIC; // resize(img1, temp1, Size(), scale, scale, method); // img1 = temp1; // resize(img2, temp2, Size(), scale, scale, method); // img2 = temp2; // } // // Size img_size = img1.size(); // // Rect roi1, roi2; // Mat Q; // // if( intrinsic_filename ) // { // // reading intrinsic parameters // FileStorage fs(intrinsic_filename, CV_STORAGE_READ); // if(!fs.isOpened()) // { // printf("Failed to open file %s\n", intrinsic_filename); // return -1; // } // // Mat M1, D1, M2, D2; // fs["K"] >> M1; // fs["D"] >> D1; // fs["K"] >> M2; // fs["D"] >> D2; // // M1 *= scale; // M2 *= scale; // // fs.open(extrinsic_filename, CV_STORAGE_READ); // if(!fs.isOpened()) // { // printf("Failed to open file %s\n", extrinsic_filename); // return -1; // } // // char* leftRotationName = 0; // char* leftTranslationName = 0; // char* rightRotationName = 0; // char* rightTranslationName = 0; // // calculateRotationAndTranslationMatNames(img1_filename, &leftRotationName, &leftTranslationName); // calculateRotationAndTranslationMatNames(img2_filename, &rightRotationName, &rightTranslationName); // // Mat leftRotation, leftTranslation, rightRotation, rightTranslation; // fs[leftRotationName] >> leftRotation; // fs[leftTranslationName] >> leftTranslation; // fs[rightRotationName] >> rightRotation; // fs[rightTranslationName] >> rightTranslation; // // Mat R, T, R1, P1, R2, P2; // // computeRotationAnTranslationMat(leftRotation,leftTranslation,rightRotation,rightTranslation,M1,R,T); // // OutputMatrix(R); // OutputMatrix(T); // // stereoRectify( M1, D1, M2, D2, img_size, R, T, R1, R2, P1, P2, Q, CALIB_ZERO_DISPARITY, -1, img_size, &roi1, &roi2 ); // // Mat map11, map12, map21, map22; // initUndistortRectifyMap(M1, D1, R1, P1, img_size, CV_16SC2, map11, map12); // initUndistortRectifyMap(M2, D2, R2, P2, img_size, CV_16SC2, map21, map22); // // Mat img1r, img2r; // remap(img1, img1r, map11, map12, INTER_LINEAR); // remap(img2, img2r, map21, map22, INTER_LINEAR); // // img1 = img1r; // img2 = img2r; // } // // numberOfDisparities = numberOfDisparities > 0 ? numberOfDisparities : ((img_size.width/8) + 15) & -16; // // bm.state->roi1 = roi1; // bm.state->roi2 = roi2; // bm.state->preFilterCap = 31; // bm.state->SADWindowSize = SADWindowSize > 0 ? SADWindowSize : 9; // bm.state->minDisparity = 0; // bm.state->numberOfDisparities = numberOfDisparities; // bm.state->textureThreshold = 10; // bm.state->uniquenessRatio = 15; // bm.state->speckleWindowSize = 100; // bm.state->speckleRange = 32; // bm.state->disp12MaxDiff = 1; // // sgbm.preFilterCap = 63; // sgbm.SADWindowSize = SADWindowSize > 0 ? SADWindowSize : 3; // // int cn = img1.channels(); // // sgbm.P1 = 8*cn*sgbm.SADWindowSize*sgbm.SADWindowSize; // sgbm.P2 = 32*cn*sgbm.SADWindowSize*sgbm.SADWindowSize; // sgbm.minDisparity = 0; // sgbm.numberOfDisparities = numberOfDisparities; // sgbm.uniquenessRatio = 10; // sgbm.speckleWindowSize = bm.state->speckleWindowSize; // sgbm.speckleRange = bm.state->speckleRange; // sgbm.disp12MaxDiff = 1; // sgbm.fullDP = alg == STEREO_HH; // // var.levels = 3; // ignored with USE_AUTO_PARAMS // var.pyrScale = 0.5; // ignored with USE_AUTO_PARAMS // var.nIt = 25; // var.minDisp = -numberOfDisparities; // var.maxDisp = 0; // var.poly_n = 3; // var.poly_sigma = 0.0; // var.fi = 15.0f; // var.lambda = 0.03f; // var.penalization = var.PENALIZATION_TICHONOV; // ignored with USE_AUTO_PARAMS // var.cycle = var.CYCLE_V; // ignored with USE_AUTO_PARAMS // var.flags = var.USE_SMART_ID | var.USE_AUTO_PARAMS | var.USE_INITIAL_DISPARITY | var.USE_MEDIAN_FILTERING ; // // Mat disp, disp8; // //Mat img1p, img2p, dispp; // //copyMakeBorder(img1, img1p, 0, 0, numberOfDisparities, 0, IPL_BORDER_REPLICATE); // //copyMakeBorder(img2, img2p, 0, 0, numberOfDisparities, 0, IPL_BORDER_REPLICATE); // // int64 t = getTickCount(); // if( alg == STEREO_BM ) // bm(img1, img2, disp); // else if( alg == STEREO_VAR ) { // var(img1, img2, disp); // } // else if( alg == STEREO_SGBM || alg == STEREO_HH ) // sgbm(img1, img2, disp); // t = getTickCount() - t; // printf("Time elapsed: %fms\n", t*1000/getTickFrequency()); // // //disp = dispp.colRange(numberOfDisparities, img1p.cols); // if( alg != STEREO_VAR ) // disp.convertTo(disp8, CV_8U, 255/(numberOfDisparities*16.)); // else // disp.convertTo(disp8, CV_8U); // if( !no_display ) // { // namedWindow("left", 1); // imshow("left", img1); // namedWindow("right", 1); // imshow("right", img2); // namedWindow("disparity", 0); // imshow("disparity", disp8); // printf("press any key to continue..."); // fflush(stdout); // waitKey(); // printf("\n"); // } // // if(disparity_filename) // imwrite(disparity_filename, disp8); // // if(point_cloud_filename) // { // printf("storing the point cloud..."); // fflush(stdout); // Mat xyz; // reprojectImageTo3D(disp, xyz, Q, true); // saveXYZ(point_cloud_filename, xyz); // printf("\n"); // } // // return 0; //}
3dReconstruction
Spikes/StereoMatch/stereo_match.cpp
C++
New BSD License (BSD)
13,693
<?xml version="1.0"?> <opencv_storage> <K type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>1520.400000 0.000000 302.320000 0.000000 1525.900000 246.870000 0.000000 0.000000 1.000000</data> </K> <D type_id="opencv-matrix"> <rows>8</rows> <cols>1</cols> <dt>d</dt> <data>0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 </data> </D> <templeR0001R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.02187598221295043000 0.98329680886213122000 -0.18068986436368856000 0.99856708067455469000 -0.01266114646423925600 0.05199500709979997700 0.04883878372068499500 -0.18156839221560722000 -0.98216479887691122000</data> </templeR0001R> <templeR0001T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0292149526928 -0.0241923869131 0.52269561933</data> </templeR0001T> <templeR0002R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.00272557078828676410 0.98353557606148900000 -0.18069405603193772000 0.99651741905514424000 -0.01773058775937118300 -0.08147797111723514800 -0.08334029507718225500 -0.17984270037758626000 -0.98015865977776562000</data> </templeR0002R> <templeR0002T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0288222339759 -0.0306361018019 0.525505113107</data> </templeR0002T> <templeR0003R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.01625331773280620100 0.98386957700862299000 -0.17814736905031653000 0.97668439268305030000 -0.02252259937820530100 -0.21349550254417543000 -0.21406407160478280000 -0.17746376518636725000 -0.96056399333613396000</data> </templeR0003R> <templeR0003T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0283090812583 -0.0366442193256 0.529139415773</data> </templeR0003T> <templeR0004R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.03472199972816788400 0.98429285136236500000 -0.17309524976677537000 0.93942192751145170000 -0.02695166652093134900 -0.34170169707277304000 -0.34099974317519038000 -0.17447403941185566000 -0.92373047190496216000</data> </templeR0004R> <templeR0004T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0276846518951 -0.0421095229316 0.533533672172</data> </templeR0004T> <templeR0005R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.05235090589954815400 0.98479784589115438000 -0.16562785206491965000 0.88539496349116698000 -0.03093875352325572600 -0.46380874523331522000 -0.46188217250287084000 -0.17092687400923678000 -0.87031538103463302000</data> </templeR0005R> <templeR0005T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0269600886818 -0.0469344855587 0.53860946783</data> </templeR0005T> <templeR0006R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.12459423323539082000 0.98895928871004091000 -0.08022345242268591500 0.28153512590579682000 -0.04229297064421112100 -0.95861842122676455000 -0.95142748011905343000 -0.14202404693648824000 -0.27315731761402628000</data> </templeR0006R> <templeR0006T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0213278189953 -0.0585886486063 0.577671141223</data> </templeR0006T> <templeR0007R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.12902889964175443000 0.98972522526380413000 -0.06160780416270468500 0.15113946088460242000 -0.04177353409104934300 -0.98762940175607139000 -0.98005530783764949000 -0.13674410526986550000 -0.14419654383234767000</data> </templeR0007R> <templeR0007T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0203322512475 -0.0573229419388 0.584525028903</data> </templeR0007T> <templeR0008R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.13094087941651120000 0.99047594118902094000 -0.04256637197781731200 0.01804620524972981900 -0.04054762015799551900 -0.99901462700783672000 -0.99122591802964632000 -0.13158001529581215000 -0.01256499108788178600</data> </templeR0008R> <templeR0008T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0193677533749 -0.0551454095765 0.591150514125</data> </templeR0008T> <templeR0009R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.13029605274095349000 0.99119803974812748000 -0.02343895559951655200 -0.11536955428847780000 -0.03863710562518051000 -0.99257092442413708000 -0.98473996800343433000 -0.12662393165740077000 0.11938833840965069000</data> </templeR0009R> <templeR0009T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0184515371141 -0.052094910199 0.597429363235</data> </templeR0009T> <templeR0010R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.12710592639585813000 0.99187863526170994000 -0.00456687928660556850 -0.24672704479464908000 -0.03607608317631801800 -0.96841328036616370000 -0.96071319801590616000 -0.12196429450467509000 0.24930876844593125000</data> </templeR0010R> <templeR0010T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0175999521295 -0.0482258792521 0.603249531644</data> </templeR0010T> <templeR0011R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.12142742908621770000 0.99250558231074071000 0.01371307943275649300 -0.37368215477705607000 -0.03291025497981744900 -0.92697279481025718000 -0.91957437255867858000 -0.11768425637773697000 0.37487783227890548000</data> </templeR0011R> <templeR0011T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0168281951954 -0.0436073606852 0.608507156804</data> </templeR0011T> <templeR0012R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.11336189346759781000 0.99306769310348053000 0.03107471678989884300 -0.49396938490232206000 -0.02919611501518744300 -0.86898897210910642000 -0.86205761285929272000 -0.11386019401947006000 0.49385476440871356000</data> </templeR0012R> <templeR0012T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0161500382152 -0.0383217716083 0.613108417072</data> </templeR0012T> <templeR0013R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.11541167827420966000 0.99138900083137627000 0.06187078105613172400 -0.68405289691836879000 0.03416081723372646500 0.72863205583031487000 0.72024424935956100000 -0.12641553542381334000 0.68210507523987296000</data> </templeR0013R> <templeR0013T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0193474918165 0.04321050765 0.589790751867</data> </templeR0013T> <templeR0014R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.12777196254899612000 0.99067700959105598000 0.04725873733079036200 -0.58073706790091917000 0.03610343749372974000 0.81329023095508723000 0.80400173106295025000 -0.13136058948124074000 0.57993586885009962000</data> </templeR0014R> <templeR0014T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.020311130356 0.0452044463785 0.583107596409</data> </templeR0014T> <templeR0015R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.13807231488914926000 0.98993281310425651000 0.03112975105337044400 -0.46705847237686349000 0.03736281839816532600 0.88343670015589459000 0.87337988254947896000 -0.13651756422101491000 0.46751527827122269000</data> </templeR0015R> <templeR0015T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0213062156734 0.0462806066905 0.576221332616</data> </templeR0015T> <templeR0016R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.14612892702451932000 0.98916969148300282000 0.01377164253398251200 -0.34504569459932793000 0.03791648656454157900 0.93781971011760457000 0.92714066102459869000 -0.14179443394584298000 0.34684943877257168000</data> </templeR0016R> <templeR0016T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.022314990573 0.046419784801 0.569254845159</data> </templeR0016T> <templeR0017R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.15179802911763335000 0.98840126254897120000 -0.00450583483961328880 -0.21687603817600701000 0.03775456170465282800 0.97546879864789560000 0.96432470798019132000 -0.14709703349180536000 0.22009161800675056000</data> </templeR0017R> <templeR0017T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.023319453575 0.0456194969081 0.56233245026</data> </templeR0017T> <templeR0018R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.15497845444162242000 0.98764123913336677000 -0.02337651432514656000 -0.08483672679970129200 0.03687993341332458700 0.99571210713606428000 0.98426846360370535000 -0.15233073647342665000 0.08950384506078289100</data> </templeR0018R> <templeR0018T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0243016797537 0.0438940243752 0.555577680012</data> </templeR0018T> <templeR0019R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.15561344905257055000 0.98690318367577234000 -0.04250365307344607100 0.04871602898881084000 0.03530820922726550500 0.99818839849034746000 0.98661603625398486000 -0.15740214868860103000 -0.04258357188737407100</data> </templeR0019R> <templeR0019T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0252441415132 0.0412741578549 0.549111071704</data> </templeR0019T> <templeR0020R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.15369168129242777000 0.98620026698413343000 -0.06154592189520560800 0.18139894256925762000 0.03306743700817096200 0.98285348259263228000 0.97132553283451883000 -0.16222076935502000000 -0.17381349560262413000</data> </templeR0020R> <templeR0020T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0261300203575 0.0378066496047 0.543048023786</data> </templeR0020T> <templeR0021R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.14924744465611009000 0.98554503244193847000 -0.08016351596979645600 0.31084431847048910000 0.03019760281070211000 0.94998100742020297000 0.93866980879233486000 -0.16670061131713207000 -0.30184415887715305000</data> </templeR0021R> <templeR0021T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0269435079864 0.033553376496 0.537496729928</data> </templeR0021T> <templeR0022R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.14236004780071046000 0.98494917289452277000 -0.09802419907642616300 0.43474216742556909000 0.02674991963607963000 0.90015759157026587000 0.88923161473954448000 -0.17076173053075644000 -0.42439081839012904000</data> </templeR0022R> <templeR0022T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0276700874835 0.0285902393879 0.532556254534</data> </templeR0022T> <templeR0023R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.13315239470762694000 0.98442332131574717000 -0.11480925151440334000 0.55088156138098920000 0.02278591058187676500 0.83427232221223668000 0.82389316365295051000 -0.17433165727608951000 -0.53926665774670712000</data> </templeR0023R> <templeR0023T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0282967932082 0.0230058042978 0.528314759229</data> </templeR0023T> <templeR0024R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.12178879854502510000 0.98397686167544829000 -0.13021913928564777000 0.65718996007304553000 0.01837631450844677200 0.75350094057292005000 0.74382043863297265000 -0.17734668520280353000 -0.64442168517161924000</data> </templeR0024R> <templeR0024T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.02881244142 0.0168997270462 0.524847934694</data> </templeR0024T> <templeR0025R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.10847204002101654000 0.98361776094118725000 -0.14397887655737707000 0.75177031506244740000 0.01359981962341879100 0.65928479301218457000 0.65044231867598168000 -0.17975301184474191000 -0.73797943386530540000</data> </templeR0025R> <templeR0025T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0292078304973 0.0103809691492 0.522217645599</data> </templeR0025T> <templeR0026R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.09343976044991392200 0.98335242736691753000 -0.15584291693450159000 0.83293481322054796000 0.00854166382610888240 0.55330519327431971000 0.54542516268715846000 -0.18150769562383026000 -0.81827033939708060000</data> </templeR0026R> <templeR0026T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0294759046107 0.00356585968151 0.520470830197</data> </templeR0026T> <templeR0027R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.07696020733473872600 0.98318559576803610000 -0.16559954939928406000 0.89923509311540939000 0.00329210872029469690 0.43745332245840185000 0.43064297718262490000 -0.18257942461960402000 -0.88386162939051693000</data> </templeR0027R> <templeR0027T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0296118800403 -0.00342398732706 0.519638659997</data> </templeR0027T> <templeR0028R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.05932746295193329400 0.98312024330151082000 -0.17307466409173006000 0.94948800754006690000 -0.00205516590155378630 0.31379658989656145000 0.30814408265822768000 -0.18294907352565445000 -0.93358280876354183000</data> </templeR0028R> <templeR0028T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0296133302663 -0.0104638360839 0.519735985312</data> </templeR0028T> <templeR0029R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.04085617948912668300 0.98315753616677781000 -0.17813486934349265000 0.98279680502378086000 -0.00740473917804992600 0.18454162097682264000 0.18011444315379183000 -0.18261004604395678000 -0.96654661473268999000</data> </templeR0029R> <templeR0029T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0294802294097 -0.017428062139 0.520761069394</data> </templeR0029T> <templeR0030R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.02187598221295046500 0.98329680886213122000 -0.18068986436368856000 0.99856708067455469000 -0.01266114646423924800 0.05199500709980022000 0.04883878372068523700 -0.18156839221560722000 -0.98216479887691122000</data> </templeR0030R> <templeR0030T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0292149526928 -0.0241923869131 0.52269561933</data> </templeR0030T> <templeR0031R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.00937296764199993530 0.98344162453868444000 -0.18098264724082042000 0.99925305205489368000 -0.01599729078633601100 -0.03517704715403165800 -0.03748980443482706500 -0.18051774929964823000 -0.98285698692700341000</data> </templeR0031R> <templeR0031T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>-0.0289726466043 -0.0284423587627 0.524433248357</data> </templeR0031T> <templeR0032R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.01469342934183854600 -0.99573306146750762000 -0.09110309234444970200 0.99863024345655671000 -0.01003794245248637200 -0.05135052643564889200 0.05021692929753969500 -0.09173281861943144400 0.99451664138920282000</data> </templeR0032R> <templeR0032T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0253214159027 -0.0293792487736 0.618360066</data> </templeR0032T> <templeR0033R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.00344069629113946850 -0.99586227407284378000 -0.09081020145059000300 0.99933561911064872000 -0.00671916164933668900 0.03582140761425173200 -0.03628335687017435900 -0.09062661830386635500 0.99522376080409014000</data> </templeR0033R> <templeR0033T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0251047679644 -0.0251578300064 0.620169213551</data> </templeR0033T> <templeR0034R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.01363654728930748000 -0.99598585067933787000 -0.08846598117119695800 0.98568300171389711000 -0.00148022139463806730 0.16860257731394196000 -0.16805673063078255000 -0.08949857088903123700 0.98170613785313243000</data> </templeR0034R> <templeR0034T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0248682934353 -0.0184255570846 0.6222160467</data> </templeR0034T> <templeR0035R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.03024984704142087700 -0.99601761198976480000 -0.08386813077789044600 0.95444181867062872000 0.00386319621827520880 0.29837206720415643000 -0.29685983481547856000 -0.08907296066251421700 0.95075772211018139000</data> </templeR0035R> <templeR0035T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.02475084721 -0.0114787519258 0.6233549331</data> </templeR0035T> <templeR0036R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.04610273394227399500 -0.99595699121457582000 -0.07709870020861223100 0.90616957770959716000 0.00921573639400264520 0.42281410411234677000 -0.42039414167737649000 -0.08935738275892947400 0.90293079678888799000</data> </templeR0036R> <templeR0036T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0247545251495 -0.00444138222871 0.623565549002</data> </templeR0036T> <templeR0037R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.06091231694352535600 -0.99580507011728536000 -0.06827848836405432700 0.84172768564816447000 0.01448188430858370400 0.53970804907862679000 -0.53645521048635192000 -0.09034676173267966500 0.83907882215347451000</data> </templeR0037R> <templeR0037T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0248792616217 0.00256097179509 0.622844136013</data> </templeR0037T> <templeR0038R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.07441431485673913300 -0.99556455977275171000 -0.05756489441395285000 0.76226612623790635000 0.01956766406619288600 0.64696789666354271000 -0.64297189871304494000 -0.09202344183674107700 0.76034125471255454000</data> </templeR0038R> <templeR0038T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0251228306692 0.00940335116174 0.621203567953</data> </templeR0038T> <templeR0039R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.08636778769614070200 -0.99523975203165982000 -0.04514909992939995800 0.66920287236824150000 0.02438232111996040500 0.74267962004547960000 -0.73804344104027464000 -0.09435750310793368500 0.66812314788867089000</data> </templeR0039R> <templeR0039T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0254808858594 0.0159636552164 0.618673120373</data> </templeR0039T> <templeR0040R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.10793659924390045000 -0.99055951509200579000 0.08450761861721302300 -0.32994878599451571000 0.04449292035991074500 0.94294972223262863000 -0.93780781035583538000 -0.12966197244580752000 -0.32203149494584499000</data> </templeR0040R> <templeR0040T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0313386715547 0.0461955496235 0.574657858455</data> </templeR0040T> <templeR0041R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>0.10064436337366003000 -0.98987287691280146000 0.10011193571939807000 -0.45281218231871551000 0.04402436503296685400 0.89051837871388495000 -0.88590735388350439000 -0.13495755938745446000 -0.44379569342131825000</data> </templeR0041R> <templeR0041T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0322465423181 0.0461686603603 0.567676168654</data> </templeR0041T> <templeR0042R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.09868778720769125200 -0.99342356952296929000 -0.05805456202825097500 0.72029150408413001000 -0.03105781339599184000 -0.69297587358527946000 0.68661551817612676000 -0.11020446335472237000 0.71861958396388448000</data> </templeR0042R> <templeR0042T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.028650693588 -0.0548464785114 0.59189613682</data> </templeR0042T> <templeR0043R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.08513547925382919400 -0.99399869748797920000 -0.06869162659612815200 0.80631333030563868000 -0.02823128526067348500 -0.59081452919165756000 0.58532961956802643000 -0.10568625229769273000 0.80387788409161853000</data> </templeR0043R> <templeR0043T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0278557511485 -0.0516471860246 0.598117193954</data> </templeR0043T> <templeR0044R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.07028452998918902100 -0.99451747087193221000 -0.07742793407223566600 0.87794743962593247000 -0.02482290748598041700 -0.47811307921684382000 0.47356982388922148000 -0.10158160952868461000 0.87487873360088786000</data> </templeR0044R> <templeR0044T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0271265258805 -0.0476405218956 0.603860347957</data> </templeR0044T> <templeR0045R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.05439995112000559800 -0.99497063228547356000 -0.08410758709882369700 0.93391553816646533000 -0.02089350177384347000 -0.35688265460073498000 0.35333045847956862000 -0.09796378143513864700 0.93035513898593913000</data> </templeR0045R> <templeR0045T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0264760306379 -0.042897984106 0.609023113594</data> </templeR0045T> <templeR0046R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.03776520743937929200 -0.99535009493528070000 -0.08861138538240269400 0.97321885941264064000 -0.01651318947821050300 -0.22928664648604202000 0.22675722875052765000 -0.09489732918046089900 0.96931710813530791000</data> </templeR0046R> <templeR0046T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0259158736918 -0.0375042045812 0.613513359853</data> </templeR0046T> <templeR0047R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data>-0.02067714204649669800 -0.99564908739937330000 -0.09085895969899916700 0.99515604481568609000 -0.01176013624456452200 -0.09760197570904494100 0.09610880429798678000 -0.09243697288587854300 0.99106937384832272000</data> </templeR0047R> <templeR0047T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data>0.0254560509115 -0.0315554340517 0.617250959345</data> </templeR0047T> </opencv_storage>
3dReconstruction
Spikes/StereoMatch/temple47cameraParameters.xml
XML
New BSD License (BSD)
25,333
<?xml version="1.0"?> <opencv_storage> <R type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data> 9.9975845371004723e-001 5.2938494283308168e-003 -2.1330949194199155e-002 -4.9128856780201770e-003 9.9982820089904900e-001 1.7872667436219555e-002 2.1421899766595125e-002 -1.7763553844914036e-002 9.9961270418356973e-001</data></R> <T type_id="opencv-matrix"> <rows>3</rows> <cols>1</cols> <dt>d</dt> <data> -3.3385325916025854e+000 4.8752483611574089e-002 -1.0621381929002099e-001</data></T> <R1 type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data> 9.9989926797130868e-001 -9.8657055577613794e-003 1.0204007266193976e-002 9.7747996340919619e-003 9.9991243357170068e-001 8.9206771510116165e-003 -1.0291122511871056e-002 -8.8200364266130208e-003 9.9990814565882946e-001</data></R1> <R2 type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data> 9.9938785729250423e-001 -1.4594028603110288e-002 3.1795047183937220e-002 1.4875537921264092e-002 9.9985206333748144e-001 -8.6353813658799159e-003 -3.1664318528119781e-002 9.1030637102433969e-003 9.9945710521424436e-001</data></R2> <P1 type_id="opencv-matrix"> <rows>3</rows> <cols>4</cols> <dt>d</dt> <data> 4.2656433611135799e+002 0. 3.2185688400268555e+002 0. 0. 4.2656433611135799e+002 2.4122886657714844e+002 0. 0. 0. 1. 0.</data></P1> <P2 type_id="opencv-matrix"> <rows>3</rows> <cols>4</cols> <dt>d</dt> <data> 4.2656433611135799e+002 0. 3.2185688400268555e+002 -1.4249712242664141e+003 0. 4.2656433611135799e+002 2.4122886657714844e+002 0. 0. 0. 1. 0.</data></P2> <Q type_id="opencv-matrix"> <rows>4</rows> <cols>4</cols> <dt>d</dt> <data> 1. 0. 0. -3.2185688400268555e+002 0. 1. 0. -2.4122886657714844e+002 0. 0. 0. 4.2656433611135799e+002 0. 0. 2.9934943867442410e-001 0.</data></Q> </opencv_storage>
3dReconstruction
Spikes/StereoRectifySpike/extrinsics.xml
XML
New BSD License (BSD)
2,015
<?xml version="1.0"?> <opencv_storage> <M1 type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data> 5.3471311032432391e+002 0. 3.3513838135674729e+002 0. 5.3471311032432391e+002 2.4020578137651339e+002 0. 0. 1.</data></M1> <D1 type_id="opencv-matrix"> <rows>1</rows> <cols>8</cols> <dt>d</dt> <data> -2.7456815913629584e-001 -1.8329019064968352e-002 0. 0. 0. 0. 0. -2.4481064038800596e-001</data></D1> <M2 type_id="opencv-matrix"> <rows>3</rows> <cols>3</cols> <dt>d</dt> <data> 5.3471311032432391e+002 0. 3.3401518911545526e+002 0. 5.3471311032432391e+002 2.4159041667844363e+002 0. 0. 1.</data></M2> <D2 type_id="opencv-matrix"> <rows>1</rows> <cols>8</cols> <dt>d</dt> <data> -2.8073450162365265e-001 9.3000165783150540e-002 0. 0. 0. 0. 0. 1.6314434959666235e-002</data></D2> </opencv_storage>
3dReconstruction
Spikes/StereoRectifySpike/intrinsics.xml
XML
New BSD License (BSD)
908
///* This is sample from the OpenCV book. The copyright notice is below */ // ///* *************** License:************************** // Oct. 3, 2008 // Right to use this code in any way you want without warranty, support or any guarantee of it working. // // BOOK: It would be nice if you cited it: // Learning OpenCV: Computer Vision with the OpenCV Library // by Gary Bradski and Adrian Kaehler // Published by O'Reilly Media, October 3, 2008 // // AVAILABLE AT: // http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134 // Or: http://oreilly.com/catalog/9780596516130/ // ISBN-10: 0596516134 or: ISBN-13: 978-0596516130 // // OTHER OPENCV SITES: // * The source code is on sourceforge at: // http://sourceforge.net/projects/opencvlibrary/ // * The OpenCV wiki page (As of Oct 1, 2008 this is down for changing over servers, but should come back): // http://opencvlibrary.sourceforge.net/ // * An active user group is at: // http://tech.groups.yahoo.com/group/OpenCV/ // * The minutes of weekly OpenCV development meetings are at: // http://pr.willowgarage.com/wiki/OpenCV // ************************************************** */ // //#include "opencv2/calib3d/calib3d.hpp" //#include "opencv2/highgui/highgui.hpp" //#include "opencv2/imgproc/imgproc.hpp" // //#include <vector> //#include <string> //#include <algorithm> //#include <iostream> //#include <iterator> //#include <stdio.h> //#include <stdlib.h> //#include <ctype.h> // //using namespace cv; //using namespace std; // //static int print_help() //{ // cout << // " Given a list of chessboard images, the number of corners (nx, ny)\n" // " on the chessboards, and a flag: useCalibrated for \n" // " calibrated (0) or\n" // " uncalibrated \n" // " (1: use cvStereoCalibrate(), 2: compute fundamental\n" // " matrix separately) stereo. \n" // " Calibrate the cameras and display the\n" // " rectified results along with the computed disparity images. \n" << endl; // cout << "Usage:\n ./stereo_calib -w board_width -h board_height [-nr /*dot not view results*/] <image list XML/YML file>\n" << endl; // return 0; //} // // //static void //StereoCalib(const vector<string>& imagelist, Size boardSize, bool useCalibrated=true, bool showRectified=true) //{ // if( imagelist.size() % 2 != 0 ) // { // cout << "Error: the image list contains odd (non-even) number of elements\n"; // return; // } // // bool displayCorners = false;//true; // const int maxScale = 2; // const float squareSize = 1.f; // Set this to your actual square size // // ARRAY AND VECTOR STORAGE: // // vector<vector<Point2f> > imagePoints[2]; // vector<vector<Point3f> > objectPoints; // Size imageSize; // // int i, j, k, nimages = (int)imagelist.size()/2; // // imagePoints[0].resize(nimages); // imagePoints[1].resize(nimages); // vector<string> goodImageList; // // for( i = j = 0; i < nimages; i++ ) // { // for( k = 0; k < 2; k++ ) // { // const string& filename = imagelist[i*2+k]; // Mat img = imread(filename, 0); // if(img.empty()) // break; // if( imageSize == Size() ) // imageSize = img.size(); // else if( img.size() != imageSize ) // { // cout << "The image " << filename << " has the size different from the first image size. Skipping the pair\n"; // break; // } // bool found = false; // vector<Point2f>& corners = imagePoints[k][j]; // for( int scale = 1; scale <= maxScale; scale++ ) // { // Mat timg; // if( scale == 1 ) // timg = img; // else // resize(img, timg, Size(), scale, scale); // found = findChessboardCorners(timg, boardSize, corners, // CV_CALIB_CB_ADAPTIVE_THRESH | CV_CALIB_CB_NORMALIZE_IMAGE); // if( found ) // { // if( scale > 1 ) // { // Mat cornersMat(corners); // cornersMat *= 1./scale; // } // break; // } // } // if( displayCorners ) // { // cout << filename << endl; // Mat cimg, cimg1; // cvtColor(img, cimg, CV_GRAY2BGR); // drawChessboardCorners(cimg, boardSize, corners, found); // double sf = 640./MAX(img.rows, img.cols); // resize(cimg, cimg1, Size(), sf, sf); // imshow("corners", cimg1); // char c = (char)waitKey(500); // if( c == 27 || c == 'q' || c == 'Q' ) //Allow ESC to quit // exit(-1); // } // else // putchar('.'); // if( !found ) // break; // cornerSubPix(img, corners, Size(11,11), Size(-1,-1), // TermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, // 30, 0.01)); // } // if( k == 2 ) // { // goodImageList.push_back(imagelist[i*2]); // goodImageList.push_back(imagelist[i*2+1]); // j++; // } // } // cout << j << " pairs have been successfully detected.\n"; // nimages = j; // if( nimages < 2 ) // { // cout << "Error: too little pairs to run the calibration\n"; // return; // } // // imagePoints[0].resize(nimages); // imagePoints[1].resize(nimages); // objectPoints.resize(nimages); // // for( i = 0; i < nimages; i++ ) // { // for( j = 0; j < boardSize.height; j++ ) // for( k = 0; k < boardSize.width; k++ ) // objectPoints[i].push_back(Point3f(j*squareSize, k*squareSize, 0)); // } // // cout << "Running stereo calibration ...\n"; // // Mat cameraMatrix[2], distCoeffs[2]; // cameraMatrix[0] = Mat::eye(3, 3, CV_64F); // cameraMatrix[1] = Mat::eye(3, 3, CV_64F); // Mat R, T, E, F; // // double rms = stereoCalibrate(objectPoints, imagePoints[0], imagePoints[1], // cameraMatrix[0], distCoeffs[0], // cameraMatrix[1], distCoeffs[1], // imageSize, R, T, E, F, // TermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 100, 1e-5), // CV_CALIB_FIX_ASPECT_RATIO + // CV_CALIB_ZERO_TANGENT_DIST + // CV_CALIB_SAME_FOCAL_LENGTH + // CV_CALIB_RATIONAL_MODEL + // CV_CALIB_FIX_K3 + CV_CALIB_FIX_K4 + CV_CALIB_FIX_K5); // cout << "done with RMS error=" << rms << endl; // //// CALIBRATION QUALITY CHECK //// because the output fundamental matrix implicitly //// includes all the output information, //// we can check the quality of calibration using the //// epipolar geometry constraint: m2^t*F*m1=0 // double err = 0; // int npoints = 0; // vector<Vec3f> lines[2]; // for( i = 0; i < nimages; i++ ) // { // int npt = (int)imagePoints[0][i].size(); // Mat imgpt[2]; // for( k = 0; k < 2; k++ ) // { // imgpt[k] = Mat(imagePoints[k][i]); // undistortPoints(imgpt[k], imgpt[k], cameraMatrix[k], distCoeffs[k], Mat(), cameraMatrix[k]); // computeCorrespondEpilines(imgpt[k], k+1, F, lines[k]); // } // for( j = 0; j < npt; j++ ) // { // double errij = fabs(imagePoints[0][i][j].x*lines[1][j][0] + // imagePoints[0][i][j].y*lines[1][j][1] + lines[1][j][2]) + // fabs(imagePoints[1][i][j].x*lines[0][j][0] + // imagePoints[1][i][j].y*lines[0][j][1] + lines[0][j][2]); // err += errij; // } // npoints += npt; // } // cout << "average reprojection err = " << err/npoints << endl; // // // save intrinsic parameters // FileStorage fs("intrinsics.xml", CV_STORAGE_WRITE); // if( fs.isOpened() ) // { // fs << "M1" << cameraMatrix[0] << "D1" << distCoeffs[0] << // "M2" << cameraMatrix[1] << "D2" << distCoeffs[1]; // fs.release(); // } // else // cout << "Error: can not save the intrinsic parameters\n"; // // Mat R1, R2, P1, P2, Q; // Rect validRoi[2]; // // stereoRectify(cameraMatrix[0], distCoeffs[0], // cameraMatrix[1], distCoeffs[1], // imageSize, R, T, R1, R2, P1, P2, Q, // CALIB_ZERO_DISPARITY, 1, imageSize, &validRoi[0], &validRoi[1]); // // fs.open("extrinsics.xml", CV_STORAGE_WRITE); // if( fs.isOpened() ) // { // fs << "R" << R << "T" << T << "R1" << R1 << "R2" << R2 << "P1" << P1 << "P2" << P2 << "Q" << Q; // fs.release(); // } // else // cout << "Error: can not save the intrinsic parameters\n"; // // // OpenCV can handle left-right // // or up-down camera arrangements // bool isVerticalStereo = fabs(P2.at<double>(1, 3)) > fabs(P2.at<double>(0, 3)); // //// COMPUTE AND DISPLAY RECTIFICATION // if( !showRectified ) // return; // // Mat rmap[2][2]; //// IF BY CALIBRATED (BOUGUET'S METHOD) // if( useCalibrated ) // { // // we already computed everything // } //// OR ELSE HARTLEY'S METHOD // else // // use intrinsic parameters of each camera, but // // compute the rectification transformation directly // // from the fundamental matrix // { // vector<Point2f> allimgpt[2]; // for( k = 0; k < 2; k++ ) // { // for( i = 0; i < nimages; i++ ) // std::copy(imagePoints[k][i].begin(), imagePoints[k][i].end(), back_inserter(allimgpt[k])); // } // F = findFundamentalMat(Mat(allimgpt[0]), Mat(allimgpt[1]), FM_8POINT, 0, 0); // Mat H1, H2; // stereoRectifyUncalibrated(Mat(allimgpt[0]), Mat(allimgpt[1]), F, imageSize, H1, H2, 3); // // R1 = cameraMatrix[0].inv()*H1*cameraMatrix[0]; // R2 = cameraMatrix[1].inv()*H2*cameraMatrix[1]; // P1 = cameraMatrix[0]; // P2 = cameraMatrix[1]; // } // // //Precompute maps for cv::remap() // initUndistortRectifyMap(cameraMatrix[0], distCoeffs[0], R1, P1, imageSize, CV_16SC2, rmap[0][0], rmap[0][1]); // initUndistortRectifyMap(cameraMatrix[1], distCoeffs[1], R2, P2, imageSize, CV_16SC2, rmap[1][0], rmap[1][1]); // // Mat canvas; // double sf; // int w, h; // if( !isVerticalStereo ) // { // sf = 600./MAX(imageSize.width, imageSize.height); // w = cvRound(imageSize.width*sf); // h = cvRound(imageSize.height*sf); // canvas.create(h, w*2, CV_8UC3); // } // else // { // sf = 300./MAX(imageSize.width, imageSize.height); // w = cvRound(imageSize.width*sf); // h = cvRound(imageSize.height*sf); // canvas.create(h*2, w, CV_8UC3); // } // // for( i = 0; i < nimages; i++ ) // { // for( k = 0; k < 2; k++ ) // { // Mat img = imread(goodImageList[i*2+k], 0), rimg, cimg; // remap(img, rimg, rmap[k][0], rmap[k][1], CV_INTER_LINEAR); // cvtColor(rimg, cimg, CV_GRAY2BGR); // Mat canvasPart = !isVerticalStereo ? canvas(Rect(w*k, 0, w, h)) : canvas(Rect(0, h*k, w, h)); // resize(cimg, canvasPart, canvasPart.size(), 0, 0, CV_INTER_AREA); // if( useCalibrated ) // { // Rect vroi(cvRound(validRoi[k].x*sf), cvRound(validRoi[k].y*sf), // cvRound(validRoi[k].width*sf), cvRound(validRoi[k].height*sf)); // rectangle(canvasPart, vroi, Scalar(0,0,255), 3, 8); // } // } // // if( !isVerticalStereo ) // for( j = 0; j < canvas.rows; j += 16 ) // line(canvas, Point(0, j), Point(canvas.cols, j), Scalar(0, 255, 0), 1, 8); // else // for( j = 0; j < canvas.cols; j += 16 ) // line(canvas, Point(j, 0), Point(j, canvas.rows), Scalar(0, 255, 0), 1, 8); // imshow("rectified", canvas); // char c = (char)waitKey(); // if( c == 27 || c == 'q' || c == 'Q' ) // break; // } //} // // //static bool readStringList( const string& filename, vector<string>& l ) //{ // l.resize(0); // FileStorage fs(filename, FileStorage::READ); // if( !fs.isOpened() ) // return false; // FileNode n = fs.getFirstTopLevelNode(); // if( n.type() != FileNode::SEQ ) // return false; // FileNodeIterator it = n.begin(), it_end = n.end(); // for( ; it != it_end; ++it ) // l.push_back((string)*it); // return true; //} // //int main(int argc, char** argv) //{ // Size boardSize; // string imagelistfn; // bool showRectified = true; // // for( int i = 1; i < argc; i++ ) // { // if( string(argv[i]) == "-w" ) // { // if( sscanf(argv[++i], "%d", &boardSize.width) != 1 || boardSize.width <= 0 ) // { // cout << "invalid board width" << endl; // return print_help(); // } // } // else if( string(argv[i]) == "-h" ) // { // if( sscanf(argv[++i], "%d", &boardSize.height) != 1 || boardSize.height <= 0 ) // { // cout << "invalid board height" << endl; // return print_help(); // } // } // else if( string(argv[i]) == "-nr" ) // showRectified = false; // else if( string(argv[i]) == "--help" ) // return print_help(); // else if( argv[i][0] == '-' ) // { // cout << "invalid option " << argv[i] << endl; // return 0; // } // else // imagelistfn = argv[i]; // } // // if( imagelistfn == "" ) // { // imagelistfn = "stereo_calib.xml"; // boardSize = Size(9, 6); // } // else if( boardSize.width <= 0 || boardSize.height <= 0 ) // { // cout << "if you specified XML file with chessboards, you should also specify the board width and height (-w and -h options)" << endl; // return 0; // } // // vector<string> imagelist; // bool ok = readStringList(imagelistfn, imagelist); // if(!ok || imagelist.empty()) // { // cout << "can not open " << imagelistfn << " or the string list is empty" << endl; // return print_help(); // } // // StereoCalib(imagelist, boardSize, true, showRectified); // return 0; //} //
3dReconstruction
Spikes/StereoRectifySpike/stereo_calib.cpp
C++
New BSD License (BSD)
14,784
<?xml version="1.0"?> <opencv_storage> <imagelist> "left01.jpg" "right01.jpg" "left02.jpg" "right02.jpg" "left03.jpg" "right03.jpg" "left04.jpg" "right04.jpg" "left05.jpg" "right05.jpg" "left06.jpg" "right06.jpg" "left07.jpg" "right07.jpg" "left08.jpg" "right08.jpg" "left09.jpg" "right09.jpg" "left11.jpg" "right11.jpg" "left12.jpg" "right12.jpg" "left13.jpg" "right13.jpg" "left14.jpg" "right14.jpg" </imagelist> </opencv_storage>
3dReconstruction
Spikes/StereoRectifySpike/stereo_calib.xml
XML
New BSD License (BSD)
434
#include"CRectangle.h" void CRectangle::setValues(int a, int b){ x = a; y = b; } int CRectangle::area(){ return(x*y); }
2112110124
Example01/CRectangle.cpp
C++
Microsoft Reciprocal License (Ms-RL)
129
#include<iostream> using namespace std; class CRectangle { int x, y; public: void setValues(int a, int b); int area(); };
2112110124
Example01/CRectangle.h
C
Microsoft Reciprocal License (Ms-RL)
131
#include"CRectangle.h" #include<conio.h> int main() { CRectangle rect; rect.setValues(3, 4); cout << "area:" << rect.area(); _getch(); return 0; }
2112110124
Example01/main.cpp
C++
Microsoft Reciprocal License (Ms-RL)
161
#include"CRectangle.h" void CRectangle::setValues(int a, int b){ x = a; y = b; } int CRectangle::area(){ return(x*y); }
2112110124
Example02/CRectangle.cpp
C++
Microsoft Reciprocal License (Ms-RL)
129
#include<iostream> using namespace std; class CRectangle { int x, y; public: void setValues(int a, int b); int area(); };
2112110124
Example02/CRectangle.h
C
Microsoft Reciprocal License (Ms-RL)
131
#include"CRectangle.h" #include<conio.h> int main() { CRectangle recta; CRectangle rectb; recta.setValues(3, 4); rectb.setValues(5, 6); cout << "area a:" << recta.area()<<"\n"; cout << "area b:" << rectb.area(); _getch(); return 0; }
2112110124
Example02/main.cpp
C++
Microsoft Reciprocal License (Ms-RL)
253
#include"CRectangle.h" void CRectangle::setValues(int a, int b){ x = a; y = b; } int CRectangle::area(){ return(x*y); }
2112110124
Example03/CRectangle.cpp
C++
Microsoft Reciprocal License (Ms-RL)
129
#include<iostream> using namespace std; class CRectangle{ int x, y; public: void setValues(int a, int b); int area(); };
2112110124
Example03/CRectangle.h
C
Microsoft Reciprocal License (Ms-RL)
132
#include"CRectangle.h" #include<conio.h> int main(){ CRectangle *rect = new CRectangle(); rect->setValues(3, 4); cout << " area:" << rect->area(); _getch(); return 0; }
2112110124
Example03/main.cpp
C++
Microsoft Reciprocal License (Ms-RL)
186
#include"CRectangle.h" void CRectangle::setValues(int a, int b){ x = a; y = b; } int CRectangle::area(){ return(x*y); }
2112110124
Example04/CRectangle.cpp
C++
Microsoft Reciprocal License (Ms-RL)
133
#include<iostream> using namespace std; class CRectangle{ int x, y; public: void setValues(int a, int b); int area(); };
2112110124
Example04/CRectangle.h
C
Microsoft Reciprocal License (Ms-RL)
132
#include"CRectangle.h" #include<conio.h> int main() { CRectangle *rect = new CRectangle(); rect->setValues(3, 4); cout << "area:" << rect->area(); delete rect; _getch(); return 0; }
2112110124
Example04/main.cpp
C++
Microsoft Reciprocal License (Ms-RL)
199
#include"CRectangle.h" CRectangle::CRectangle(int a, int b){ width = a; height = b; } int CRectangle::area(){ return(width*height); }
2112110124
Example05/CRectangle.cpp
C++
Microsoft Reciprocal License (Ms-RL)
143
#include<iostream> using namespace std; class CRectangle{ int width; int height; public: CRectangle(int, int); int area(); };
2112110124
Example05/CRectangle.h
C
Microsoft Reciprocal License (Ms-RL)
137
#include"CRectangle.h" #include<conio.h> int main(){ CRectangle recta(3, 4); CRectangle rectb(5, 6); cout << "area a:" << recta.area() << "\n"; cout << "area b:" << rectb.area(); _getch(); return 0; }
2112110124
Example05/main.cpp
C++
Microsoft Reciprocal License (Ms-RL)
215
#include"CRectangle.h" CRectangle::CRectangle(){ width = 5; height = 5; } CRectangle::CRectangle(int a, int b){ width = a; height = b; } int CRectangle::area(){ return(width*height); }
2112110124
Example06/CRectangle.cpp
C++
Microsoft Reciprocal License (Ms-RL)
202
#include<iostream> using namespace std; class CRectangle{ int width; int height; public: CRectangle(); CRectangle(int, int); int area(); };
2112110124
Example06/CRectangle.h
C
Microsoft Reciprocal License (Ms-RL)
153
#include"CRectangle.h" #include<conio.h> int main(){ CRectangle recta(3, 4); CRectangle rectb; cout << "area a" << recta.area() << "\n"; cout << "area b:" << rectb.area(); _getch(); return 0; }
2112110124
Example06/main.cpp
C++
Microsoft Reciprocal License (Ms-RL)
208
#include"CRectangle.h" CRectangle::CRectangle(int a, int b){ width = new int; height = new int; *width = a; *height = b; } int CRectangle::area(){ return((*width)*(*height)); }
2112110124
Example07/CRectangle.cpp
C++
Microsoft Reciprocal License (Ms-RL)
192
#include<iostream> using namespace std; class CRectangle{ int *width; int *height; public: CRectangle(int, int); int area(); };
2112110124
Example07/CRectangle.h
C
Microsoft Reciprocal License (Ms-RL)
141
#include"CRectangle.h" #include<conio.h> int main() { CRectangle recta(3, 4); cout << "area a:" << recta.area(); _getch(); return 0; }
2112110124
Example07/main.cpp
C++
Microsoft Reciprocal License (Ms-RL)
148
#include"CRectangle.h" CRectangle::CRectangle(int a, int b){ width = new int; height = new int; *width = a; *height = b; } CRectangle::~CRectangle(){ delete width; delete height; } int CRectangle::area(){ return(*width)*(*height); }
2112110124
Example08/CRectangle.cpp
C++
Microsoft Reciprocal License (Ms-RL)
256
#include<iostream> using namespace std; class CRectangle{ int *width; int *height; public: CRectangle(int, int); ~CRectangle(); int area(); };
2112110124
Example08/CRectangle.h
C
Microsoft Reciprocal License (Ms-RL)
158
#include"CRectangle.h" #include<conio.h> int main() { CRectangle recta(3, 4); cout << "area a:" << recta.area(); _getch(); return 0; }
2112110124
Example08/main.cpp
C++
Microsoft Reciprocal License (Ms-RL)
148
#include "CRectangle.h" void CReactangle:: setValues(int a, int b) { w = a; h = b; } int CReactangle:: area() { return (w*h); }
2112110124
Example09/CRectangle.cpp
C++
Microsoft Reciprocal License (Ms-RL)
139
#include <iostream> using namespace std; class CReactangle{ int w,h; public: void setValues(int a, int b); int area(); };
2112110124
Example09/CRectangle.h
C
Microsoft Reciprocal License (Ms-RL)
134
#include "CRectangle.h" #include <conio.h> int main() { CReactangle recta; CReactangle *rectb; rectb = &recta; rectb -> setValues(8,9); cout <<"area: " << recta.area(); cout <<"area: " << rectb->area(); _getch(); return 0; }
2112110124
Example09/main.cpp
C++
Microsoft Reciprocal License (Ms-RL)
244
#include "Crectangle.h" void CRectangle::setValues(int a, int b){ w = a; h = b; } int CRectangle::area(){ return(w*h); }
2112110124
Example10/CRectangle.cpp
C++
Microsoft Reciprocal License (Ms-RL)
132
#include <iostream> using namespace std; class CRectangle{ int w, h; public: void setValues(int a, int b); int area(); };
2112110124
Example10/CRectangle.h
C
Microsoft Reciprocal License (Ms-RL)
136
#include "Crectangle.h" #include <conio.h> int main(){ CRectangle recta; recta.setValues(3,4); CRectangle*rectb; rectb = &recta; rectb->setValues(3,9); cout << "area: " << recta.area(); cout << "\narea: " << rectb->area(); CRectangle *rectc = new CRectangle(); rectc->setValues(5,6); rectb = rectc; rectc->setValues(7,8); cout << "\narea: " << rectb->area(); cout << "\narea: " << rectc->area(); _getch(); delete rectc; return 0; }
2112110124
Example10/main.cpp
C++
Microsoft Reciprocal License (Ms-RL)
468
#include "CRectangle.h" void CRectangle::setValues(int a, int b){ w = a; h = b; } int CRectangle::area(){ return(w*h); }
2112110124
Example11/CRectangle.cpp
C++
Microsoft Reciprocal License (Ms-RL)
132
#include <iostream> using namespace std; class CRectangle{ int w, h; public: void setValues(int a, int b); int area(); };
2112110124
Example11/CRectangle.h
C
Microsoft Reciprocal License (Ms-RL)
136
#include "CRectangle.h" #include <conio.h> int main(){ CRectangle *rectb; CRectangle *rectc = new CRectangle(); rectc->setValues(8,9); rectb = rectc; cout << "area: " << rectb->area(); cout << "\narea: " << rectc->area(); _getch(); delete rectb; return 0; }
2112110124
Example11/main.cpp
C++
Microsoft Reciprocal License (Ms-RL)
280
#include "CRectangle.h" void CRectangle::setValues(int a, int b){ w = a; h = b; } void CRectangle::setValues(CRectangle *r){ rect = r; }
2112110124
Example12/CRectangle.cpp
C++
Microsoft Reciprocal License (Ms-RL)
148
#include <iostream> using namespace std; class CRectangle{ int w, h; CRectangle *rect; public: void setValues(CRectangle *rect); void setValues(int a, int b); int area(); };
2112110124
Example12/CRectangle.h
C
Microsoft Reciprocal License (Ms-RL)
193
#include "CRectangle.h" #include <conio.h> int main(){ CRectangle *recta = new CRectangle(); recta->setValues(3,4); CRectangle rectb; rectb.setValues(recta); //cout << "area: " << recta-> _getch(); delete recta; return 0; }
2112110124
Example12/main.cpp
C++
Microsoft Reciprocal License (Ms-RL)
245