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); } }
public ChannelGroup GetGroup(string groupName, IMember parent) { // Gets existing group specified by Name if it already exists in the track or group // Creates it if it does not // Can't use 'Find' functions because we only want to look in this one particular track or group // Make dummy item list Membership Children = new Membership(Sequence); // Get the parent MemberType parentType = parent.MemberType; // if parent is a group if (parent.MemberType == MemberType.ChannelGroup) { // Get it's items saved index list Children = ((ChannelGroup)parent).Members; } else // not a group { // if parent is a track if (parent.MemberType == MemberType.Track) { Children = ((Track)parent).Members; } else // not a track either { string emsg = "WTF? Parent is not group or track, but should be!"; } // end if track, or not } // end if group, or not // Create blank/null return object ChannelGroup ret = null; int gidx = 0; // loop counter // loop while we still have no group, and we haven't reached to end of the list while ((ret == null) && (gidx < Children.Count)) { // Get each item's ID //int SI = Children.Items[gidx].SavedIndex; IMember part = Children.Items[gidx]; if (part.MemberType == MemberType.ChannelGroup) { ChannelGroup group = (ChannelGroup)part; if (part.Name == groupName) { ret = group; gidx = Children.Count; } } gidx++; } if (ret == null) { //int si = Sequence.Members.HighestSavedIndex + 1; ret = Sequence.CreateChannelGroup(groupName); ret.Centiseconds = Sequence.Centiseconds; //Sequence.AddChannelGroup(ret); //ID = Sequence.Members.bySavedIndex[parentSI]; if (parent.MemberType == MemberType.Track) { ((Track)parent).Members.Add(ret); } if (parent.MemberType == MemberType.ChannelGroup) { ((ChannelGroup)parent).Members.Add(ret); } } return(ret); }
} // end btnMake_Click() public void AddStrip() { int pixID = stripStart; int nextSI = seq.Members.HighestSavedIndex; int groupMember = 1; int uch = 1; if (chIncr < 0) uch = stripCount * 3 - 2; int trkNum = Int16.Parse(txtTrack.Text) - 1; string chName; Channel redChannel = new Channel("(R)"); // Just placeholders Channel grnChannel = new Channel("(G)"); Channel bluChannel = new Channel("(B)"); //RGBchannel RGB_Channel = new RGBchannel("RGB"); //ChannelGroup pixelGroup = new ChannelGroup(); int chx; //groupCount = 0; int stripKeywdel = stripStart; int RGBFirstDMXchannel = 1; int RGBLastDMXchannel = -1; //int pixNumFirst = pixelNum; //int pixNumLast = pixNumFirst + groupSize - 1; //int stripNumFirst = stripStart; //int stripNumLast = 1; //int dmxChFirst = 1; //int dmxChLast = -1; ///////////////////////////////// // MAKE A GROUP FOR THE STRIP // /////////////////////////////// int dmxCount = stripCount * 3; if (reversed) { //Reverse int bb = stripEnd * 3 - 2; //chName = stripName + " Keywdels " + stripStart.ToString("000") + "-" + stripEnd.ToString("000") + " (U" + universeNum.ToString() + "." + bb.ToString("000") + "-" + dmxCount.ToString("000") + ")"; int sst = pixelNum; int est = pixelNum + Math.Max(stripStart, stripEnd); chName = stripName + " Keywdels " + sst.ToString("000") + "-" + est.ToString("000"); chName += " / S" + stripNum.ToString() + "." + stripStart.ToString("000") + "-" + stripEnd.ToString("000"); chName += " / U" + universeNum.ToString() + "." + bb.ToString("000") + "-" + dmxCount.ToString("000") + ")"; } else { // Forward //chName = stripName + " Keywdels " + stripStart.ToString("000") + "-" + stripCount.ToString("000") + " (U" + universeNum.ToString() + "." + stripStart.ToString("000") + "-" + dmxCount.ToString("000") + ")"; chName = stripName + " Keywdels " + pixNumFirst.ToString("000") + "-" + pixNumLast.ToString("000"); chName += " / S" + stripNum.ToString() + "." + stripStart.ToString("000") + "-" + stripEnd.ToString("000"); chName += " / U" + universeNum.ToString() + "." + stripStart.ToString("000") + "-" + dmxCount.ToString("000") + ")"; } ChannelGroup stripGroup = seq.CreateChannelGroup(chName); /////////////////////////////////////////////////////////// // MAKE AN INITIAL CHANNEL GROUP FOR THE PIXEL GROUPING // ///////////////////////////////////////////////////////// if (eaveNaming) { string gn = " Group "; if (groupNumber < 18) { //gn += (18 - groupNumber).ToString("00") + "L"; gn += (groupNumber).ToString("00") + "L"; } else { //gn += (groupNumber - 17).ToString("00") + "R"; gn += (35 - groupNumber).ToString("00") + "R"; } if (groupCount > 0) { gn += "b"; } chName = stripName + gn; } else { //chName = stripName + " Keywdels " + stripNumFirst.ToString("000") + "-" + stripKeywdel.ToString("000"); chName = stripName; //chName = " Keywdels " + (pixelNum - groupSize).ToString("000") + "-" + pixelNum.ToString("000") + " / S" + stripNum.ToString() + "." + stripNumFirst.ToString("000") + "-" + stripKeywdel.ToString("000") + " / U" + universeNum.ToString() + "." + dmxChFirst.ToString("000") + "-" + dmxChLast.ToString("000"); } /* if (reversed) { stripNumFirst = stripStart; stripNumLast = stripStart - groupSize + 1; dmxChFirst = dmxCount - groupSize * 3 + 1; dmxChLast = dmxCount; } else { stripNumFirst = stripStart; stripNumLast = stripStart + groupSize - 1; dmxChFirst = 1; dmxChLast = groupSize * 3 - 1; } */ chName += " Keywdels " + pixNumFirst.ToString("000") + "-" + pixNumLast.ToString("000"); chName += " / S" + stripNum.ToString() + "." + stripNumFirst.ToString("000") + "-" + stripNumLast.ToString("000"); chName += " / U" + universeNum.ToString() + "." + dmxChFirst.ToString("000") + "-" + dmxChLast.ToString("000") + ")"; ChannelGroup pixelGroup = seq.CreateChannelGroup(chName); stripGroup.AddItem(pixelGroup); // int gc = pixNumFirst = (groupCount + 1) * groupSize + 1; pixNumLast = (groupCount + 2) * groupSize; stripNumFirst += (groupSize * chIncr); stripNumLast += (groupSize * chIncr) + 1; dmxChFirst += (groupSize * 3 * chIncr); dmxChLast += (groupSize * 3 * chIncr); if (stripNum == 2 ) { pixNumFirst = 181; pixNumLast = 200; stripNumFirst = 11; stripNumLast = 30; dmxChFirst = 31; dmxChLast = 90; } if (stripNum == 3) { pixNumFirst = 361; pixNumLast = 380; stripNumFirst = 150; stripNumLast = 131; dmxChFirst = 391; dmxChLast = 450; } if (stripNum == 4) { pixNumFirst = 521; pixNumLast = 540; stripNumFirst = 11; stripNumLast = 30; dmxChFirst = 31; dmxChLast = 90; } string prfx = ""; if (eaveNaming) { prfx = "Eave "; } ////////////////////// // MAKE THE STRIP! // //////////////////// while ((stripKeywdel > 0) && (stripKeywdel <= stripCount)) { if (chOrder == 1) // RGB Order { //chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(R) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")"; chName = prfx + "Keywdel " + pixelNum.ToString("000"); chName += " (R) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000"); chName += " / U" + universeNum.ToString() + "." + uch.ToString("000"); redChannel = seq.CreateChannel(chName); redChannel.output.circuit = uch; RGBFirstDMXchannel = uch; uch++; //chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(G) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")"; chName = prfx + "Keywdel " + pixelNum.ToString("000"); chName += " (G) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000"); chName += " / U" + universeNum.ToString() + "." + uch.ToString("000"); grnChannel = seq.CreateChannel(chName); grnChannel.output.circuit = uch; uch++; chName = prfx + "Keywdel " + pixelNum.ToString("000"); chName += " (B) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000"); chName += " / U" + universeNum.ToString() + "." + uch.ToString("000"); bluChannel = seq.CreateChannel(chName); bluChannel.output.circuit = uch; RGBLastDMXchannel = uch; uch++; } if (chOrder == 2) // GRB Order { //chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(G) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")"; chName = prfx + "Keywdel " + pixelNum.ToString("000"); chName += " (G) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000"); chName += " / U" + universeNum.ToString() + "." + uch.ToString("000"); grnChannel = seq.CreateChannel(chName); grnChannel.output.circuit = uch; RGBFirstDMXchannel = uch; uch++; //chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(R) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")"; chName = prfx + "Keywdel " + pixelNum.ToString("000"); chName += " (R) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000"); chName += " / U" + universeNum.ToString() + "." + uch.ToString("000"); redChannel = seq.CreateChannel(chName); redChannel.output.circuit = uch; uch++; //chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(B) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")"; chName = prfx + "Keywdel " + pixelNum.ToString("000"); chName += " (B) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000"); chName += " / U" + universeNum.ToString() + "." + uch.ToString("000"); bluChannel = seq.CreateChannel(chName); bluChannel.output.circuit = uch; RGBLastDMXchannel = uch; uch++; } redChannel.output.deviceType = DeviceType.DMX; redChannel.output.network = universeNum; redChannel.color = utils.LORCOLOR_RED; grnChannel.output.deviceType = DeviceType.DMX; grnChannel.output.network = universeNum; grnChannel.color = utils.LORCOLOR_GRN; bluChannel.output.deviceType = DeviceType.DMX; bluChannel.output.network = universeNum; bluChannel.color = utils.LORCOLOR_BLU; //dmxChLast = uch - 1; chx = uch - 2; //chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + " (U" + universeNum.ToString() + "." + RGBFirstDMXchannel.ToString("000") + "-" + RGBLastDMXchannel.ToString("000") + ")"; chName = prfx + "Keywdel " + pixelNum.ToString("000"); chName += " / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000"); chName += " / U" + universeNum.ToString() + "." + RGBFirstDMXchannel.ToString("000") + "-" + RGBLastDMXchannel.ToString("000"); RGBchannel RGB_Channel = seq.CreateRGBchannel(chName); RGB_Channel.redChannel = redChannel; RGB_Channel.grnChannel = grnChannel; RGB_Channel.bluChannel = bluChannel; pixelNum++; pixelGroup.AddItem(RGB_Channel); groupCount++; ////////////////////////////////// // IS THE GROUP FULL? // // iF SO, CREATE THE NEXT ONE // /////////////////////////////// if (stripKeywdel < stripCount) { if (groupCount >= groupSize) { //stripNumLast = stripNumFirst + groupSize; //int uchStart = stripKeywdel * 3 - 2; if (chIncr < 0) { // Reverse //dmxChFirst = stripKeywdel * 3 - 2; //dmxChLast = stripNumFirst * 3; } else { // Forward // OK as-is } groupNumber++; //dmxChFirst = uch; //stripNumFirst = stripKeywdel + chIncr; if (eaveNaming) { string gn = " Group "; if (groupNumber < 18) { //gn += (18 - groupNumber).ToString("00") + "L"; gn += (groupNumber).ToString("00") + "L"; } else { //gn += (groupNumber - 17).ToString("00") + "R"; gn += (35 - groupNumber).ToString("00") + "R"; } chName = stripName + gn; } else { chName = stripName; } chName += " Keywdels " + pixNumFirst.ToString("000") + "-" + pixNumLast.ToString("000"); chName += " / S" + stripNum.ToString() + "." + stripNumFirst.ToString("000") + "-" + stripNumLast.ToString("000"); chName += " / U" + universeNum.ToString() + "." + dmxChFirst.ToString("000") + "-" + dmxChLast.ToString("000") + ")"; pixelGroup = seq.CreateChannelGroup(chName); stripGroup.AddItem(pixelGroup); pixNumFirst = pixNumLast + 1; pixNumLast += groupSize; dmxChFirst += (groupSize * 3 * chIncr); dmxChLast += (groupSize * 3 * chIncr); stripNumFirst += (groupSize * chIncr); stripNumLast += (groupSize * chIncr); //pixelGroup = new ChannelGroup(); groupCount = 0; // Reset } } else { } stripKeywdel += chIncr; if (chIncr < 0) uch -= 6; ///////////////////////////////// } // end while pixel # in range // /////////////////////////////// // Is there any leftover pixels? // (Happens when strip size is not evenly divisible by group size) if (groupCount > 0) { if (eaveNaming) { string gn = " Group "; if (groupNumber < 18) { //gn += (18 - groupNumber).ToString("00") + "aL"; gn += (groupNumber).ToString("00") + "aL"; } else { //gn += (groupNumber - 17).ToString("00") + "aR"; gn += (35 - groupNumber).ToString("00") + "aR"; } chName = stripName + gn; } else { chName = stripName; } pixNumFirst -= groupSize; pixNumLast = Math.Max(stripStart, stripEnd); stripNumFirst -= (groupSize * chIncr); stripNumLast = 1; //TODO Fix! dmxChFirst -= (groupSize * 3 * chIncr); dmxChLast = 1; chName += " Keywdels " + pixNumFirst.ToString("000") + "-" + pixNumLast.ToString("000"); chName += " / S" + stripNum.ToString() + "." + stripNumFirst.ToString("000") + "-" + (stripKeywdel + 1).ToString("000"); chName += " / U" + universeNum.ToString() + ".001" + "-" + dmxChLast.ToString("000") + ")"; pixelGroup.ChangeName(chName); stripGroup.AddItem(pixelGroup); //dmxChFirst = uch; //stripNumFirst = stripKeywdel + chIncr; } if (groupCount >= groupSize) { groupNumber++; groupCount = 0; } // Add the Strip to the Track seq.Tracks[trkNum].AddItem(stripGroup); } // end void AddStrip();
private void OldMergeSequences() { mergeTracks = Properties.Settings.Default.MergeTracks; mergeTracksByName = Properties.Settings.Default.MergeTracksByName; duplicateNameAction = Properties.Settings.Default.DuplicateNameAction; numberFormat = Properties.Settings.Default.AddNumberFormat; bool matched = false; int t2Idx = 0; 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; ///////////////////// // TIMING GRIDS // /////////////////// // Make sure existing time grids are in order (they should be, but make sure anyway) for (int t = 0; t < seqNew.TimingGrids.Count; t++) { seqNew.TimingGrids[t].timings.Sort(); } for (int timings2Idx = 0; timings2Idx < seqTwo.TimingGrids.Count; timings2Idx++) { seqTwo.TimingGrids[timings2Idx].timings.Sort(); matched = false; int matchingExTimingsGridIdx = utils.UNDEFINED; for (int exTimingGridsIdx = 0; exTimingGridsIdx < seqNew.TimingGrids.Count; exTimingGridsIdx++) { // Compare names if (seqTwo.TimingGrids[timings2Idx].CompareTo(seqNew.TimingGrids[exTimingGridsIdx]) == 0) { // Matching names found matched = true; matchingExTimingsGridIdx = exTimingGridsIdx; exTimingGridsIdx = seqNew.TimingGrids.Count; // Break out of loop } } // end loop thru new sequence's timing grids if (matched) { //MergeTimingGrids(timings2Idx, matchingExTimingsGridIdx); } else { // No timing grid with matching name found, so add this one // Create a new timing grid and copy the name and type int newSaveID = seqNew.Members.HighestSaveID + 1; TimingGrid tGrid = seqNew.CreateTimingGrid(seqTwo.TimingGrids[timings2Idx].Name); //tGrid.type = seqTwo.TimingGrids[timings2Idx].type; tGrid.spacing = seqTwo.TimingGrids[timings2Idx].spacing; // Create a new array for timings, and copy them tGrid.CopyTimings(seqTwo.TimingGrids[timings2Idx].timings, false); } // end if matched, or not } // end loop thru 2nd sequence's timing grids /////////////// // TRACKS // ///////////// foreach (Track track2 in seqTwo.Tracks) //for (int tracks2Idx = 0; tracks2Idx < seqTwo.Tracks.Count; tracks2Idx++) { matched = false; if (mergeTracks) { int matchedExTracksIdx = utils.UNDEFINED; foreach (Track newTrack in seqNew.Tracks) //for (int exTracksIdx = 0; exTracksIdx < seqNew.Tracks.Count; exTracksIdx++) { if (mergeTracksByName) { // Merge by Name if (track2.CompareTo(newTrack) == 0) { matched = true; t2Idx = track2.Index; exIdx = newTrack.Index; //exTracksIdx = seqNew.Tracks.Count; // Break out of loop break; } } else { // Merge by Number if (track2.Index == newTrack.Index) { matched = true; t2Idx = track2.Index; exIdx = newTrack.Index; //exTracksIdx = seqNew.trackCount; // Break out of loop break; } } } // New Sequence Track Loop if (matched) { //MergeTracks(t2Idx, exIdx); newTrackCount++; } } /////////////////////// // CHANNEL GROUPS // ///////////////////// foreach (ChannelGroup group2 in seqTwo.ChannelGroups) //for (int groups2Idx = 0; groups2Idx < seqTwo.channelGroupCount; groups2Idx++) { int matchedExGroupsIdx = utils.UNDEFINED; foreach (ChannelGroup newGroup in seqNew.ChannelGroups) //for (int exGroupsIdx = 0; exGroupsIdx < seqNew.channelGroupCount; exGroupsIdx++) { matched = false; if (group2.CompareTo(newGroup) == 0) { matchedExGroupsIdx = newGroup.Index; //exGroupsIdx = seqNew.channelGroupCount; break; } //Array.Resize(ref groupMap, newGroupCount + 1); Map gm = new Map(group2, newGroup); groupMap.Add(gm); if (matchedExGroupsIdx == utils.UNDEFINED) { ChannelGroup group3 = seqNew.CreateChannelGroup(group2.Name); gm = new Map(group3, newGroup); groupMap.Add(gm); } else { } newGroupCount++; } ///////////////////// // RGB CHANNELS // /////////////////// /////////////////////////// // (Regular) CHANNELS // ///////////////////////// } } }
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()