Ejemplo n.º 1
0
        public Track GetTrack(string trackName, bool createIfNotFound = false)
        {
            // Gets existing track specified by Name if it already exists
            // Creates it if it does not
            Track ret = Sequence.FindTrack(trackName, createIfNotFound);

            if (ret == null)
            {
                if (createIfNotFound)
                {
                    ret = Sequence.CreateTrack(trackName);
                    ret.Centiseconds = Sequence.Centiseconds;
                }
                //Sequence.AddTrack(ret);
            }
            return(ret);
        }
Ejemplo n.º 2
0
		private void CreateGroups()
		{
			ChannelGroup grp = null;
			string nm = "";
			Array.Resize(ref rowGroups, 14);
			Array.Resize(ref colGroups, 8);
			seq = new Sequence4(lastFile);
			treeTrack = seq.CreateTrack("Tree Pixels [U7.001-U8-388");
			masterRowGroup = seq.CreateChannelGroup("Tree Pixels by Row");
			masterColGroup = seq.CreateChannelGroup("Tree Pixels by Column");
			treeTrack.AddItem(masterRowGroup);
			treeTrack.AddItem(masterColGroup);
			for (int r = 0; r < 14; r++)
			{
				nm = "Tree Pixels Row " + (r + 1).ToString();
				grp = seq.CreateChannelGroup(nm);
				rowGroups[r] = grp;
				masterRowGroup.AddItem(grp);
			}
			for (int c = 0; c < 8; c++)
			{
				nm = "Tree Pixels Column " + (c + 1).ToString();
				nm += " {" + DirName(c + 1) + "}";
				string f = FaceName(c + 1);
				if (f.Length > 0)
				{
					nm += "{" + f + "}";
				}
				grp = seq.CreateChannelGroup(nm);
				colGroups[c] = grp;
				masterColGroup.AddItem(grp);
			}




		}
Ejemplo n.º 3
0
        private void MergeSequences()
        {
            mergeTracks         = Properties.Settings.Default.MergeTracks;
            mergeTracksByName   = Properties.Settings.Default.MergeTracksByName;
            duplicateNameAction = Properties.Settings.Default.DuplicateNameAction;
            mergeEffects        = Properties.Settings.Default.MergeEffects;
            numberFormat        = Properties.Settings.Default.AddNumberFormat;

            bool matched = false;
            int  exIdx   = 0;


            List <Map> groupMap       = new List <Map>();
            List <Map> trackMap       = new List <Map>();
            List <Map> timingMap      = new List <Map>();
            int        newGroupCount  = 0;
            int        newTrackCount  = 0;
            int        newTimingCount = 0;
            bool       found          = false;



            /////////////////////
            //  TIMING GRIDS  //
            ///////////////////
            if (mergeGrids)
            {
                for (int g2Idx = 0; g2Idx < seqTwo.TimingGrids.Count; g2Idx++)
                {
                    TimingGrid sourceGrid = seqTwo.TimingGrids[g2Idx];
                    sourceGrid.timings.Sort();
                    TimingGrid destGrid = null;
                    // Grids treated like tracks.  Merge or Append?
                    if (mergeTracks)
                    {
                        found = true;                         // Reset to default
                        // Search for it, do NOT create if not found
                        destGrid = (TimingGrid)seqNew.Members.Find(sourceGrid.Name, MemberType.TimingGrid, false);
                        if (destGrid == null)                         // no match found
                        {
                            found    = false;
                            destGrid = seqNew.CreateTimingGrid(sourceGrid.Name);
                        }
                        else                         // match found!
                        {
                            // Check for conflicting types and warn user
                            if (sourceGrid.TimingGridType == TimingGridType.FixedGrid)
                            {
                                if (destGrid.TimingGridType == TimingGridType.Freeform)
                                {
                                    GridMismatchError(sourceGrid.Name);
                                }
                            }
                            if (sourceGrid.TimingGridType == TimingGridType.Freeform)
                            {
                                if (destGrid.TimingGridType == TimingGridType.FixedGrid)
                                {
                                    GridMismatchError(sourceGrid.Name);
                                }
                            }
                            // What to do if match is found?
                            if (duplicateNameAction == ACTIONkeepBoth)
                            {
                                destGrid = seqNew.CreateTimingGrid(sourceGrid.Name);
                            }
                            if (duplicateNameAction == ACTIONaddNumber)
                            {
                                destGrid = seqNew.CreateTimingGrid(sourceGrid.Name + " (2)");
                            }
                            if (duplicateNameAction == ACTIONuseSecond)
                            {
                                destGrid.timings.Clear();
                            }
                        }
                    }
                    else                     // Append
                    {
                        destGrid = seqNew.CreateTimingGrid(sourceGrid.Name);
                        destGrid.TimingGridType = sourceGrid.TimingGridType;
                    }                     // Enbd if merge or append

                    // if not found, or any action other than keep first
                    if (!found || (duplicateNameAction != ACTIONkeepFirst))
                    {
                        // Copy type, spacing and timings
                        destGrid.TimingGridType = sourceGrid.TimingGridType;
                        destGrid.spacing        = sourceGrid.spacing;
                        if (destGrid.TimingGridType == TimingGridType.Freeform)
                        {
                            destGrid.CopyTimings(sourceGrid.timings, false);
                        }
                    }
                }         // end loop thru 2nd sequence's timing grids
            }             // if Merge Grids

            ///////////////
            //  TRACKS  //
            /////////////

            if (mergeTracks)
            {
                //foreach (Track track2 in seqTwo.Tracks)
                for (int t2Idx = 0; t2Idx < seqTwo.Tracks.Count; t2Idx++)
                {
                    Track sourceTrack = seqTwo.Tracks[t2Idx];
                    Track destTrack   = null;
                    if (mergeTracksByNumber)
                    {
                        // Merge by number or name?
                        // If by number, do we even have that many in the destination?
                        if (t2Idx < seqNew.Tracks.Count)
                        {
                            destTrack = seqNew.Tracks[t2Idx];
                        }
                        else
                        {
                            // Not enough, make one
                            destTrack = seqNew.CreateTrack(sourceTrack.Name);
                        }
                    }
                    if (mergeTracksByName)
                    {
                        found     = true;                     // reset to default
                        destTrack = (Track)seqNew.Members.Find(sourceTrack.Name, MemberType.Track, false);
                        if (destTrack == null)                // no matching name found
                        {
                            found     = false;
                            destTrack = seqNew.CreateTrack(sourceTrack.Name);
                        }
                        else                         // matching name found!
                        {
                        }
                    }
                    if (appendTracks)
                    {
                        destTrack = seqNew.CreateTrack(sourceTrack.Name);
                    }
                    MergeMembers(destTrack.Members, sourceTrack.Members);

                    Console.WriteLine(destTrack.Name);
                }
            }
        }
Ejemplo n.º 4
0
		private void BuildFence()
		{
			/////////////////////////////////////////////////////////////
			//
			//   Batch 1 IS THE PERIMETER FENCE
			//   DONE AS MATRIX   ~~  x Sections by Y rgbChs-per-section
			//   Grouped by Section, and
			//   Grouped by rgbCh # (per section)

			pixelNum = 1;
			sections = Int16.Parse(txtFenceSections.Text);
			pixelsPerSect = Int16.Parse(txtFenseSectionSize.Text);
			int totalrgbChs = sections * pixelsPerSect;
			int totalChans = totalrgbChs * 3;
			universeNum = (int)numFenceUniverse.Value;
			int sectNum = 1;
			string baseName = txtFenceBaseName.Text;
			reversed = optFenceReverse.Checked;

			//Array.Resize(ref chanMatrix[], sections, pixelsPerSect);
			chanMatrix = new RGBchannel[sections, pixelsPerSect];
			sectionGroups = new ChannelGroup[sections];
			pixelGroups = new ChannelGroup[pixelsPerSect];

			sectionName = baseName + "s [U" + universeNum.ToString();
			sectionName += ".001-U" + (universeNum + 1).ToString() + ".";
			sectionName += (166 * 3).ToString() + "]";
			int tknum = int.Parse(txtTrack.Text);
			Track trak = seq.CreateTrack(sectionName);

			sectionName = baseName + "s by Section [U" + universeNum.ToString();
			sectionName += ".001-U" + (universeNum + 1).ToString() + ".";
			sectionName += (166 * 3).ToString() + "]";
			ChannelGroup grpSects =  seq.CreateChannelGroup(sectionName);
			trak.AddItem(grpSects);

			sectionName = baseName + "s by rgbCh # [U" + universeNum.ToString();
			sectionName += ".001-U" + (universeNum + 1).ToString() + ".";
			sectionName += (166 * 3).ToString() + "]";
			ChannelGroup grpPixels = seq.CreateChannelGroup(sectionName);
			trak.AddItem(grpPixels);

			


			sectionName = baseName;
			sectionNum = 1;
			pixelNum = 1;
			if (optFenceReverse.Checked)
			{
				universeNum++;
				int n1 = totalrgbChs - MAX_PIX_PER_UNIV;
				int n2 = n1 * 3 - 2;
				chanNum = n2;
				batchStart = Int16.Parse(txtFenceStartCh.Text);
				batchEnd = Int16.Parse(txtFenceStartCh.Text);
				chIncr = -1;
			}
			else
			{
				chanNum = 1;
				batchStart = Int16.Parse(txtFenceStartCh.Text);
				batchEnd = Int16.Parse(txtFenceSections.Text);
				chIncr = 1;
			}
				
			if (optFenceRGB.Checked) chOrder = 1;
			if (optFenceGRB.Checked) chOrder = 2;

			// Sections
			for (int sect = 0; sect < sections; sect++)
			{
				//TODO: Reverse Order
				// Use just forward order for now
				ChannelGroup theGroup = AddSection(sect);
				grpSects.AddItem(theGroup);
			}


			// Create the second major group
			// Another copy of the matrix, but pivoted
			// Grouped by rgbCh # instead of by sectioon #
			for (int pxl = 0; pxl < pixelsPerSect; pxl++)
			{
				string grName = sectionName + "s #" + (pxl+1).ToString("00") + "s";
				ChannelGroup theGroup = seq.CreateChannelGroup(grName);
				for (int s=0; s< sections; s++)
				{
					theGroup.AddItem(chanMatrix[s, pxl]);
				}
				grpPixels.AddItem(theGroup);

			}

			
		} // end btnMake_Click()