blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
905 values
visit_date
timestamp[us]date
2015-08-09 11:21:18
2023-09-06 10:45:07
revision_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-17 19:19:19
committer_date
timestamp[us]date
1997-09-14 05:04:47
2023-09-06 06:22:19
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-07 00:51:45
2023-09-14 21:58:39
gha_created_at
timestamp[us]date
2008-03-27 23:40:48
2023-08-21 23:17:38
gha_language
stringclasses
141 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
115 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
126064cc15af43df1a6202cefd7239f35bc93191
5906866d92c90456513be1c722d15f6f33013c03
/interface/src/cmd_line_render_cam_poses.cpp
10599cfe609d91101bd08f7896aeb34a96c2d45b
[ "BSD-3-Clause" ]
permissive
fulkast/simtrack
519a8a2590b5cf0c24133c2ac83ae27b8b2e538d
6fb2316831d9126a7a3d35e9c7ae738c4c5d82a9
refs/heads/master
2021-01-19T23:47:47.859149
2017-04-15T19:29:49
2017-04-15T19:29:49
83,789,612
0
0
null
2017-03-13T17:58:38
2017-03-03T11:02:40
C++
UTF-8
C++
false
false
5,875
cpp
/*****************************************************************************/ /* Copyright (c) 2015, Karl Pauwels */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* 1. Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* 2. Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in the */ /* documentation and/or other materials provided with the distribution. */ /* */ /* 3. Neither the name of the copyright holder nor the names of its */ /* contributors may be used to endorse or promote products derived from */ /* this software without specific prior written permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /*****************************************************************************/ #include <algorithm> #include <iostream> #include <sstream> #include <stdexcept> #include <hdf5_file.h> #include <device_2d.h> #include <utilities.h> #include <multi_rigid_detector.h> #include <multi_rigid_tracker.h> #include <poses_on_icosahedron.h> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> int main(int argc, char **argv) { /*********/ /* INPUT */ /*********/ interface::MultiRigidDetector::Parameters detector_parameters; vision::D_OpticalAndARFlow::Parameters flow_parameters; pose::D_MultipleRigidPoses::Parameters pose_parameters; pose_parameters.w_disp_ = 0.0; // pose_parameters.w_flow_ = 0.0; pose_parameters.w_flow_ = 1.0; flow_parameters.consistent_ = false; pose_parameters.check_reliability_ = false; std::vector<std::string> tracker_filenames{ "/home/seasponge/Workspace/catkin_local_ws/src/simtrack-flow-writer/data/object_models/texturedMug/texturedMug.obj" }; std::vector<pose::TranslationRotation3D> object_poses; int n_objects = 1; { for (int i = 0; i < n_objects; i++) { double T[3] = {0,0,0.0}; double R[3] = {0,0,0}; pose::TranslationRotation3D pose; pose.setT(T); pose.setR(R); // pose.show(); object_poses.push_back(pose); } } int width = 320; int height = 240; cv::Mat camera_matrix; { std::vector<int> size; std::vector<double> data {525.0/2., 0.0, 319.5/2., 0.0, 0.0, 525.0/2., 239.5/2., 0.0, 0.0, 0.0, 1.0, 0.0 }; camera_matrix = cv::Mat(3, 4, CV_64FC1, data.data()).clone(); } /***********/ /* PROCESS */ /***********/ int device_id = 0; util::initializeCUDARuntime(device_id); std::vector<interface::MultiRigidTracker::ObjectInfo> object_info; for (int i = 0; i < n_objects; ++i) object_info.push_back(interface::MultiRigidTracker::ObjectInfo( "dummy_label", tracker_filenames.at(i))); interface::MultiRigidTracker tracker(width, height, camera_matrix, object_info, flow_parameters, pose_parameters); tracker.setPoses(object_poses); // create icosahedron UniformGridOnIcosahedron ico(10, 10, 0.3); auto camera_poses = ico.getCameraPoses(); for (size_t i = 0; i < camera_poses.size(); ++i) { cv::Mat image; image = cv::imread("/home/seasponge/Workspace/DartExample/video/color/color00000.png", CV_LOAD_IMAGE_GRAYSCALE); tracker.updatePoses(image); cv::Mat output_image = tracker.generateOutputImage( interface::MultiRigidTracker::OutputImageType:: optical_flow_x); cv::namedWindow( "Display window", cv::WINDOW_AUTOSIZE );// Create a window for display. cv::imshow( "Display window", output_image ); // Show our image inside it. cv::waitKey(0); // Wait for a keystroke in the window // std::vector<pose::TranslationRotation3D> camera_poses(1); // { // for (int i = 0; i < 1; i++) { // double T[3] = {0,0,-1.0}; // double R[3] = {0,0,0}; // pose::TranslationRotation3D pose; // pose.setT(T); // pose.setR(R); // // pose.show(); // camera_poses[0] = pose; // } // } tracker.setCameraPose(camera_poses[i]); } return EXIT_SUCCESS; }
[ "fulkast@gmail.com" ]
fulkast@gmail.com
a09d34f59d8cbff9e1fefc2861f7e40800beb776
745f60439ee0bd1ece3089812090bf4d8f7b8fb3
/Prodavnica/Artikal.h
57c5bc87d3ecceb07c5d9c33965759950c1e8cfb
[]
no_license
kilimandzaro/Softver-za-upravljanje-proizvodima
ffae236dc6e45d5e8299eadff4017f2cbfd6ec0a
2ab4f155ce9496c19cc22eee746baa15b4425ae1
refs/heads/master
2021-05-30T05:09:58.070058
2015-12-29T13:15:41
2015-12-29T13:15:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
639
h
#pragma once #include <iostream> #include <string> #include <functional> #include <algorithm> #include <iomanip> class Artikal { public: Artikal(int = 0, std::string = "?", std::string = "?", double = 0, double = 0); bool operator==(const Artikal&); Artikal& operator=(const Artikal &); double getCijena() const; double getKol() const; double operator()() const; bool operator+=(double); friend std::istream &operator>>(std::istream &utok, Artikal&); friend std::ostream &operator<<(std::ostream &itok, const Artikal&); protected: int sifra; std::string naziv, jedinica; double cijena, kol; };
[ "petar95stojanovic@gmail.com" ]
petar95stojanovic@gmail.com
0612192fa5c9b0e7084ac329e21ef5b0bb537082
810f2f57c70e9df1e1c3862a2f43965ca9d88610
/src/operators/opProd.h
fcf7e60ba880ed121d52b25a8fd1c283719a62f7
[ "BSD-3-Clause" ]
permissive
athanor/athanor
cb5e83d4a3239a97d2940343a0fe066dd80a060a
7444f6a6a80d7a965ddbbf99ac2d0b6e30eedfeb
refs/heads/master
2023-01-30T22:16:46.311018
2022-12-20T19:13:49
2023-01-23T22:54:09
146,844,782
5
0
null
null
null
null
UTF-8
C++
false
false
1,380
h
#ifndef SRC_OPERATORS_OPPROD_H_ #define SRC_OPERATORS_OPPROD_H_ #include "operators/previousValueCache.h" #include "operators/simpleOperator.h" #include "types/int.h" #include "types/sequence.h" #include "utils/fastIterableIntSet.h" struct OpProd; template <> struct OperatorTrates<OpProd> { class OperandsSequenceTrigger; typedef OperandsSequenceTrigger OperandTrigger; }; struct OpProd : public SimpleUnaryOperator<IntView, SequenceView, OpProd> { using SimpleUnaryOperator<IntView, SequenceView, OpProd>::SimpleUnaryOperator; bool evaluationComplete = false; UInt numberZeros = 0; Int cachedValue; PreviousValueCache<Int> cachedValues; OpProd(OpProd&&) = delete; void reevaluateImpl(SequenceView& operandView); void updateVarViolationsImpl(const ViolationContext& vioContext, ViolationContainer& vioContainer) final; void copy(OpProd& newOp) const; std::ostream& dumpState(std::ostream& os) const final; void addSingleValue(Int exprValue); void removeSingleValue(Int exprValue); std::string getOpName() const final; void debugSanityCheckImpl() const final; std::pair<bool, ExprRef<IntView>> optimiseImpl(ExprRef<IntView>&, PathExtension path) final; }; #endif /* SRC_OPERATORS_OPPROD_H_ */
[ "saad_attieh@me.com" ]
saad_attieh@me.com
803d4245ca656df9162f5c64a98ce6a204adfd00
d774146f863a46b05c4d64c4e21d76fa4085f9bd
/ColorPicker/ColourPopup.cpp
fb93273e990e1fdef106a6c0397bfb8e8f7ec7ff
[]
no_license
15831944/Common-4
4550012f8eacc9de3a1def7ae1aab54d2d5a9f77
3b843f0484148b305efd3ed585a7a6bdd9fc4989
refs/heads/master
2023-03-16T18:40:49.769037
2014-09-18T07:22:05
2014-09-18T07:22:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
22,167
cpp
// ColourPopup.cpp : implementation file // // Written by Chris Maunder (Chris.Maunder@cbr.clw.csiro.au) // Extended by Alexander Bischofberger (bischofb@informatik.tu-muenchen.de) // Copyright (c) 1998. // // ColourPopup is a helper class for the colour picker control // CColourPicker. Check out the header file or the accompanying // HTML doc file for details. // // This code may be used in compiled form in any way you desire. This // file may be redistributed unmodified by any means PROVIDING it is // not sold for profit without the authors written consent, and // providing that this notice and the authors name is included. // // This file is provided "as is" with no expressed or implied warranty. // The author accepts no liability if it causes any damage to you or your // computer whatsoever. It's free, so don't hassle me about it. // // Expect bugs. // // Please use and enjoy. Please let me know of any bugs/mods/improvements // that you have found/implemented and I will fix/incorporate them into this // file. #include "stdafx.h" #include <math.h> #include "ColourPicker.h" #include "ColourPopup.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #define TEXT_BOX_VALUE -2 // Sorry about this hack... #define MAX_COLOURS 100 ColourTableEntry CColourPopup::m_crColours[] = { { RGB(0x00, 0x00, 0x00), _T("Black") }, { RGB(0xA5, 0x2A, 0x00), _T("Brown") }, { RGB(0x00, 0x40, 0x40), _T("Dark Olive Green") }, { RGB(0x00, 0x55, 0x00), _T("Dark Green") }, { RGB(0x00, 0x00, 0x5E), _T("Dark Teal") }, { RGB(0x00, 0x00, 0x8B), _T("Dark blue") }, { RGB(0x4B, 0x00, 0x82), _T("Indigo") }, { RGB(0x28, 0x28, 0x28), _T("Dark grey") }, { RGB(0x8B, 0x00, 0x00), _T("Dark red") }, { RGB(0xFF, 0x68, 0x20), _T("Orange") }, { RGB(0x8B, 0x8B, 0x00), _T("Dark yellow") }, { RGB(0x00, 0x93, 0x00), _T("Green") }, { RGB(0x38, 0x8E, 0x8E), _T("Teal") }, { RGB(0x00, 0x00, 0xFF), _T("Blue") }, { RGB(0x7B, 0x7B, 0xC0), _T("Blue-grey") }, { RGB(0x66, 0x66, 0x66), _T("Grey - 40") }, { RGB(0xFF, 0x00, 0x00), _T("Red") }, { RGB(0xFF, 0xAD, 0x5B), _T("Light orange") }, { RGB(0x32, 0xCD, 0x32), _T("Lime") }, { RGB(0x3C, 0xB3, 0x71), _T("Sea green") }, { RGB(0x7F, 0xFF, 0xD4), _T("Aqua") }, { RGB(0x7D, 0x9E, 0xC0), _T("Light blue") }, { RGB(0x80, 0x00, 0x80), _T("Violet") }, { RGB(0x7F, 0x7F, 0x7F), _T("Grey - 50") }, { RGB(0xFF, 0xC0, 0xCB), _T("Pink") }, { RGB(0xFF, 0xD7, 0x00), _T("Gold") }, { RGB(0xFF, 0xFF, 0x00), _T("Yellow") }, { RGB(0x00, 0xFF, 0x00), _T("Bright green") }, { RGB(0x40, 0xE0, 0xD0), _T("Turquoise") }, { RGB(0xC0, 0xFF, 0xFF), _T("Skyblue") }, { RGB(0x48, 0x00, 0x48), _T("Plum") }, { RGB(0xC0, 0xC0, 0xC0), _T("Light grey") }, { RGB(0xFF, 0xE4, 0xE1), _T("Rose") }, { RGB(0xD2, 0xB4, 0x8C), _T("Tan") }, { RGB(0xFF, 0xFF, 0xE0), _T("Light yellow") }, { RGB(0x98, 0xFB, 0x98), _T("Pale green ") }, { RGB(0xAF, 0xEE, 0xEE), _T("Pale turquoise") }, { RGB(0x68, 0x83, 0x8B), _T("Pale blue") }, { RGB(0xE6, 0xE6, 0xFA), _T("Lavender") }, { RGB(0xFF, 0xFF, 0xFF), _T("White") } }; ///////////////////////////////////////////////////////////////////////////// // CColourPopup CColourPopup::CColourPopup() { Initialise(); } CColourPopup::CColourPopup(CPoint p, COLORREF crColour, CWnd* pParentWnd, UINT nID, LPCTSTR szCustomText /* = NULL */, BOOL nFlag/* = TRUE */) { Initialise(); m_crColour = m_crInitialColour = crColour; if (szCustomText != NULL) { m_bShowCustom = TRUE; m_strCustomText = szCustomText; } else m_bShowCustom = FALSE; m_pParent = pParentWnd; if (nFlag) CColourPopup::Create(p, crColour, pParentWnd, nID, szCustomText); else CColourPopup::CreateWnd(p, crColour, pParentWnd, nID, szCustomText); } void CColourPopup::Initialise() { m_nNumColours = sizeof(m_crColours)/sizeof(ColourTableEntry); ASSERT(m_nNumColours <= MAX_COLOURS); if (m_nNumColours > MAX_COLOURS) m_nNumColours = MAX_COLOURS; m_nNumColumns = 0; m_nNumRows = 0; m_nBoxSize = 18; m_nMargin = ::GetSystemMetrics(SM_CXEDGE); m_nCurrentRow = -1; m_nCurrentCol = -1; m_nChosenColourRow = -1; m_nChosenColourCol = -1; m_strCustomText = _T("More..."); m_bShowCustom = TRUE; m_pParent = NULL; m_crColour = m_crInitialColour = RGB(0,0,0); // Idiot check: Make sure the colour square is at least 5 x 5; if (m_nBoxSize - 2*m_nMargin - 2 < 5) m_nBoxSize = 5 + 2*m_nMargin + 2; // Create the font NONCLIENTMETRICS ncm; ncm.cbSize = sizeof(NONCLIENTMETRICS) - sizeof(ncm.iPaddedBorderWidth); VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0)); m_Font.CreateFontIndirect(&(ncm.lfMessageFont)); // Create the palette struct { LOGPALETTE LogPalette; PALETTEENTRY PalEntry[MAX_COLOURS]; } pal; LOGPALETTE* pLogPalette = (LOGPALETTE*) &pal; pLogPalette->palVersion = 0x300; pLogPalette->palNumEntries = m_nNumColours; for (int i = 0; i < m_nNumColours; i++) { pLogPalette->palPalEntry[i].peRed = GetRValue(m_crColours[i].crColour); pLogPalette->palPalEntry[i].peGreen = GetGValue(m_crColours[i].crColour); pLogPalette->palPalEntry[i].peBlue = GetBValue(m_crColours[i].crColour); pLogPalette->palPalEntry[i].peFlags = 0; } m_Palette.CreatePalette(pLogPalette); } CColourPopup::~CColourPopup() { m_Font.DeleteObject(); m_Palette.DeleteObject(); } BOOL CColourPopup::Create(CPoint p, COLORREF crColour, CWnd* pParentWnd, UINT nID, LPCTSTR szCustomText /* = NULL */) { ASSERT(pParentWnd && ::IsWindow(pParentWnd->GetSafeHwnd())); ASSERT(pParentWnd->IsKindOf(RUNTIME_CLASS(CColourPicker))); m_pParent = pParentWnd; m_crColour = m_crInitialColour = crColour; // Get the class name and create the window CString szClassName = AfxRegisterWndClass(CS_CLASSDC|CS_SAVEBITS|CS_HREDRAW|CS_VREDRAW, 0, (HBRUSH)GetStockObject(LTGRAY_BRUSH),0); if (!CWnd::CreateEx(0, szClassName, _T(""), WS_VISIBLE|WS_POPUP, p.x, p.y, 100, 100, // size updated soon pParentWnd->GetSafeHwnd(), 0, NULL)) return FALSE; // Store the Custom text if (szCustomText != NULL) m_strCustomText = szCustomText; // Set the window size SetWindowSize(); // Create the tooltips CreateToolTips(); // Find which cell (if any) corresponds to the initial colour FindCellFromColour(crColour); // Capture all mouse events for the life of this window SetCapture(); return TRUE; } BOOL CColourPopup::CreateWnd(CPoint p, COLORREF crColour, CWnd* pParentWnd, UINT nID, LPCTSTR szCustomText /* = NULL */) { // ASSERT(pParentWnd && ::IsWindow(pParentWnd->GetSafeHwnd())); // ASSERT(pParentWnd->IsKindOf(RUNTIME_CLASS(CColourPicker))); m_pParent = pParentWnd; m_crColour = m_crInitialColour = crColour; // Get the class name and create the window CString szClassName = AfxRegisterWndClass(CS_CLASSDC|CS_SAVEBITS|CS_HREDRAW|CS_VREDRAW, 0, (HBRUSH)GetStockObject(LTGRAY_BRUSH),0); if (!CWnd::CreateEx(0, szClassName, _T(""), WS_VISIBLE|WS_POPUP, p.x, p.y, 100, 100, // size updated soon pParentWnd->GetSafeHwnd(), 0, NULL)) return FALSE; // Store the Custom text if (szCustomText != NULL) m_strCustomText = szCustomText; // Set the window size SetWindowSize(); // Create the tooltips CreateToolTips(); // Find which cell (if any) corresponds to the initial colour FindCellFromColour(crColour); // Capture all mouse events for the life of this window SetCapture(); return TRUE; } BEGIN_MESSAGE_MAP(CColourPopup, CWnd) //{{AFX_MSG_MAP(CColourPopup) ON_WM_NCDESTROY() ON_WM_LBUTTONUP() ON_WM_PAINT() ON_WM_MOUSEMOVE() ON_WM_KEYDOWN() ON_WM_QUERYNEWPALETTE() ON_WM_PALETTECHANGED() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CColourPopup message handlers // For tooltips BOOL CColourPopup::PreTranslateMessage(MSG* pMsg) { m_ToolTip.RelayEvent(pMsg); return CWnd::PreTranslateMessage(pMsg); } // If an arrow key is pressed, then move the selection void CColourPopup::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { int row = m_nCurrentRow, col = m_nCurrentCol; if (nChar == VK_DOWN) { if (row < 0) { row = 0; col = 0; } else if (row < m_nNumRows-1) row++; else { row = TEXT_BOX_VALUE; col = TEXT_BOX_VALUE; } ChangeSelection(row, col); } if (nChar == VK_UP) { if (row < 0) { row = m_nNumRows-1; col = 0; } else if (row > 0) row--; else { row = TEXT_BOX_VALUE; col = TEXT_BOX_VALUE; } ChangeSelection(row, col); } if (nChar == VK_RIGHT) { if (col < 0) { row = 0; col = 0; } else if (col < m_nNumColumns-1) col++; else col = 0; ChangeSelection(row, col); } if (nChar == VK_LEFT) { if (col < 0) { row = m_nNumRows-1; col = m_nNumColumns-1; } else if (col > 0) col--; else col = m_nNumColumns-1; ChangeSelection(row, col); } if (nChar == VK_ESCAPE) { m_crColour = m_crInitialColour; EndSelection(CPN_SELENDCANCEL); return; } if (nChar == VK_RETURN) { EndSelection(CPN_SELENDOK); return; } CWnd::OnKeyDown(nChar, nRepCnt, nFlags); } // auto-deletion void CColourPopup::OnNcDestroy() { CWnd::OnNcDestroy(); delete this; } void CColourPopup::OnPaint() { CPaintDC dc(this); // device context for painting // Draw colour cells for (int row = 0; row < m_nNumRows; row++) for (int col = 0; col < m_nNumColumns; col++) DrawCell(&dc, row, col); // Draw custom text if (m_bShowCustom) DrawCell(&dc, TEXT_BOX_VALUE, TEXT_BOX_VALUE); // Draw raised window edge (ex-window style WS_EX_WINDOWEDGE is sposed to do this, // but for some reason isn't CRect rect; GetClientRect(rect); dc.DrawEdge(rect, EDGE_RAISED, BF_RECT); } void CColourPopup::OnMouseMove(UINT nFlags, CPoint point) { int row, col; // Translate points to be relative raised window edge point.x -= m_nMargin; point.y -= m_nMargin; // First check we aren't in text box if (m_bShowCustom && m_TextRect.PtInRect(point)) row = col = TEXT_BOX_VALUE; // Special value meaning Text Box (hack!) else { // Take into account text box if (m_bShowCustom) point.y -= m_TextRect.Height(); // Get the row and column row = point.y / m_nBoxSize, col = point.x / m_nBoxSize; // In range? If not, default and exit if (row < 0 || row >= m_nNumRows || col < 0 || col >= m_nNumColumns) { CWnd::OnMouseMove(nFlags, point); return; } } // OK - we have the row and column of the current selection (may be TEXT_BOX_VALUE) // Has the row/col selection changed? If yes, then redraw old and new cells. if (row != m_nCurrentRow || col != m_nCurrentCol) { ChangeSelection(row, col); } CWnd::OnMouseMove(nFlags, point); } // End selection on LButtonUp void CColourPopup::OnLButtonUp(UINT nFlags, CPoint point) { CWnd::OnLButtonUp(nFlags, point); DWORD pos = GetMessagePos(); point = CPoint(LOWORD(pos), HIWORD(pos)); if (m_WindowRect.PtInRect(point)) EndSelection(CPN_SELENDOK); else EndSelection(CPN_SELENDCANCEL); } ///////////////////////////////////////////////////////////////////////////// // CColourPopup implementation void CColourPopup::FindCellFromColour(COLORREF crColour) { for (int row = 0; row < m_nNumRows; row++) for (int col = 0; col < m_nNumColumns; col++) { if (GetColour(row, col) == crColour) { m_nChosenColourRow = row; m_nChosenColourCol = col; return; } } m_nChosenColourRow = TEXT_BOX_VALUE; m_nChosenColourCol = TEXT_BOX_VALUE; } // Gets the dimensions of the colour cell given by (row,col) BOOL CColourPopup::GetCellRect(int row, int col, const LPRECT& rect) { if (row < 0 || row >= m_nNumRows || col < 0 || col >= m_nNumColumns) return FALSE; rect->left = col*m_nBoxSize + m_nMargin; rect->top = row*m_nBoxSize + m_nMargin; // Move everything down if we are displaying text if (m_bShowCustom) rect->top += (m_nMargin + m_TextRect.Height()); rect->right = rect->left + m_nBoxSize; rect->bottom = rect->top + m_nBoxSize; return TRUE; } // Works out an appropriate size and position of this window void CColourPopup::SetWindowSize() { CSize TextSize; // If we are showing a custom text area, get the font and text size. if (m_bShowCustom) { // Get the size of the custom text CClientDC dc(this); CFont* pOldFont = (CFont*) dc.SelectObject(&m_Font); TextSize = dc.GetTextExtent(m_strCustomText) + CSize(2*m_nMargin,2*m_nMargin); dc.SelectObject(pOldFont); // Add even more space to draw the horizontal line TextSize.cy += 2*m_nMargin + 2; } // Get the number of columns and rows //m_nNumColumns = (int) sqrt((double)m_nNumColours); // for a square window (yuk) m_nNumColumns = 8; m_nNumRows = m_nNumColours / m_nNumColumns; if (m_nNumColours % m_nNumColumns) m_nNumRows++; // Get the current window position, and set the new size CRect rect; GetWindowRect(rect); m_WindowRect.SetRect(rect.left, rect.top, rect.left + m_nNumColumns*m_nBoxSize + 2*m_nMargin, rect.top + m_nNumRows*m_nBoxSize + 2*m_nMargin); // if custom text, then expand window if necessary, and set text width as // window width if (m_bShowCustom) { m_WindowRect.bottom += (m_nMargin + TextSize.cy); if (TextSize.cx > m_WindowRect.Width()) m_WindowRect.right = m_WindowRect.left + TextSize.cx; TextSize.cx = m_WindowRect.Width()-2*m_nMargin; // Work out the text area m_TextRect.SetRect(m_nMargin, m_nMargin, m_nMargin+TextSize.cx, m_nMargin+TextSize.cy); } // // Need to check it'll fit on screen: Too far right? // CSize ScreenSize(::GetSystemMetrics(SM_CXSCREEN), ::GetSystemMetrics(SM_CYSCREEN)); // if (m_WindowRect.right > ScreenSize.cx) // m_WindowRect.OffsetRect(-(m_WindowRect.right - ScreenSize.cx), 0); // // // Too far left? // if (m_WindowRect.left < 0) // m_WindowRect.OffsetRect( -m_WindowRect.left, 0); // // // Bottom falling out of screen? // if (m_WindowRect.bottom > ScreenSize.cy) // { // CRect ParentRect; // m_pParent->GetWindowRect(ParentRect); // m_WindowRect.OffsetRect(0, -(ParentRect.Height() + m_WindowRect.Height())); // } // Set the window size and position MoveWindow(m_WindowRect, TRUE); } void CColourPopup::CreateToolTips() { // Create the tool tip if (!m_ToolTip.Create(this)) return; // Add a tool for each cell for (int row = 0; row < m_nNumRows; row++) for (int col = 0; col < m_nNumColumns; col++) { CRect rect; if (!GetCellRect(row, col, rect)) continue; m_ToolTip.AddTool(this, GetColourName(row, col), rect, 1); } } void CColourPopup::ChangeSelection(int row, int col) { CClientDC dc(this); // device context for drawing if ((m_nCurrentRow >= 0 && m_nCurrentRow < m_nNumRows && m_nCurrentCol >= 0 && m_nCurrentCol < m_nNumColumns) || (m_nCurrentCol == TEXT_BOX_VALUE && m_nCurrentCol == TEXT_BOX_VALUE)) { // Set Current selection as invalid and redraw old selection (this way // the old selection will be drawn unselected) int OldRow = m_nCurrentRow, OldCol = m_nCurrentCol; m_nCurrentRow = m_nCurrentCol = -1; DrawCell(&dc, OldRow, OldCol); } // Set the current selection as row/col and draw (it will be drawn selected) m_nCurrentRow = row; m_nCurrentCol = col; DrawCell(&dc, m_nCurrentRow, m_nCurrentCol); // Store the current colour if (m_nCurrentRow == TEXT_BOX_VALUE && m_nCurrentCol == TEXT_BOX_VALUE) m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) m_crInitialColour, 0); else { m_crColour = GetColour(m_nCurrentRow, m_nCurrentCol); m_pParent->SendMessage(CPN_SELCHANGE, (WPARAM) m_crColour, 0); } } void CColourPopup::EndSelection(int nMessage) { ReleaseCapture(); // If custom text selected, perform a custom colour selection if (nMessage != CPN_SELENDCANCEL && m_nCurrentCol == TEXT_BOX_VALUE && m_nCurrentRow == TEXT_BOX_VALUE) { CColorDialog dlg(m_crInitialColour, CC_FULLOPEN | CC_ANYCOLOR, this); if (dlg.DoModal() == IDOK) m_crColour = dlg.GetColor(); else { m_crColour = m_crInitialColour; nMessage = CPN_SELENDCANCEL; } } if (nMessage == CPN_SELENDCANCEL) m_crColour = m_crInitialColour; m_pParent->SendMessage(nMessage, (WPARAM) m_crColour, 0); DestroyWindow(); } void CColourPopup::DrawCell(CDC* pDC, int row, int col) { // This is a special hack for the text box if (m_bShowCustom && row == TEXT_BOX_VALUE && row == TEXT_BOX_VALUE) { // The extent of the actual text button CRect TextButtonRect = m_TextRect; TextButtonRect.bottom -= (2*m_nMargin+2); // Fill background //if ( (m_nChosenColourRow == row && m_nChosenColourCol == col) // && !(m_nCurrentRow == row && m_nCurrentCol == col) ) // pDC->FillSolidRect(m_TextRect, ::GetSysColor(COLOR_3DHILIGHT)); //else pDC->FillSolidRect(m_TextRect, ::GetSysColor(COLOR_3DFACE)); // Draw button //if (m_nChosenColourRow == row && m_nChosenColourCol == col) // pDC->DrawEdge(TextButtonRect, EDGE_SUNKEN, BF_RECT); //else if (m_nCurrentRow == row && m_nCurrentCol == col) pDC->DrawEdge(TextButtonRect, EDGE_RAISED, BF_RECT); // Draw custom text CFont *pOldFont = (CFont*) pDC->SelectObject(&m_Font); pDC->DrawText(m_strCustomText, TextButtonRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE); pDC->SelectObject(pOldFont); // Draw horizontal line pDC->FillSolidRect(m_TextRect.left+2*m_nMargin, m_TextRect.bottom-m_nMargin-2, m_TextRect.Width()-4*m_nMargin, 1, ::GetSysColor(COLOR_3DSHADOW)); pDC->FillSolidRect(m_TextRect.left+2*m_nMargin, m_TextRect.bottom-m_nMargin-1, m_TextRect.Width()-4*m_nMargin, 1, ::GetSysColor(COLOR_3DHILIGHT)); return; } // row/col in range? ASSERT(row >= 0 && row < m_nNumRows); ASSERT(col >= 0 && col < m_nNumColumns); // Select and realize the palette CPalette* pOldPalette; if (pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE) { pOldPalette = pDC->SelectPalette(&m_Palette, FALSE); pDC->RealizePalette(); } CRect rect; if (!GetCellRect(row, col, rect)) return; // fill background if ( (m_nChosenColourRow == row && m_nChosenColourCol == col) && !(m_nCurrentRow == row && m_nCurrentCol == col) ) pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DHILIGHT)); else pDC->FillSolidRect(rect, ::GetSysColor(COLOR_3DFACE)); // Draw button if (m_nChosenColourRow == row && m_nChosenColourCol == col) pDC->DrawEdge(rect, EDGE_SUNKEN, BF_RECT); else if (m_nCurrentRow == row && m_nCurrentCol == col) pDC->DrawEdge(rect, EDGE_RAISED, BF_RECT); // Draw raised edge if selected if (m_nCurrentRow == row && m_nCurrentCol == col) pDC->DrawEdge(rect, EDGE_RAISED, BF_RECT); CBrush brush(PALETTERGB(GetRValue(GetColour(row, col)), GetGValue(GetColour(row, col)), GetBValue(GetColour(row, col)) )); CPen pen; pen.CreatePen(PS_SOLID, 1, ::GetSysColor(COLOR_3DSHADOW)); CBrush* pOldBrush = (CBrush*) pDC->SelectObject(&brush); CPen* pOldPen = (CPen*) pDC->SelectObject(&pen); // Draw the cell colour rect.DeflateRect(m_nMargin+1, m_nMargin+1); pDC->Rectangle(rect); // restore DC and cleanup pDC->SelectObject(pOldBrush); pDC->SelectObject(pOldPen); brush.DeleteObject(); pen.DeleteObject(); if (pDC->GetDeviceCaps(RASTERCAPS) & RC_PALETTE) pDC->SelectPalette(pOldPalette, FALSE); } BOOL CColourPopup::OnQueryNewPalette() { Invalidate(); return CWnd::OnQueryNewPalette(); } void CColourPopup::OnPaletteChanged(CWnd* pFocusWnd) { CWnd::OnPaletteChanged(pFocusWnd); if (pFocusWnd->GetSafeHwnd() != GetSafeHwnd()) Invalidate(); }
[ "ljjoon@naver.com" ]
ljjoon@naver.com
f26dd2b36860ca2d27614410c5d200b011ca5d71
1afaa0f2420548719d6c5cf0d100bbc4cf00901e
/library/src/main/cpp/editor/image_process.cc
5599f02f54282d301308fb99ce9f995fddc43ab3
[ "Apache-2.0", "MIT" ]
permissive
hyb1234hi/trinity
0eac26685d2fafaf5e1f3783fc18ab2dca28fce0
83e705293aafeb8963c34dbf7c17af3a12659867
refs/heads/master
2020-11-26T03:46:47.035852
2019-11-24T09:28:58
2019-12-13T13:22:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
19,224
cc
/* * Copyright (C) 2019 Trinity. All rights reserved. * Copyright (C) 2019 Wang LianJie <wlanjie888@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Created by wlanjie on 2019-06-05. // #include "image_process.h" #include <utility> #include "android_xlog.h" #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" #define FILTER "Filter" #define FLASH_WHITE "FlashWhite" #define SPLIT_SCREEN "SplitScreen" #define BLUR_SPLIT_SCREEN "BlurSplitScreen" #define SOUL_SCALE "SoulScale" #define SHAKE "Shake" #define SKIN_NEEDLING "SkinNeedling" namespace trinity { ImageProcess::ImageProcess() { } ImageProcess::~ImageProcess() { ClearAction(); } int ImageProcess::Process(int texture_id, uint64_t current_time, int width, int height, int input_color_type, int output_color_type) { return OnProcess(texture_id, current_time, width, height); } int ImageProcess::Process(uint8_t *frame, uint64_t current_time, int width, int height, int input_color_type, int output_color_type) { return OnProcess(0, current_time, width, height); } int ImageProcess::OnProcess(int texture_id, uint64_t current_time, int width, int height) { int texture = texture_id; for (auto& effect : effects_) { FrameBuffer* frame_buffer = effect.second; int process_texture = frame_buffer->OnDrawFrame(texture, current_time); texture = process_texture; } return texture; } void ImageProcess::OnAction(char* config, int action_id) { ParseConfig(config, action_id); } void ImageProcess::ParseConfig(char *config, int action_id) { cJSON* json = cJSON_Parse(config); if (nullptr != json) { cJSON* effect_json = cJSON_GetObjectItem(json, "effect"); if (nullptr != effect_json) { int effect_size = cJSON_GetArraySize(effect_json); for (int i = 0; i < effect_size; ++i) { cJSON *effect_item_json = cJSON_GetArrayItem(effect_json, i); cJSON *name_json = cJSON_GetObjectItem(effect_item_json, "name"); cJSON *vertex_shader_json = cJSON_GetObjectItem(effect_item_json, "vertexShader"); cJSON *fragment_shader_json = cJSON_GetObjectItem(effect_item_json, "fragmentShader"); cJSON *start_time_json = cJSON_GetObjectItem(effect_item_json, "startTime"); cJSON *end_time_json = cJSON_GetObjectItem(effect_item_json, "endTime"); cJSON *vertex_uniforms_json = cJSON_GetObjectItem(effect_item_json, "vertexUniforms"); cJSON *fragment_uniforms_json = cJSON_GetObjectItem(effect_item_json, "fragmentUniforms"); if (nullptr == name_json) { continue; } char* name = name_json->valuestring; char* vertex_shader = nullptr; if (nullptr != vertex_shader_json) { vertex_shader = vertex_shader_json->valuestring; } char* fragment_shader = nullptr; if (nullptr != fragment_shader_json) { fragment_shader = fragment_shader_json->valuestring; } int start_time = 0; if (nullptr != start_time_json) { start_time = start_time_json->valueint; } int end_time = INT_MAX; if (nullptr != end_time_json) { end_time = end_time_json->valueint; } int vertex_uniforms_size = 0; if (nullptr != vertex_uniforms_json) { vertex_uniforms_size = cJSON_GetArraySize(vertex_uniforms_json); } if (strcmp(name, FILTER) == 0) { // 滤镜 OnFilter(start_time, end_time, effect_item_json, action_id); } else if (strcmp(name, FLASH_WHITE) == 0) { // 闪白 OnFlashWhite(fragment_uniforms_json, start_time, end_time, action_id); } else if (strcmp(name, SPLIT_SCREEN) == 0) { // 分屏 OnSplitScreen(fragment_uniforms_json, start_time, end_time, action_id); } else if (strcmp(name, BLUR_SPLIT_SCREEN) == 0) { // 模糊分屏 OnBlurSplitScreen(fragment_uniforms_json, start_time, end_time, action_id); } else if (strcmp(name, SOUL_SCALE) == 0) { // 灵魂出窍 OnSoulScale(fragment_uniforms_json, start_time, end_time, action_id); } else if (strcmp(name, SHAKE) == 0) { // 抖动 OnShake(fragment_uniforms_json, start_time, end_time, action_id); } else if (strcmp(name, SKIN_NEEDLING) == 0) { // 毛刺 OnSkinNeedling(fragment_uniforms_json, start_time, end_time, action_id); } } } cJSON_Delete(json); } } void ImageProcess::RemoveAction(int action_id) { auto result = effects_.find(action_id); if (result != effects_.end()) { FrameBuffer* frame_buffer = effects_[action_id]; delete frame_buffer; effects_.erase(action_id); } } void ImageProcess::ClearAction() { for (auto& effect : effects_) { FrameBuffer* buffer = effect.second; delete buffer; } effects_.clear(); } void ImageProcess::OnFilter(int start_time, int end_time, cJSON* json, int action_id) { LOGI("enter %s start_time: %d end_time: %d action_id: %d", __func__, start_time, end_time, action_id); cJSON* intensity_json = cJSON_GetObjectItem(json, "intensity"); float intensity = 1.0f; if (nullptr != intensity_json) { intensity = static_cast<float>(intensity_json->valuedouble); } cJSON* lut_json = cJSON_GetObjectItem(json, "lut"); if (nullptr != lut_json) { char* lut_path = lut_json->valuestring; int lut_width = 0; int lut_height = 0; int channels = 0; unsigned char* lut_buffer = stbi_load(lut_path, &lut_width, &lut_height, &channels, STBI_rgb_alpha); if (nullptr == lut_buffer) { LOGE("load filter image error."); return; } if ((lut_width == 512 && lut_height == 512) || (lut_width == 64 && lut_height == 64)) { auto result = effects_.find(action_id); if (result == effects_.end()) { auto *filter = new Filter(lut_buffer, 720, 1280); filter->SetStartTime(start_time); filter->SetEndTime(end_time); filter->SetIntensity(intensity); effects_.insert(std::pair<int, FrameBuffer *>(action_id, filter)); } else { FrameBuffer *frame_buffer = effects_[action_id]; frame_buffer->SetStartTime(start_time); frame_buffer->SetEndTime(end_time); auto *filter = dynamic_cast<Filter *>(frame_buffer); if (nullptr != filter) { filter->SetIntensity(intensity); filter->UpdateLut(lut_buffer, 720, 1280); } } } stbi_image_free(lut_buffer); } LOGI("leave %s", __func__); } void ImageProcess::OnRotate(float rotate, int action_id) { } void ImageProcess::OnFlashWhite(cJSON* fragment_uniforms, int start_time, int end_time, int action_id) { auto result = effects_.find(action_id); if (result == effects_.end()) { int fragment_uniforms_size = 0; if (nullptr != fragment_uniforms) { fragment_uniforms_size = cJSON_GetArraySize(fragment_uniforms); } auto* flash_write = new FlashWhite(720, 1280); flash_write->SetStartTime(start_time); flash_write->SetEndTime(end_time); for (int index = 0; index < fragment_uniforms_size; ++index) { cJSON *fragment_uniforms_item_json = cJSON_GetArrayItem(fragment_uniforms, index); if (nullptr == fragment_uniforms_item_json) { return; } cJSON *fragment_uniforms_name_json = cJSON_GetObjectItem(fragment_uniforms_item_json, "name"); cJSON* fragment_uniforms_data_json = cJSON_GetObjectItem(fragment_uniforms_item_json, "data"); if (nullptr == fragment_uniforms_name_json) { return; } if (nullptr == fragment_uniforms_data_json) { return; } int size = cJSON_GetArraySize(fragment_uniforms_data_json); auto* param_value = new float[size]; for (int i = 0; i < size; i++) { cJSON* data_item = cJSON_GetArrayItem(fragment_uniforms_data_json, i); auto value = static_cast<float>(data_item->valuedouble); param_value[i] = value; } char* name = fragment_uniforms_name_json->valuestring; if (strcmp(name, "alphaTimeLine") == 0) { flash_write->SetAlphaTime(param_value, size); } delete[] param_value; } effects_.insert(std::pair<int, FrameBuffer*>(action_id, flash_write)); } else { FrameBuffer* frame_buffer = effects_[action_id]; frame_buffer->SetStartTime(start_time); frame_buffer->SetEndTime(end_time); } } void ImageProcess::OnSplitScreen(cJSON* fragment_uniforms, int start_time, int end_time, int action_id) { auto result = effects_.find(action_id); if (result == effects_.end()) { int fragment_uniforms_size = 0; if (nullptr != fragment_uniforms) { fragment_uniforms_size = cJSON_GetArraySize(fragment_uniforms); } int screen_count = 0; for (int index = 0; index < fragment_uniforms_size; ++index) { cJSON *fragment_uniforms_item_json = cJSON_GetArrayItem(fragment_uniforms, index); if (nullptr == fragment_uniforms_item_json) { return; } cJSON *fragment_uniforms_name_json = cJSON_GetObjectItem(fragment_uniforms_item_json, "name"); if (nullptr == fragment_uniforms_name_json) { return; } cJSON* fragment_uniforms_data_json = cJSON_GetObjectItem(fragment_uniforms_item_json, "data"); char* name = fragment_uniforms_name_json->valuestring; if (strcmp(name, "splitScreenCount") == 0 && nullptr != fragment_uniforms_data_json) { screen_count = fragment_uniforms_data_json->valueint; } } if (screen_count == 0) { return; } FrameBuffer* frame_buffer = nullptr; if (screen_count == 2) { frame_buffer = new FrameBuffer(720, 1280, DEFAULT_VERTEX_SHADER, SCREEN_TWO_FRAGMENT_SHADER); } else if (screen_count == 3) { frame_buffer = new FrameBuffer(720, 1280, DEFAULT_VERTEX_SHADER, SCREEN_THREE_FRAGMENT_SHADER); } else if (screen_count == 4) { frame_buffer = new FrameBuffer(720, 1280, DEFAULT_VERTEX_SHADER, SCREEN_FOUR_FRAGMENT_SHADER); } else if (screen_count == 6) { frame_buffer = new FrameBuffer(720, 1280, DEFAULT_VERTEX_SHADER, SCREEN_SIX_FRAGMENT_SHADER); } else if (screen_count == 9) { frame_buffer = new FrameBuffer(720, 1280, DEFAULT_VERTEX_SHADER, SCREEN_NINE_FRAGMENT_SHADER); } if (frame_buffer == nullptr) { return; } frame_buffer->SetStartTime(start_time); frame_buffer->SetEndTime(end_time); effects_.insert(std::pair<int, FrameBuffer*>(action_id, frame_buffer)); } else { FrameBuffer* frame_buffer = effects_[action_id]; frame_buffer->SetStartTime(start_time); frame_buffer->SetEndTime(end_time); } } void ImageProcess::OnBlurSplitScreen(cJSON* fragment_uniforms, int start_time, int end_time, int action_id) { auto result = effects_.find(action_id); if (result == effects_.end()) { auto* screen = new BlurSplitScreen(720, 1280); screen->SetStartTime(start_time); screen->SetEndTime(end_time); effects_.insert(std::pair<int, FrameBuffer*>(action_id, screen)); } else { auto* screen = effects_[action_id]; screen->SetStartTime(start_time); screen->SetEndTime(end_time); } } void ImageProcess::OnSoulScale(cJSON* fragment_uniforms, int start_time, int end_time, int action_id) { auto result = effects_.find(action_id); if (result == effects_.end()) { int fragment_uniforms_size = 0; if (nullptr != fragment_uniforms) { fragment_uniforms_size = cJSON_GetArraySize(fragment_uniforms); } auto* soul_scale = new SoulScale(720, 1280); soul_scale->SetStartTime(start_time); soul_scale->SetEndTime(end_time); for (int index = 0; index < fragment_uniforms_size; ++index) { cJSON *fragment_uniforms_item_json = cJSON_GetArrayItem(fragment_uniforms, index); if (nullptr == fragment_uniforms_item_json) { return; } cJSON *fragment_uniforms_name_json = cJSON_GetObjectItem(fragment_uniforms_item_json, "name"); cJSON* fragment_uniforms_data_json = cJSON_GetObjectItem(fragment_uniforms_item_json, "data"); if (nullptr == fragment_uniforms_name_json) { return; } if (nullptr == fragment_uniforms_data_json) { return; } char* name = fragment_uniforms_name_json->valuestring; int size = cJSON_GetArraySize(fragment_uniforms_data_json); auto* param_value = new float[size]; for (int i = 0; i < size; i++) { cJSON* data_item = cJSON_GetArrayItem(fragment_uniforms_data_json, i); auto value = static_cast<float>(data_item->valuedouble); param_value[i] = value; } if (strcmp(name, "mixturePercent") == 0) { soul_scale->SetMixPercent(param_value, size); } else if (strcmp(name, "scalePercent") == 0) { soul_scale->SetScalePercent(param_value, size); } delete[] param_value; } effects_.insert(std::pair<int, FrameBuffer*>(action_id, soul_scale)); } else { FrameBuffer* frame_buffer = effects_[action_id]; frame_buffer->SetStartTime(start_time); frame_buffer->SetEndTime(end_time); } } void ImageProcess::OnShake(cJSON* fragment_uniforms, int start_time, int end_time, int action_id) { auto result = effects_.find(action_id); if (result == effects_.end()) { int fragment_uniforms_size = 0; if (nullptr != fragment_uniforms) { fragment_uniforms_size = cJSON_GetArraySize(fragment_uniforms); } auto* shake = new Shake(720, 1280); shake->SetStartTime(start_time); shake->SetEndTime(end_time); for (int index = 0; index < fragment_uniforms_size; ++index) { cJSON *fragment_uniforms_item_json = cJSON_GetArrayItem(fragment_uniforms, index); if (nullptr == fragment_uniforms_item_json) { return; } cJSON *fragment_uniforms_name_json = cJSON_GetObjectItem(fragment_uniforms_item_json, "name"); cJSON* fragment_uniforms_data_json = cJSON_GetObjectItem(fragment_uniforms_item_json, "data"); if (nullptr == fragment_uniforms_name_json) { return; } if (nullptr == fragment_uniforms_data_json) { return; } char* name = fragment_uniforms_name_json->valuestring; int size = cJSON_GetArraySize(fragment_uniforms_data_json); auto* param_value = new float[size]; for (int i = 0; i < size; i++) { cJSON* data_item = cJSON_GetArrayItem(fragment_uniforms_data_json, i); auto value = static_cast<float>(data_item->valuedouble); param_value[i] = value; } if (strcmp(name, "scale") == 0) { shake->SetScalePercent(param_value, size); } delete[] param_value; } effects_.insert(std::pair<int, FrameBuffer*>(action_id, shake)); } else { FrameBuffer* frame_buffer = effects_[action_id]; frame_buffer->SetStartTime(start_time); frame_buffer->SetEndTime(end_time); } } void ImageProcess::OnSkinNeedling(cJSON* fragment_uniforms, int start_time, int end_time, int action_id) { auto result = effects_.find(action_id); if (result == effects_.end()) { int fragment_uniforms_size = 0; if (nullptr != fragment_uniforms) { fragment_uniforms_size = cJSON_GetArraySize(fragment_uniforms); } auto* skin_needling = new SkinNeedling(720, 1280); skin_needling->SetStartTime(start_time); skin_needling->SetEndTime(end_time); for (int index = 0; index < fragment_uniforms_size; ++index) { cJSON *fragment_uniforms_item_json = cJSON_GetArrayItem(fragment_uniforms, index); if (nullptr == fragment_uniforms_item_json) { return; } cJSON *fragment_uniforms_name_json = cJSON_GetObjectItem(fragment_uniforms_item_json, "name"); cJSON* fragment_uniforms_data_json = cJSON_GetObjectItem(fragment_uniforms_item_json, "data"); if (nullptr == fragment_uniforms_name_json) { return; } char* name = fragment_uniforms_name_json->valuestring; if (strcmp(name, "") == 0 && nullptr != fragment_uniforms_data_json) { int size = cJSON_GetArraySize(fragment_uniforms_data_json); auto* param_value = new float[size]; for (int i = 0; i < size; i++) { cJSON* data_item = cJSON_GetArrayItem(fragment_uniforms_data_json, i); auto value = static_cast<float>(data_item->valuedouble); param_value[i] = value; } // skin_needling->(param_value, size); delete[] param_value; } } effects_.insert(std::pair<int, FrameBuffer*>(action_id, skin_needling)); } else { FrameBuffer* frame_buffer = effects_[action_id]; frame_buffer->SetStartTime(start_time); frame_buffer->SetEndTime(end_time); } } } // namespace trinity
[ "wlanjie888@gmail.com" ]
wlanjie888@gmail.com
43723fd27adb8715c1a0214c08089fa37ba56845
1063f7e13f50fa0fee6723a77dc533d786e3082f
/trunk/src/main/smv/common_smv.h
f86dc5e3e063ce4958872374600ae0df3c466de1
[]
no_license
zjm1060/HandSet
9e9b8af71ee57a7b90a470473edb72ef7b03c336
59a896e38996fe9f9b549316974bf82ffa046e1e
refs/heads/master
2022-12-21T19:52:10.349284
2017-03-10T08:20:14
2017-03-10T08:20:14
112,681,985
0
0
null
2020-09-25T01:00:09
2017-12-01T01:50:46
C++
GB18030
C++
false
false
4,536
h
/** * \file * common_smv.h * * \brief * smv公共资源定义文件 * * \copyright * Copyright(c) 2016 广州炫通电气科技有限公司 * * \author * chao 2013/7/2 */ #ifndef COMMON_SMV_H__ #define COMMON_SMV_H__ #define DSM_SMV_BLINK_TIPS_TIME 0x300000 ///< 显示提示通道数量发生变化信息的时长 ////////////////////////////////////////////////////////////////////////// // 相量 序量 核相 共用 #if SU_FEI #define DSM_PHASOR_REPORT_CAPTION 80 ///< 标题列宽度 #define DSM_PHASOR_REPORT_VALUE 180 ///< 内容列宽度 #define DSM_PHASOR_REPORT_EFFECTIVE 160 ///< 有效值宽度 #define DSM_PHASOR_REPORT_ANGEL 160 ///< 相角差宽度 #define DSM_PHASOR_MARGIN CRect(20, 40, 0, 40) ///< phasorgram间距 #define DSM_PHASOR_REPORT_RECT CRect(0, DSM_P_BODY_TOP, 260, DSM_P_BODY_BOTTOM) ///< 左侧报表区域 #define DSM_PHASOR_PHASORGRAM_RECT CRect(260, DSM_P_BODY_TOP, 640, DSM_P_BODY_BOTTOM) ///< 相量控件 #define DSM_ELEC_CTRL_DEFT_FT ELT_T1_TEXTLFHEIGHT ///< 相量图内描述字体大小 #else //#define DSM_PHASOR_REPORT_CAPTION 65 ///< 标题列宽度 #define DSM_PHASOR_REPORT_CAPTION 75 ///< 标题列宽度 #define DSM_PHASOR_REPORT_VALUE 169 ///< 内容列宽度 //#define DSM_PHASOR_REPORT_EFFECTIVE 157 ///< 有效值宽度 //#define DSM_PHASOR_REPORT_ANGEL 167 ///< 相角差宽度 #define DSM_PHASOR_REPORT_EFFECTIVE 169 ///< 有效值宽度 #define DSM_PHASOR_REPORT_ANGEL 169 ///< 相角差宽度 #define DSM_PHASOR_MARGIN CRect(0, 0, 0, 0) ///< phasorgram间距 //#define DSM_PHASOR_REPORT_RECT CRect(110, DSM_P_BODY_TOP, 316, DSM_P_BODY_BOTTOM) ///< 左侧报表区域 //#define DSM_PHASOR_PHASORGRAM_RECT CRect(315, DSM_P_BODY_TOP, 640, DSM_P_BODY_BOTTOM) ///< 相量控件 #define DSM_PHASOR_REPORT_RECT CRect(110, DSM_P_BODY_TOP, 356, DSM_P_BODY_BOTTOM) ///< 左侧报表区域 #define DSM_PHASOR_PHASORGRAM_RECT CRect(365, DSM_P_BODY_TOP, 640, DSM_P_BODY_BOTTOM) ///< 相量控件 #define DSM_ELEC_CTRL_DEFT_FT ELT_T1_TEXTLFHEIGHT #endif ////////////////////////////////////////////////////////////////////////// // ABCNX三相颜色 #define DSM_PHASE_COLOR_A RGB(0xFF, 0xFF, 0x00) ///< A相颜色 黄 #define DSM_PHASE_COLOR_B RGB(0x32, 0xFF, 0x00) ///< B相颜色 绿 #define DSM_PHASE_COLOR_C RGB(0xFF, 0x00, 0x84) ///< C相颜色 红 #define DSM_PHASE_COLOR_N RGB(0x55, 0x78, 0xFF) ///< N相颜色 蓝 #define DSM_PHASE_COLOR_X RGB(0xFF, 0xA5, 0x00) ///< X相颜色 #define DSM_PHASE_COLOR_UN RGB(0x00, 0xCC, 0xFF) ///< 未知相颜色 // #define DSM_PHASE_COLOR_A RGB(0xFF, 0x00, 0x00) ///< A相颜色 红 // #define DSM_PHASE_COLOR_B RGB(0xFE, 0xFE, 0x00) ///< B相颜色 黄 // #define DSM_PHASE_COLOR_C RGB(0x00, 0xCC, 0xFF) ///< C相颜色 蓝绿 // #define DSM_PHASE_COLOR_N RGB(0x26, 0xC1, 0x97) ///< N相颜色 // #define DSM_PHASE_COLOR_X RGB(0xCE, 0x9D, 0x1E) ///< X相颜色 // #define DSM_PHASE_COLOR_UN RGB(0x80, 0x80, 0x80) ///< 未知相颜色 // 录波状态区域 #define DSM_SMV_MSGMONITOR_RCRECORD_TIP_ICO CRect(110, 20, 320, 111) #define DSM_SMV_MSGMONITOR_RCRECORD_TIP_TEXT CRect(60, 120, 260, 200) /** * pcap报文帧列表的信息 */ // struct DSM_PCAP_RITEM // { // int index; // int length; // std::wstring time; // std::wstring type; // std::wstring desc; // }; #define DSM_SMV_RECORD_ERR_SD_INJECTED 201 ///< SD拔出 #define DSM_SMV_RECORD_ERR_LINK 202 ///< 线路故障 /** * 加载pcap文件回调函数参数 */ struct _PcapTaskArgs { CWnd* pWnd; ///< 启用线程的窗口 CString csFile; ///< pcap文件名 IPcapFile* pDecode; ///< 解码器 }; #endif //COMMON_SMV_H__
[ "383789599@qq.com" ]
383789599@qq.com
f7b996c187d0acf152cf7b34ac3a5c20af4c4a09
1f0e52daa702a442db609766a56f99f833368a6b
/oj/HDU/2896.cpp
066106883de1ea185428a5a78c65eab9914957e2
[]
no_license
TouwaErioH/Algorithm
e0495b053e6f33353a4e526955cd269d2acc0027
a5851529168a68147ab548678c16251f6dfa017d
refs/heads/master
2022-12-07T03:46:50.674787
2020-08-20T08:45:49
2020-08-20T08:45:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,954
cpp
//============================================================================ // Name : HDU.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> #include <queue> using namespace std; struct Trie { int next[210*500][128],fail[210*500],end[210*500]; int root,L; int newnode() { for(int i = 0;i < 128;i++) next[L][i] = -1; end[L++] = -1; return L-1; } void init() { L = 0; root = newnode(); } void insert(char s[],int id) { int len = strlen(s); int now = root; for(int i = 0;i < len;i++) { if(next[now][s[i]] == -1) next[now][s[i]] = newnode(); now=next[now][s[i]]; } end[now]=id; } void build() { queue<int>Q; fail[root] = root; for(int i = 0;i < 128;i++) if(next[root][i] == -1) next[root][i] = root; else { fail[next[root][i]] = root; Q.push(next[root][i]); } while(!Q.empty()) { int now = Q.front(); Q.pop(); for(int i = 0;i < 128;i++) if(next[now][i] == -1) next[now][i] = next[fail[now]][i]; else { fail[next[now][i]] = next[fail[now]][i]; Q.push(next[now][i]); } } } bool used[510]; bool query(char buf[],int n,int id) { int len = strlen(buf); int now = root; memset(used,false,sizeof(used)); bool flag = false; for(int i = 0;i < len;i++) { now = next[now][buf[i]]; int temp = now; while(temp != root) { if(end[temp] != -1) { used[end[temp]] = true; flag = true; } temp = fail[temp]; } } if(!flag)return false; printf("web %d:",id); for(int i = 1;i <= n;i++) if(used[i]) printf(" %d",i); printf("\n"); return true; } }; char buf[10010]; Trie ac; int main() { int n,m; while(scanf("%d",&n) != EOF) { ac.init(); for(int i = 1;i <= n;i++) { scanf("%s",buf); ac.insert(buf,i); } ac.build(); int ans = 0; scanf("%d",&m); for(int i = 1;i <= m;i++) { scanf("%s",buf); if(ac.query(buf,n,i)) ans++; } printf("total: %d\n",ans); } return 0; }
[ "37233819+TouwaErioH@users.noreply.github.com" ]
37233819+TouwaErioH@users.noreply.github.com
1632c23ae090cc710d4aecc2c0471942375a38bd
c47e002922aa40e72f01c035ff23d72c6c07b437
/leetcode2/productwithoutitself.cpp
4e07a8aee549971936828fae8e6856894d93c1c9
[ "Apache-2.0" ]
permissive
WIZARD-CXY/pl
4a8b08900aa1f76adab62696fcfe3560df7d49a9
db212e5bdacb22b8ab51cb2e9089bf60c2b4bfca
refs/heads/master
2023-06-10T00:05:37.576769
2023-05-27T03:32:48
2023-05-27T03:32:48
27,328,872
2
0
null
null
null
null
UTF-8
C++
false
false
521
cpp
class Solution { public: vector<int> productExceptSelf(vector<int>& nums) { int n=nums.size(); //res[i] first records the product from nums[0] to nums[i-1] , not including it vector<int> res(n,1); for(int i=1; i<n; i++){ res[i]=res[i-1]*nums[i-1]; } int right=1;// right product from tail to head for(int i=n-1; i>=0; i--){ res[i]*=right; right*=nums[i]; } return res; } };
[ "wizard_cxy@hotmail.com" ]
wizard_cxy@hotmail.com
2e1e480a7d34c58dbdb5896c1c88292c1b430778
9c5a7750e380f9e882c8e2c0a379a7d2a933beae
/LDS/PartDesign.cpp
9769fffd9c5c6f27ce7886c9afab9db02bbbdadb
[]
no_license
presscad/LDS
973e8752affd1147982a7dd48350db5c318ed1f3
e443ded9cb2fe679734dc17af8638adcf50465d4
refs/heads/master
2021-02-15T20:30:26.467280
2020-02-28T06:13:53
2020-02-28T06:13:53
null
0
0
null
null
null
null
GB18030
C++
false
false
359,346
cpp
//<LOCALE_TRANSLATE BY wbt /> #include "stdafx.h" #include "LDS.h" #include "LDSDoc.h" #include "LDSView.h" #include "Tower.h" #include "lds_part.h" #include "lds_co_part.h" #include "DesignJdb.h" #include "env_def.h" #include "GlobalFunc.h" #include "PromptDlg.h" #include "Query.h" #include "dlg.h" #include "LmaDlg.h" #include "JdbDlg.h" #include "DesignJoint.h" #include "ScrTools.h" #include "PlateBasicParaDlg.h" #include "LayAngleBoltDlg.h" #include "LayTubeBoltDlg.h" #include "LayFillPlankDlg.h" #include "InputAnValDlg.h" #include "DesignLjParaDlg.h" #include "DianBanParaDlg.h" #include "DesignFootNailPlateDlg.h" #include "f_ent.h" #include "CmdLineDlg.h" #include "MainFrm.h" #include "MirTaAtom.h" #include "DesignOneBoltDlg.h" #include "SnapTypeVerify.h" #include "KeypointLifeObj.h" #include "SnapTypeVerify.h" #include "AngleBoltsDlg.h" #include "env_def.h" #include "UI.h" #include "SelNailSeriesDlg.h" #include "DesPedalPlateDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #if defined(__TSA_)||defined(__TSA_FILE_) void CLDSView::OnShareJdbDesign(){;} void CLDSView::OnCommonJgJoint(){;} void CLDSView::OnLayoutFootnail(){;} void CLDSView::OnFootPlank(){;} void CLDSView::OnDesHoofPlank(){;} void CLDSView::OnCutJg(){;} void CLDSView::OnDesignJdb(){;} void CLDSView::OnFoldPlank(){;} void CLDSView::OnLayJgEndLs(){;} void CLDSView::OnOneBoltDesign(){;} void CLDSView::OnSpecNodeOneBoltDesign(){;} void CLDSView::OnSingleXieNodeDesign(){;} void CLDSView::OnXieIntersPtDesign(){;} void CLDSView::OnAllSingleXieNodeDesign(){;} #else //计算共享板射线角钢与基准角钢的交汇点(准线交汇点) //ucs为当前共享板的相对坐标系 static f3dPoint CalSharePlankRayZhun(CLDSLineAngle *pBaseJg[2], CLDSNode *pBaseNode[2], CLDSLineAngle *pRayJg, f3dPoint work_norm) { f3dPoint zhun,wing_vec1,wing_vec2; f3dLine line1,line2; JGZJ jgzj1,jgzj2; getjgzj(jgzj1,pBaseJg[0]->GetWidth()); getjgzj(jgzj2,pBaseJg[1]->GetWidth()); int x_wing0_y_wing1; IsInsideJg(pBaseJg[0],work_norm,&x_wing0_y_wing1); if(pBaseJg[0]->m_bEnableTeG) { if(x_wing0_y_wing1==0) jgzj1 = pBaseJg[0]->xWingXZhunJu; else jgzj1 = pBaseJg[0]->xWingYZhunJu; } IsInsideJg(pBaseJg[1],work_norm,&x_wing0_y_wing1); if(pBaseJg[1]->m_bEnableTeG) { if(x_wing0_y_wing1==0) jgzj2 = pBaseJg[1]->xWingXZhunJu; else jgzj2 = pBaseJg[1]->xWingYZhunJu; } if(pBaseNode[0]==pBaseNode[1]) //两基准角钢同一基准节点 { if(fabs(pBaseJg[0]->get_norm_x_wing()*work_norm) > fabs(pBaseJg[0]->get_norm_y_wing()*work_norm)) wing_vec1=pBaseJg[0]->GetWingVecX(); else wing_vec1=pBaseJg[0]->GetWingVecY(); if(fabs(pBaseJg[1]->get_norm_x_wing()*work_norm) > fabs(pBaseJg[1]->get_norm_y_wing()*work_norm)) wing_vec2=pBaseJg[1]->GetWingVecX(); else wing_vec2=pBaseJg[1]->GetWingVecY(); line1.startPt=pBaseJg[0]->Start()+wing_vec1*jgzj1.g; line1.endPt=pBaseJg[0]->End()+wing_vec1*jgzj1.g; line2.startPt=pBaseJg[1]->Start()+wing_vec2*jgzj2.g; line2.endPt=pBaseJg[1]->End()+wing_vec2*jgzj2.g; UCS_STRU ucs; ucs.axis_z = work_norm; ucs.axis_x = line1.endPt-line1.startPt; ucs.axis_y = ucs.axis_z^ucs.axis_x; ucs.axis_x = ucs.axis_y^ucs.axis_z; if(pBaseJg[0]->pStart==pBaseNode[0]) ucs.origin = line1.startPt; else ucs.origin = line1.endPt; coord_trans(line1.startPt,ucs,FALSE); coord_trans(line1.endPt,ucs,FALSE); coord_trans(line2.startPt,ucs,FALSE); coord_trans(line2.endPt,ucs,FALSE); line1.startPt.z = line1.endPt.z = line2.startPt.z = line2.endPt.z = 0; Int3dpl(line1,line2,zhun); coord_trans(zhun,ucs,TRUE); } else if(pRayJg) //两基准角钢各有自己的基准节点 { if(pRayJg->pStart==pBaseNode[0]||pRayJg->pEnd==pBaseNode[0]) { if(fabs(dot_prod(pBaseJg[0]->get_norm_x_wing(),work_norm)) > fabs(dot_prod(pBaseJg[0]->get_norm_y_wing(),work_norm))) wing_vec1=pBaseJg[0]->GetWingVecX(); else wing_vec1=pBaseJg[0]->GetWingVecY(); if(pBaseJg[0]->pStart==pBaseNode[0]) zhun=pBaseJg[0]->Start()+wing_vec1*jgzj1.g; else zhun=pBaseJg[0]->End()+wing_vec1*jgzj1.g; } else //(pRayJg->pStart==pBaseNode[1]||pRayJg->pEnd==pBaseNode[1]) { if(fabs(dot_prod(pBaseJg[1]->get_norm_x_wing(),work_norm)) > fabs(dot_prod(pBaseJg[1]->get_norm_y_wing(),work_norm))) wing_vec2=pBaseJg[1]->GetWingVecX(); else wing_vec2=pBaseJg[1]->GetWingVecY(); if(pBaseJg[1]->pStart==pBaseNode[1]) zhun=pBaseJg[1]->Start()+wing_vec2*jgzj2.g; else zhun=pBaseJg[1]->End()+wing_vec2*jgzj2.g; } } else { if(fabs(dot_prod(pBaseJg[0]->get_norm_x_wing(),work_norm)) > fabs(dot_prod(pBaseJg[0]->get_norm_y_wing(),work_norm))) wing_vec1=pBaseJg[0]->GetWingVecX(); else wing_vec1=pBaseJg[0]->GetWingVecY(); if(pBaseJg[0]->pStart==pBaseNode[0]) Sub_Pnt(zhun,pBaseJg[0]->Start(),wing_vec1*jgzj1.g); else Sub_Pnt(zhun,pBaseJg[0]->End(),wing_vec1*jgzj1.g); } return zhun; } #ifdef ajkdlfdaadfadfadfa //暂不使用 void CLDSView::OnShareJdbDesign() { m_nPrevCommandID=ID_SHARE_JDB_DESIGN; m_sPrevCommandName="重复共用板"; CLDSPlate *pCurPlate=NULL; CLDSNode *pBaseNode[2]={NULL}; CLDSLineAngle *pRayJg=NULL,*pBaseJg[2]={NULL}; CDesignLjPartPara *pRayJgPara=NULL,*pLjJgParaArr[2]={NULL}; int i; double quitdist[2]={0.0}; double base_wing_wide[2],base_wing_thick[2],ray_wing_wide,ray_wing_thick; LSSPACE_STRU basespace[2],rayspace; f3dPoint vec; //-----vvvvvvv-标识函数运行状态为真,即同一时刻只能有一个塔创建函数运行--------- if(!LockFunc()) return; UINT nRetCode=1; //现已不需要检测加密锁状态了 wjh-2017.9.18 Ta.BeginUndoListen(); try { #ifdef DOG_CHECK if(nRetCode!=1) throw "检测加密狗出错,程序出错!"; #endif pCurPlate = (CLDSPlate*)console.AppendPart(CLS_PLATE); pCurPlate->face_N = 1; pCurPlate->jdb_style = 6; //共用板 f3dLine line3d; f3dPoint *point3d=NULL; //切换到单线显示模式 g_pSolidSet->SetDisplayType(DISP_LINE); Invalidate(FALSE); for(i=0;i<2;i++) { if(i==0) g_pPromptMsg->SetMsg("请选择共用板的第一根基准角钢"); else g_pPromptMsg->SetMsg("请选择共用板的第二根基准角钢"); while(pBaseJg[i]==NULL) { if(g_pSolidSnap->SnapLine(line3d)>0) { pBaseJg[i] = (CLDSLineAngle*)console.FromPartHandle(line3d.ID,CLS_LINEANGLE); pLjJgParaArr[i]=pCurPlate->designInfo.partList.append(); pLjJgParaArr[i]->m_bAdjustLjEndPos=FALSE; //共用板两根基准杆件对称时都不需要调整摆放位置 wht 10-02-26 pLjJgParaArr[i]->hPart=pBaseJg[i]->handle; } } g_pSolidDraw->SetEntSnapStatus(line3d.ID); if(i==1)//高亮显示半秒钟,不然用户不知道是否选中了此构件显示状态就被冲掉了 Sleep(500); } for(i=0;i<2;i++) { if(i==0) g_pPromptMsg->SetMsg("请选择共用板的第一个基准节点(应为第一根基准角钢的端节点"); else g_pPromptMsg->SetMsg("请选择共用板的第二个基准节点(应为第二根基准角钢的端节点"); //高亮显示当前的基准角钢 g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->SetEntSnapStatus(pBaseJg[i]->handle); while(pBaseNode[i]==NULL) { if(g_pSolidSnap->SnapPoint (point3d,TRUE)>0) { pBaseNode[i] = console.FromNodeHandle(point3d->ID); if(i==0) //第一个基准节点为连接板基准节点 { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pBaseNode[0]->dwPermission)) throw "没有此节点的修改权限!"; pCurPlate->designInfo.m_hBaseNode = point3d->ID; } } else //中止设计 throw "中途退出,设计失败!"; } g_pSolidDraw->SetEntSnapStatus(point3d->ID); CSharePlankDesignDlg dlg; if( pBaseNode[i]==pBaseJg[i]->pStart) { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pBaseJg[i]->dwStartPermission)) throw "没有此角钢始端的修改权限!"; pBaseJg[i]->feature = 10; //始端连接 } else if(pBaseNode[i]==pBaseJg[i]->pEnd) { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pBaseJg[i]->dwEndPermission)) throw "没有此角钢终端的修改权限!"; pBaseJg[i]->feature = 11; //终端连接 } else throw "所选基准角钢与基准节点不一致,操作无效"; if(i==0) g_pPromptMsg->SetMsg("请输入第一根角钢的上连接板边缘的后撤量"); else g_pPromptMsg->SetMsg("请输入第二根角钢的上连接板边缘的后撤量"); if(pBaseJg[i]->feature==10) { dlg.m_sLsGuiGe.Format("%d",pBaseJg[i]->connectStart.d); GetLsSpace(basespace[i],pBaseJg[i]->connectStart.d); dlg.m_nLsN = pBaseJg[i]->connectStart.wnConnBoltN; dlg.m_nLsSpace = basespace[i].SingleRowSpace; //插空布置螺栓 dlg.m_fOddment = basespace[i].EndSpace+basespace[i].SingleRowSpace/2;//端距 pLjJgParaArr[i]->end_space=basespace[i].EndSpace; pLjJgParaArr[i]->start0_end1=0; } else { dlg.m_sLsGuiGe.Format("%d",pBaseJg[i]->connectEnd.d); dlg.m_nLsN = pBaseJg[i]->connectEnd.wnConnBoltN; GetLsSpace(basespace[i],pBaseJg[i]->connectEnd.d); dlg.m_nLsSpace = basespace[i].SingleRowSpace; //插空布置螺栓 dlg.m_fOddment = basespace[i].EndSpace+basespace[i].SingleRowSpace/2;//端距 pLjJgParaArr[i]->end_space=basespace[i].EndSpace; pLjJgParaArr[i]->start0_end1=1; } if(dlg.DoModal()!=IDOK) throw "设计撤消"; if(pBaseJg[i]->feature==10) { sscanf(dlg.m_sLsGuiGe,"%d",&pBaseJg[i]->connectStart.d); pBaseJg[i]->connectStart.wnConnBoltN = dlg.m_nLsN; } else { sscanf(dlg.m_sLsGuiGe,"%d",&pBaseJg[i]->connectEnd.d); pBaseJg[i]->connectEnd.wnConnBoltN = dlg.m_nLsN; } basespace[i].SingleRowSpace = dlg.m_nLsSpace; quitdist[i]=dlg.m_fOddment-basespace[i].EndSpace; //后撤量 g_pSolidDraw->ReleaseSnapStatus(); //清除基准角钢的高亮显示状态 } //-------共用板相对坐标系的建立------------ f3dPoint vec1,pt1,pt2; //更正两基准角钢严格平行时的法线计算错误 WJH-2004/07/01 if(pBaseJg[0]->feature==10) vec1 = pBaseJg[0]->GetDatumPosBer(pBaseJg[0]->pEnd)-pBaseJg[0]->GetDatumPosBer(pBaseJg[0]->pStart); else vec1 = pBaseJg[0]->GetDatumPosBer(pBaseJg[0]->pStart)-pBaseJg[0]->GetDatumPosBer(pBaseJg[0]->pEnd); normalize(vec1); /*f3dPoint vec2; if(pBaseJg[1]->feature==10) vec2 = pBaseJg[1]->GetDatumPosBer(pBaseJg[1]->pEnd)-pBaseJg[1]->GetDatumPosBer(pBaseJg[1]->pStart); else vec2 = pBaseJg[1]->GetDatumPosBer(pBaseJg[1]->pStart)-pBaseJg[1]->GetDatumPosBer(pBaseJg[1]->pEnd); normalize(vec2);*/ //这样造成的误差可能较大,因为任意面的法线计算 //可能与板的法线计算算法不同两都如果严重不一致时, //就会造成较大的误差 //if(m_eViewFlag==RANDOM_VIEW) //pCurPlate->ucs.axis_z = g_ucs.axis_z; //else { //更正两基准角钢严格平行时的法线计算错误 WJH-2004/07/01 pCurPlate->ucs.axis_z = CalFaceNorm(pBaseJg[0]->Start(),pBaseJg[0]->End(),pBaseJg[1]->Start(),pBaseJg[1]->End());//cross_prod(vec1,vec2); normalize(pCurPlate->ucs.axis_z); if(dot_prod(console.GetActiveView()->ucs.axis_z,pCurPlate->ucs.axis_z)<0) pCurPlate->ucs.axis_z = -1.0*pCurPlate->ucs.axis_z; } pCurPlate->cfgword=pBaseNode[0]->cfgword; //调整钢板配材号与基准构件或基准节点配材号一致 pCurPlate->ucs.origin = CalSharePlankRayZhun(pBaseJg,pBaseNode,NULL,pCurPlate->ucs.axis_z); pCurPlate->designInfo.iProfileStyle0123=1; pCurPlate->designInfo.m_hBasePart=pBaseJg[0]->handle; pCurPlate->designInfo.m_hBaseNode=pBaseNode[0]->handle; pCurPlate->designInfo.iFaceType=1; pCurPlate->designInfo.origin.datum_pos_style=3; pCurPlate->designInfo.origin.des_para.AXIS_INTERS.hDatum1=pBaseJg[0]->handle; pCurPlate->designInfo.origin.des_para.AXIS_INTERS.hDatum2=pBaseJg[1]->handle; pCurPlate->designInfo.norm.norm_style=2; //两角钢交叉线法线 pCurPlate->designInfo.norm.hVicePart=pBaseJg[0]->handle; pCurPlate->designInfo.norm.hCrossPart=pBaseJg[1]->handle; pCurPlate->designInfo.norm.nearVector=console.GetActiveView()->ucs.axis_z;//近似法线 //-------共用板相对坐标系的建立------------ g_pPromptMsg->SetMsg("如果有射线角钢共用此连接板,请选择,若无则空点一下鼠标"); int iBoltLayoutStyle=0; //双排布置螺栓时 螺栓布置形式 0.靠楞线侧优先 1.远离楞线侧优先 JGZJ ray_jg_zj; if(g_pSolidSnap->SnapLine(line3d)>0) { CJdbJgJointDlg ray_jg_dlg; pRayJg = (CLDSLineAngle*)console.FromPartHandle(line3d.ID,CLS_LINEANGLE); if(pRayJg==NULL) throw "选择了错误的塔构件,设计失败!"; pRayJgPara=pCurPlate->designInfo.partList.append(); pRayJgPara->hPart=pRayJg->handle; ray_jg_dlg.m_sRayJgGuiGe.Format("%.0fX%.0f",pRayJg->GetWidth(),pRayJg->GetThick()); int x_wing0_y_wing1; IsInsideJg(pRayJg,pCurPlate->ucs.axis_z,&x_wing0_y_wing1); pRayJgPara->angle.cur_wing_x0_y1=(short)x_wing0_y_wing1; if(pRayJg->m_bEnableTeG) { if(x_wing0_y_wing1==0) ray_jg_dlg.jgzj = pRayJg->xWingXZhunJu; else ray_jg_dlg.jgzj = pRayJg->xWingYZhunJu; } else getjgzj(ray_jg_dlg.jgzj,pRayJg->GetWidth()); g_pSolidDraw->SetEntSnapStatus(pRayJg->handle); pCurPlate->ucs.origin = CalSharePlankRayZhun(pBaseJg,pBaseNode,pRayJg,pCurPlate->ucs.axis_z); if(pRayJg->pStart==pBaseNode[0]||pRayJg->pStart==pBaseNode[1]) { pRayJg->feature = 10; //始端连接 GetLsSpace(rayspace,pRayJg->connectStart.d); pRayJgPara->start0_end1=0; pRayJgPara->end_space=rayspace.EndSpace; ray_jg_dlg.m_nLsN = 2; ray_jg_dlg.m_nLsSpace = rayspace.SingleRowSpace; ray_jg_dlg.m_sLsGuiGe.Format("%d",pRayJg->connectStart.d); if(fabs(pBaseJg[0]->get_norm_x_wing()*pCurPlate->ucs.axis_z)> fabs(pBaseJg[0]->get_norm_y_wing()*pCurPlate->ucs.axis_z)&&pRayJg->pStart==pBaseNode[0]) { while(IsPartsCollide(pBaseJg[0],pRayJg)) { pRayJg->SetStartOdd(pRayJg->startOdd()-5); if(fabs(pRayJg->startOdd())>500) break; } } else if(pRayJg->pStart==pBaseNode[0]) { while(IsPartsCollide(pBaseJg[0],pRayJg)) { pRayJg->SetStartOdd(pRayJg->startOdd()-5); if(fabs(pRayJg->startOdd())>500) break; } } if(fabs(pBaseJg[1]->get_norm_x_wing()*pCurPlate->ucs.axis_z)> fabs(pBaseJg[1]->get_norm_y_wing()*pCurPlate->ucs.axis_z) &&pRayJg->pStart==pBaseNode[1]) { while(IsPartsCollide(pBaseJg[1],pRayJg)) { pRayJg->SetStartOdd(pRayJg->startOdd()-5); if(fabs(pRayJg->startOdd())>500) break; } } else if(pRayJg->pStart==pBaseNode[1]) { while(IsPartsCollide(pBaseJg[1],pRayJg)) { pRayJg->SetStartOdd(pRayJg->startOdd()-5); if(fabs(pRayJg->startOdd())>500) break; } } ray_jg_dlg.m_fOddment = pRayJg->startOdd(); ray_jg_dlg.m_nLsN = pRayJg->connectStart.wnConnBoltN; if(ray_jg_dlg.DoModal()!=IDOK) throw "设计撤消"; if(ray_jg_dlg.m_fOddment!=pRayJg->startOdd()) pRayJg->desStartOdd.m_iOddCalStyle=2; sscanf(ray_jg_dlg.m_sLsGuiGe,"%d",&pRayJg->connectStart.d); rayspace = ray_jg_dlg.LsSpace; if(ray_jg_dlg.m_nLsRowsN==0) pRayJg->connectEnd.rows=1; //单排螺栓 else pRayJg->connectEnd.rows=2; //双排螺栓 //双排螺栓布置形式 iBoltLayoutStyle=ray_jg_dlg.m_iLsLayOutStyle; ray_jg_zj=ray_jg_dlg.jgzj; //角钢准距 pRayJg->connectStart.wnConnBoltN = ray_jg_dlg.m_nLsN; pRayJg->SetStartOdd(ray_jg_dlg.m_fOddment); } else if(pRayJg->pEnd==pBaseNode[0]||pRayJg->pEnd==pBaseNode[1]) { pRayJg->feature = 11; //终端连接 GetLsSpace(rayspace,pRayJg->connectEnd.d); pRayJgPara->start0_end1=1; pRayJgPara->end_space=rayspace.EndSpace; ray_jg_dlg.m_nLsN = 2; ray_jg_dlg.m_nLsSpace = rayspace.SingleRowSpace; ray_jg_dlg.m_sLsGuiGe.Format("%d",pRayJg->connectEnd.d); if(fabs(pBaseJg[0]->get_norm_x_wing()*pCurPlate->ucs.axis_z)> fabs(pBaseJg[0]->get_norm_y_wing()*pCurPlate->ucs.axis_z)) { if(pRayJg->pEnd==pBaseNode[0]) { while(IsPartsCollide(pBaseJg[0],pRayJg)) { pRayJg->SetEndOdd(pRayJg->endOdd()-5); if(fabs(pRayJg->endOdd())>500) break; } } else if(pRayJg->pEnd==pBaseNode[0]) { while(IsPartsCollide(pBaseJg[0],pRayJg)) { pRayJg->SetEndOdd(pRayJg->endOdd()-5); if(fabs(pRayJg->endOdd())>500) break; } } } else { if(pRayJg->pEnd==pBaseNode[0]) { while(IsPartsCollide(pBaseJg[0],pRayJg)) { pRayJg->SetEndOdd(pRayJg->endOdd()-5); if(fabs(pRayJg->endOdd())>500) break; } } else if(pRayJg->pEnd==pBaseNode[0]) { while(IsPartsCollide(pBaseJg[0],pRayJg)) { pRayJg->SetEndOdd(pRayJg->endOdd()-5); if(fabs(pRayJg->endOdd())>500) break; } } } if(fabs(pBaseJg[1]->get_norm_x_wing()*pCurPlate->ucs.axis_z)> fabs(pBaseJg[1]->get_norm_y_wing()*pCurPlate->ucs.axis_z)) { if(pRayJg->pEnd==pBaseNode[1]) { while(IsPartsCollide(pBaseJg[1],pRayJg)) { pRayJg->SetEndOdd(pRayJg->endOdd()-5); if(fabs(pRayJg->endOdd())>500) break; } } else if(pRayJg->pEnd!=pBaseNode[1]) { while(IsPartsCollide(pBaseJg[1],pRayJg)) { pRayJg->SetEndOdd(pRayJg->endOdd()-5); if(fabs(pRayJg->endOdd())>500) break; } } } else { if(pRayJg->pEnd==pBaseNode[1]) { while(IsPartsCollide(pBaseJg[1],pRayJg)) { pRayJg->SetEndOdd(pRayJg->endOdd()-5); if(fabs(pRayJg->endOdd())>500) break; } } else if(pRayJg->pEnd!=pBaseNode[1]) { while(IsPartsCollide(pBaseJg[1],pRayJg)) { pRayJg->SetEndOdd(pRayJg->endOdd()-5); if(fabs(pRayJg->endOdd())>500) break; } } } ray_jg_dlg.m_fOddment = pRayJg->endOdd(); ray_jg_dlg.m_nLsN = pRayJg->connectEnd.wnConnBoltN; if(ray_jg_dlg.DoModal()!=IDOK) throw "设计撤消"; if(ray_jg_dlg.m_fOddment!=pRayJg->endOdd()) pRayJg->desEndOdd.m_iOddCalStyle=2; sscanf(ray_jg_dlg.m_sLsGuiGe,"%d",&pRayJg->connectEnd.d); rayspace = ray_jg_dlg.LsSpace; if(ray_jg_dlg.m_nLsRowsN==0) pRayJg->connectEnd.rows=1; //单排螺栓 else pRayJg->connectEnd.rows=2; //双排螺栓 //双排螺栓布置形式 iBoltLayoutStyle=ray_jg_dlg.m_iLsLayOutStyle; ray_jg_zj=ray_jg_dlg.jgzj; //角钢准距 pRayJg->connectEnd.wnConnBoltN = ray_jg_dlg.m_nLsN; pRayJg->SetEndOdd(ray_jg_dlg.m_fOddment); } else throw "所选共用射线角钢与基准节点不一致,操作无效"; } static CPlateBasicParaDlg share_dlg; share_dlg.m_bEnableWeld=FALSE; //无焊接边 if(share_dlg.DoModal()!=IDOK) throw "中途退出,设计失败!"; else { pCurPlate->designInfo.iProfileStyle0123=share_dlg.m_iProfileType+1; pCurPlate->Thick=share_dlg.m_nPlankThick; pCurPlate->cMaterial=steelmat_tbl[share_dlg.m_iMaterial].cBriefMark; sprintf(pCurPlate->sPartNo,"%s",share_dlg.m_sPartNo); pCurPlate->iSeg=SEGI(share_dlg.m_sSegI.GetBuffer()); } CLDSBolt *pBolt=NULL; for(i=0;i<2;i++) { f3dPoint vec,direct,norm; pLjJgParaArr[i]->iFaceNo=1; pLjJgParaArr[i]->angle.bTwoEdge=TRUE; //double offset = basespace[i].EndSpace; if(fabs(dot_prod(pBaseJg[i]->get_norm_x_wing(),pCurPlate->ucs.axis_z))>0.7071) { norm = pBaseJg[i]->get_norm_x_wing(); direct= -pBaseJg[i]->GetWingVecX(); pLjJgParaArr[i]->angle.cur_wing_x0_y1=0; //X肢为当前连接肢 } else { norm = pBaseJg[i]->get_norm_y_wing(); direct = -pBaseJg[i]->GetWingVecY(); pLjJgParaArr[i]->angle.cur_wing_x0_y1=1; //Y肢为当前连接肢 } JGZJ jgzj; int x_wing0_y_wing1; getjgzj(jgzj,pBaseJg[i]->GetWidth()); IsInsideJg(pBaseJg[i],pCurPlate->ucs.axis_z,&x_wing0_y_wing1); if(pBaseJg[i]->m_bEnableTeG) { if(x_wing0_y_wing1==0) jgzj = pBaseJg[i]->xWingXZhunJu; else jgzj = pBaseJg[i]->xWingYZhunJu; } base_wing_wide[i] = pBaseJg[i]->GetWidth(); base_wing_thick[i]= pBaseJg[i]->GetThick(); if(pBaseJg[i]->feature==10) { pLjJgParaArr[i]->wing_space=base_wing_wide[i]-jgzj.g; pLjJgParaArr[i]->ber_space=jgzj.g; Sub_Pnt(vec,pBaseJg[i]->End(),pBaseJg[i]->Start()); normalize(vec); //offset = quitdist[i]+basespace[i].EndSpace; for(int j=0;j<pBaseJg[i]->connectStart.wnConnBoltN;j++) { pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->iSeg=pCurPlate->iSeg; pBolt->set_d(pBaseJg[i]->connectStart.d); pBolt->cfgword=pBaseJg[i]->cfgword; //调整螺栓配材号与基准构件配材号一致 pBolt->AddL0Thick(pBaseJg[i]->handle,TRUE); pBolt->AddL0Thick(pCurPlate->handle,TRUE); pBolt->CalGuigeAuto(); pBolt->set_norm(pCurPlate->ucs.axis_z); pBolt->des_base_pos.datumPoint.datum_pos_style=1; //角钢楞点定位 pBolt->des_base_pos.datumPoint.des_para.RODEND.bIncOddEffect=TRUE; pBolt->des_base_pos.datumPoint.des_para.RODEND.wing_offset_style=4; pBolt->des_base_pos.datumPoint.des_para.RODEND.wing_offset_dist=0; pBolt->des_base_pos.hPart=pBolt->des_base_pos.datumPoint.des_para.RODEND.hRod=pBaseJg[i]->handle; pBolt->des_base_pos.wing_offset_dist=jgzj.g; sprintf(pBolt->des_base_pos.norm_offset.key_str,"-0X%X",pBaseJg[i]->handle); pBolt->des_work_norm.norm_style=1; if(fabs(pCurPlate->ucs.axis_z*pBaseJg[i]->get_norm_x_wing())>fabs(pCurPlate->ucs.axis_z*pBaseJg[i]->get_norm_y_wing())) { //X肢上的螺栓 //沿X肢进行螺栓位置偏移 pBolt->des_base_pos.datumPoint.des_para.RODEND.offset_wing=pBolt->des_base_pos.offset_wing=0; pBolt->des_work_norm.hVicePart=pBaseJg[i]->handle; pBolt->des_work_norm.direction=0; //朝外 pBolt->des_work_norm.norm_wing=0; } else { //Y肢上的螺栓 pBolt->des_work_norm.hVicePart=pBaseJg[i]->handle; pBolt->des_base_pos.datumPoint.des_para.RODEND.offset_wing=pBolt->des_base_pos.offset_wing=1; //沿Y肢进行螺栓位置偏移 pBolt->des_work_norm.direction=0; //朝外 pBolt->des_work_norm.norm_wing=1; } pBolt->des_base_pos.datumPoint.des_para.RODEND.direction=pBolt->des_base_pos.direction=0;//始-->终 pBolt->des_base_pos.len_offset_dist=quitdist[i]+basespace[i].EndSpace+j*basespace[i].SingleRowSpace; pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); CLsRef *pLsRef=pCurPlate->AppendLsRef(pBolt->GetLsRef(),FALSE); pLsRef->dwRayNo=GetSingleWord(i*2); pBaseJg[i]->AppendStartLsRef(pBolt->GetLsRef(),FALSE); } //offset = offset-basespace[i].SingleRowSpace+basespace[i].EndSpace; /* if(dot_prod(norm,pCurPlate->ucs.axis_z)<0) { pBaseJg[i]->SetStart(pBaseJg[i]->Start()+ pCurPlate->GetThick()*pCurPlate->ucs.axis_z); }*/ } else { pLjJgParaArr[i]->wing_space=base_wing_wide[i]-jgzj.g; pLjJgParaArr[i]->ber_space=jgzj.g; Sub_Pnt(vec,pBaseJg[i]->Start(),pBaseJg[i]->End()); normalize(vec); //offset = quitdist[i]+basespace[i].EndSpace; for(int j=0;j<pBaseJg[i]->connectEnd.wnConnBoltN;j++) { pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->iSeg=pCurPlate->iSeg; pBolt->set_d(pBaseJg[i]->connectEnd.d); pBolt->cfgword=pBaseJg[i]->cfgword; //调整螺栓配材号与基准构件配材号一致 pBolt->AddL0Thick(pBaseJg[i]->handle,TRUE); pBolt->AddL0Thick(pCurPlate->handle,TRUE); pBolt->CalGuigeAuto(); pBolt->set_norm(pCurPlate->ucs.axis_z); pBolt->des_base_pos.datumPoint.datum_pos_style=1; //角钢楞点定位 pBolt->des_base_pos.datumPoint.des_para.RODEND.bIncOddEffect=TRUE; pBolt->des_base_pos.datumPoint.des_para.RODEND.wing_offset_style=4; pBolt->des_base_pos.datumPoint.des_para.RODEND.wing_offset_dist=0; pBolt->des_base_pos.hPart=pBolt->des_base_pos.datumPoint.des_para.RODEND.hRod=pBaseJg[i]->handle; pBolt->des_base_pos.wing_offset_dist=jgzj.g; sprintf(pBolt->des_base_pos.norm_offset.key_str,"-0X%X",pBaseJg[i]->handle); pBolt->des_work_norm.norm_style=1; if(fabs(pCurPlate->ucs.axis_z*pBaseJg[i]->get_norm_x_wing())>fabs(pCurPlate->ucs.axis_z*pBaseJg[i]->get_norm_y_wing())) { //X肢上的螺栓 //沿X肢进行螺栓位置偏移 pBolt->des_base_pos.datumPoint.des_para.RODEND.offset_wing=pBolt->des_base_pos.offset_wing=0; pBolt->des_work_norm.hVicePart=pBaseJg[i]->handle; pBolt->des_work_norm.direction=0; //朝外 pBolt->des_work_norm.norm_wing=0; } else { //Y肢上的螺栓 pBolt->des_work_norm.hVicePart=pBaseJg[i]->handle; pBolt->des_base_pos.datumPoint.des_para.RODEND.offset_wing=pBolt->des_base_pos.offset_wing=1; //沿Y肢进行螺栓位置偏移 pBolt->des_work_norm.direction=0; //朝外 pBolt->des_work_norm.norm_wing=1; } pBolt->des_base_pos.datumPoint.des_para.RODEND.direction=pBolt->des_base_pos.direction=1;//终-->始 pBolt->des_base_pos.len_offset_dist=quitdist[i]+basespace[i].EndSpace+j*basespace[i].SingleRowSpace; pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); CLsRef *pLsRef=pCurPlate->AppendLsRef(pBolt->GetLsRef(),FALSE); pLsRef->dwRayNo=GetSingleWord(i*2); pBaseJg[i]->AppendEndLsRef(pBolt->GetLsRef(),FALSE); } /* if(dot_prod(norm,pCurPlate->ucs.axis_z)<0) { pBaseJg[i]->SetEnd(pBaseJg[i]->End()+ pCurPlate->GetThick()*pCurPlate->ucs.axis_z); }*/ } pBaseJg[i]->ClearFlag(); pBaseJg[i]->CalPosition(); pBaseJg[i]->SetModified(); pBaseJg[i]->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBaseJg[i]->GetSolidPartObject()); } if(pRayJg!=NULL) { JGZJ jgzj; int x_wing0_y_wing1; pRayJgPara->angle.bTwoEdge=FALSE; pRayJgPara->iFaceNo=1; BOOL bInsideJg=IsInsideJg(pRayJg,pCurPlate->ucs.axis_z,&x_wing0_y_wing1); pRayJgPara->angle.cur_wing_x0_y1=x_wing0_y_wing1; ray_wing_wide = pRayJg->GetWidth(); ray_wing_thick = pRayJg->GetThick(); getjgzj(jgzj,pRayJg->GetWidth()); if(pRayJg->m_bEnableTeG) { if(x_wing0_y_wing1==0) jgzj = pRayJg->xWingXZhunJu; else jgzj = pRayJg->xWingYZhunJu; } pRayJgPara->ber_space=jgzj.g; pRayJgPara->wing_space=ray_wing_wide-jgzj.g; if(pRayJg->feature==10) //始端连接 { pRayJgPara->start0_end1=0; //pRayJg->desStartPos.datum_pos_style=15; //直接指定基点坐标 pRayJg->desStartPos.SetToDatumPointStyle(); //基点定位方式 pRayJg->desStartPos.datumPoint.datum_pos_style=3; //角钢心线交点 pRayJg->desStartPos.datumPoint.des_para.AXIS_INTERS.hDatum1=pBaseJg[0]->handle; pRayJg->desStartPos.datumPoint.des_para.AXIS_INTERS.hDatum2=pBaseJg[1]->handle; pRayJg->desStartPos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=0; pRayJg->desStartPos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2=0; if(x_wing0_y_wing1==0) { pRayJg->desStartPos.wing_x_offset.gStyle=4; if(bInsideJg) pRayJg->desStartPos.wing_x_offset.offsetDist=0; else pRayJg->desStartPos.wing_x_offset.offsetDist=-pCurPlate->GetThick(); pRayJg->desStartPos.wing_y_offset.gStyle=0; } else { pRayJg->desStartPos.wing_x_offset.gStyle=0; pRayJg->desStartPos.wing_y_offset.gStyle=4; if(bInsideJg) pRayJg->desStartPos.wing_y_offset.offsetDist=0; else pRayJg->desStartPos.wing_y_offset.offsetDist=-pCurPlate->GetThick(); } Sub_Pnt(vec,pRayJg->End(),pRayJg->Start()); for(i=0;i<pRayJg->connectStart.wnConnBoltN;i++) { pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->iSeg=pCurPlate->iSeg; pBolt->set_d(pRayJg->connectStart.d); pBolt->cfgword=pRayJg->cfgword; //调整螺栓配材号与基准构件配材号一致 pBolt->AddL0Thick(pRayJg->handle,TRUE); pBolt->AddL0Thick(pCurPlate->handle,TRUE); pBolt->CalGuigeAuto(); pBolt->set_norm(pCurPlate->ucs.axis_z); pBolt->des_base_pos.datumPoint.datum_pos_style=1; //角钢楞点定位 pBolt->des_base_pos.datumPoint.des_para.RODEND.bIncOddEffect=TRUE; pBolt->des_base_pos.datumPoint.des_para.RODEND.wing_offset_style=4; pBolt->des_base_pos.datumPoint.des_para.RODEND.wing_offset_dist=0; pBolt->des_base_pos.hPart=pBolt->des_base_pos.datumPoint.des_para.RODEND.hRod=pRayJg->handle; sprintf(pBolt->des_base_pos.norm_offset.key_str,"-0X%X",pRayJg->handle); pBolt->des_work_norm.norm_style=1; if(fabs(pCurPlate->ucs.axis_z*pRayJg->get_norm_x_wing())>fabs(pCurPlate->ucs.axis_z*pRayJg->get_norm_y_wing())) { //X肢上的螺栓 //沿X肢进行螺栓位置偏移 pBolt->des_base_pos.datumPoint.des_para.RODEND.offset_wing=pBolt->des_base_pos.offset_wing=0; pBolt->des_work_norm.hVicePart=pRayJg->handle; pBolt->des_work_norm.direction=0; //朝外 pBolt->des_work_norm.norm_wing=0; } else { //Y肢上的螺栓 pBolt->des_work_norm.hVicePart=pRayJg->handle; pBolt->des_base_pos.datumPoint.des_para.RODEND.offset_wing=pBolt->des_base_pos.offset_wing=1; //沿Y肢进行螺栓位置偏移 pBolt->des_work_norm.direction=0; //朝外 pBolt->des_work_norm.norm_wing=1; } pBolt->des_base_pos.datumPoint.des_para.RODEND.direction=pBolt->des_base_pos.direction=0;//始-->终 if(pRayJg->connectStart.rows==1) //单排排列 { pBolt->des_base_pos.wing_offset_dist=jgzj.g; pBolt->des_base_pos.len_offset_dist=rayspace.EndSpace+i*rayspace.SingleRowSpace; } else if(pRayJg->connectStart.rows==2) //双排排列 { pBolt->des_base_pos.len_offset_dist=rayspace.EndSpace+i*rayspace.doubleRowSpace; if(iBoltLayoutStyle==0) //靠近楞线一侧优先 { if(i%2==0) //偶数个螺栓 pBolt->des_base_pos.wing_offset_dist=ray_jg_zj.g1; else //奇数个螺栓 pBolt->des_base_pos.wing_offset_dist=ray_jg_zj.g2; } else //远离楞线一侧优先 { if(i%2==0) //偶数个螺栓 pBolt->des_base_pos.wing_offset_dist=ray_jg_zj.g2; else //奇数个螺栓 pBolt->des_base_pos.wing_offset_dist=ray_jg_zj.g1; } } pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->SetModified(); pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); CLsRef *pLsRef=pCurPlate->AppendLsRef(pBolt->GetLsRef(),FALSE); pLsRef->dwRayNo=GetSingleWord(i*2); pRayJg->AppendStartLsRef(pBolt->GetLsRef(),FALSE); } if(!bInsideJg) pRayJg->SetStart(pRayJg->Start()+pCurPlate->GetThick()*pCurPlate->ucs.axis_z); } else { pRayJgPara->start0_end1=1; //pRayJg->des_end_pos.datum_pos_style=15;; //直接指定基点坐标 pRayJg->desEndPos.SetToDatumPointStyle(); //基点定位方式 pRayJg->desEndPos.datumPoint.datum_pos_style=3; //角钢心线交点 pRayJg->desEndPos.datumPoint.des_para.AXIS_INTERS.hDatum1=pBaseJg[0]->handle; pRayJg->desEndPos.datumPoint.des_para.AXIS_INTERS.hDatum2=pBaseJg[1]->handle; pRayJg->desEndPos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=0; pRayJg->desEndPos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2=0; if(x_wing0_y_wing1==0) { pRayJg->desEndPos.wing_x_offset.gStyle=4; if(bInsideJg) pRayJg->desEndPos.wing_x_offset.offsetDist=0; else pRayJg->desEndPos.wing_x_offset.offsetDist=-pCurPlate->GetThick(); pRayJg->desEndPos.wing_y_offset.gStyle=0; } else { pRayJg->desEndPos.wing_x_offset.gStyle=0; pRayJg->desEndPos.wing_y_offset.gStyle=4; if(bInsideJg) pRayJg->desEndPos.wing_y_offset.offsetDist=0; else pRayJg->desEndPos.wing_y_offset.offsetDist=-pCurPlate->GetThick(); } Sub_Pnt(vec,pRayJg->Start(),pRayJg->End()); for(i=0;i<pRayJg->connectEnd.wnConnBoltN;i++) { pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->iSeg=pCurPlate->iSeg; pBolt->set_d(pRayJg->connectEnd.d); pBolt->cfgword=pRayJg->cfgword; //调整螺栓配材号与基准构件配材号一致 pBolt->AddL0Thick(pRayJg->handle,TRUE); pBolt->AddL0Thick(pCurPlate->handle,TRUE); pBolt->CalGuigeAuto(); pBolt->set_norm(pCurPlate->ucs.axis_z); pBolt->des_base_pos.datumPoint.datum_pos_style=1; //角钢楞点定位 pBolt->des_base_pos.datumPoint.des_para.RODEND.bIncOddEffect=TRUE; pBolt->des_base_pos.datumPoint.des_para.RODEND.wing_offset_style=4; pBolt->des_base_pos.datumPoint.des_para.RODEND.wing_offset_dist=0; pBolt->des_base_pos.hPart=pBolt->des_base_pos.datumPoint.des_para.RODEND.hRod=pRayJg->handle; sprintf(pBolt->des_base_pos.norm_offset.key_str,"-0X%X",pRayJg->handle); pBolt->des_work_norm.norm_style=1; if(fabs(pCurPlate->ucs.axis_z*pRayJg->get_norm_x_wing())>fabs(pCurPlate->ucs.axis_z*pRayJg->get_norm_y_wing())) { //X肢上的螺栓 //沿X肢进行螺栓位置偏移 pBolt->des_base_pos.datumPoint.des_para.RODEND.offset_wing=pBolt->des_base_pos.offset_wing=0; pBolt->des_work_norm.hVicePart=pRayJg->handle; pBolt->des_work_norm.direction=0; //朝外 pBolt->des_work_norm.norm_wing=0; } else { //Y肢上的螺栓 pBolt->des_work_norm.hVicePart=pRayJg->handle; pBolt->des_base_pos.datumPoint.des_para.RODEND.offset_wing=pBolt->des_base_pos.offset_wing=1; //沿Y肢进行螺栓位置偏移 pBolt->des_work_norm.direction=0; //朝外 pBolt->des_work_norm.norm_wing=1; } pBolt->des_base_pos.datumPoint.des_para.RODEND.direction=pBolt->des_base_pos.direction=1;//终-->始 if(pRayJg->connectEnd.rows==1) //单排排列 { pBolt->des_base_pos.wing_offset_dist=jgzj.g; pBolt->des_base_pos.len_offset_dist=rayspace.EndSpace+i*rayspace.SingleRowSpace; } else if(pRayJg->connectEnd.rows==2) //双排排列 { pBolt->des_base_pos.len_offset_dist=rayspace.EndSpace+i*rayspace.doubleRowSpace; if(iBoltLayoutStyle==0) //靠近楞线一侧优先 { if(i%2==0) //偶数个螺栓 pBolt->des_base_pos.wing_offset_dist=ray_jg_zj.g1; else //奇数个螺栓 pBolt->des_base_pos.wing_offset_dist=ray_jg_zj.g2; } else //远离楞线一侧优先 { if(i%2==0) //偶数个螺栓 pBolt->des_base_pos.wing_offset_dist=ray_jg_zj.g2; else //奇数个螺栓 pBolt->des_base_pos.wing_offset_dist=ray_jg_zj.g1; } } pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->SetModified(); pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); CLsRef *pLsRef=pCurPlate->AppendLsRef(pBolt->GetLsRef(),FALSE); pLsRef->dwRayNo=GetSingleWord(i*2); pRayJg->AppendEndLsRef(pBolt->GetLsRef(),FALSE); } if(!bInsideJg) pRayJg->SetEnd(pRayJg->End()+pCurPlate->GetThick()*pCurPlate->ucs.axis_z); } pRayJg->ClearFlag(); pRayJg->CalPosition(); pRayJg->SetModified(); pRayJg->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pRayJg->GetSolidPartObject()); } pCurPlate->designInfo.m_hBasePart = pBaseJg[0]->handle; CDesignLjParaDlg lj_dlg; lj_dlg.m_pLjPara=&pCurPlate->designInfo; pCurPlate->designInfo.m_bEnableFlexibleDesign=TRUE; if(lj_dlg.DoModal()!=IDOK) throw "中途退出!"; pCurPlate->DesignPlate(); pCurPlate->SetModified(); pCurPlate->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength(),g_sysPara.display.nSmoothness); g_pSolidDraw->NewSolidPart(pCurPlate->GetSolidPartObject()); g_pSolidDraw->ReleaseSnapStatus(); OnOperOther(); ReleaseFunc(); //解开函数运行锁定状态 g_pPromptMsg->Destroy(); static CMirMsgDlg mir_dlg; if(mir_dlg.DoModal()==IDOK) MirTaAtom(pCurPlate,mir_dlg.mirmsg); g_pSolidDraw->Draw(); //切换到实体显示模式 g_pSolidSet->SetDisplayType(DISP_SOLID); Invalidate(FALSE); Ta.EndUndoListen(); } catch(char *sError) { Ta.EndUndoListen(); //发生异常设计失败,删除系统中已生成的错误节点板 if(pCurPlate!=NULL) console.DeletePart(pCurPlate->handle); AfxMessageBox(sError); //提示异常错误信息 g_pSolidDraw->ReleaseSnapStatus(); ReleaseFunc(); //解开函数运行锁定状态 OnOperOther(); g_pPromptMsg->Destroy(); return; } m_pDoc->SetModifiedFlag(); // 修改数据后应调用此函数置修改标志. ReleaseFunc(); //解开函数运行锁定状态 } #endif void CLDSView::OnShareJdbDesign() { m_nPrevCommandID=ID_SHARE_JDB_DESIGN; #ifdef AFX_TARG_ENU_ENGLISH m_sPrevCommandName="Repeat Common Plate"; #else m_sPrevCommandName="重复共用板"; #endif Command("GongYongBan"); } int CLDSView::ShareJdbDesign() { CCmdLockObject cmdlock(this); if(!cmdlock.LockSuccessed()) return FALSE; //-----vvvvvvv-通过对话框,输入钢板基本信息--------- //在开始位置输入钢板基本信息,否则钢板厚度修改之后射线角钢偏移量需要二次修改 wht 16-10-21 static CPlateBasicParaDlg share_dlg; share_dlg.m_bEnableWeld=FALSE; //无焊接边 if(share_dlg.DoModal()!=IDOK) return FALSE; //-----vvvvvvv-界面操作,捕捉共用板所需的角钢和节点--------- CCmdLineDlg *pCmdLine = ((CMainFrame*)AfxGetMainWnd())->GetCmdLinePage(); CString cmdStr; DWORD dwhObj=0,dwExportFlag=0; CSnapTypeVerify verify; //选择共用板需要的基准角钢和基准节点 CLDSLineAngle *pBaseJg[2]={NULL}; CLDSNode *pBaseNode[2]={NULL}; for(int i=0;i<2;i++) { //选择共用板的基准角钢 if(i==0) #ifdef AFX_TARG_ENU_ENGLISH cmdStr.Format("Please select common plate's first datum angle:"); else cmdStr.Format("Please select common plate's second datum angle:"); #else cmdStr.Format("请选择共用板的第一根基准角钢:"); else cmdStr.Format("请选择共用板的第二根基准角钢:"); #endif pCmdLine->FillCmdLine(cmdStr,""); verify.ClearSnapFlag(); verify.SetVerifyFlag(OBJPROVIDER::SOLIDSPACE,GetSingleWord(SELECTINDEX_LINEANGLE)); verify.AddVerifyFlag(OBJPROVIDER::LINESPACE,SNAP_LINE); while(pBaseJg[i]==NULL) { if(g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verify)<0) { pCmdLine->CancelCmdLine(); return FALSE; } SELOBJ obj(dwhObj,dwExportFlag); if((pBaseJg[i]=(CLDSLineAngle*)console.FromPartHandle(obj.hRelaObj,CLS_LINEANGLE))==NULL) { pCmdLine->FillCmdLine(cmdStr,""); continue; } double scale=GetPickPosScaleOnRodS2E(pBaseJg[i]); if(scale<=0.3) pBaseNode[i]=pBaseJg[i]->pStart; else if(scale>-0.7) pBaseNode[i]=pBaseJg[i]->pEnd; } g_pSolidDraw->SetEntSnapStatus(pBaseJg[i]->handle); pCmdLine->FinishCmdLine(CXhChar16("0x%X",pBaseJg[i]->handle)); if(pBaseNode[i]!=NULL) continue; //已自动识别出杆件当前的始末端 //选择基准角钢上的端节点 if(i==0) #ifdef AFX_TARG_ENU_ENGLISH cmdStr.Format("Please select common plate's first datum node(it should be end point of first datum angle"); else cmdStr.Format("Please select common plate's second datum node(it should be end point of second datum angle"); #else cmdStr.Format("请选择共用板的第一根基准角钢的端节点:"); else cmdStr.Format("请选择共用板的第二根基准角钢的端节点:"); #endif pCmdLine->FillCmdLine(cmdStr,""); verify.ClearSnapFlag(); verify.SetVerifyFlag(OBJPROVIDER::SOLIDSPACE,GetSingleWord(SELECTINDEX_NODE)); verify.AddVerifyFlag(OBJPROVIDER::LINESPACE,SNAP_POINT); {//此处加花括号用来控制节点凸出显示的生命周期 CDisplayNodeAtFrontLife displayNode; displayNode.DisplayNodeAtFront(); while(1) { if(g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verify)<0) { pCmdLine->CancelCmdLine(); return FALSE; } SELOBJ obj(dwhObj,dwExportFlag); pBaseNode[i]=console.FromNodeHandle(obj.hRelaObj); if(pBaseNode[i]) { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pBaseNode[i]->dwPermission)) { #ifdef AFX_TARG_ENU_ENGLISH AfxMessageBox("Without modify permission of the node!"); #else AfxMessageBox("没有此节点的修改权限!"); #endif return FALSE; } else if(pBaseNode[i]==pBaseJg[i]->pStart||pBaseNode[i]==pBaseJg[i]->pEnd) break; } }} pCmdLine->FinishCmdLine(CXhChar16("0x%X",pBaseNode[i]->handle)); //判断选中的节点或者角钢是否有修改权限 if( pBaseNode[i]==pBaseJg[i]->pStart) { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pBaseJg[i]->dwStartPermission)) { #ifdef AFX_TARG_ENU_ENGLISH AfxMessageBox("Without modify permission of angle's start!"); #else AfxMessageBox("没有此角钢始端的修改权限!"); #endif return FALSE; } pBaseJg[i]->feature = 10; //始端连接 } else if(pBaseNode[i]==pBaseJg[i]->pEnd) { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pBaseJg[i]->dwEndPermission)) { #ifdef AFX_TARG_ENU_ENGLISH AfxMessageBox("Without modify permission of angle's end!"); #else AfxMessageBox("没有此角钢终端的修改权限!"); #endif return FALSE; } pBaseJg[i]->feature = 11; //终端连接 } } //选择共用板的射线角钢 CLDSLineAngle *pRayJg=NULL; #ifdef AFX_TARG_ENU_ENGLISH cmdStr.Format("If there is a ray angle Shared with the connection plate, please choose, otherwise click empty"); #else cmdStr.Format("如果有射线角钢共用此连接板,请选择,若无直接回车:"); #endif pCmdLine->FillCmdLine(cmdStr,""); verify.ClearSnapFlag(); verify.SetVerifyFlag(OBJPROVIDER::SOLIDSPACE,GetSingleWord(SELECTINDEX_LINEANGLE)); verify.AddVerifyFlag(OBJPROVIDER::LINESPACE,SNAP_LINE); while(1) { if(g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verify)<0) { pCmdLine->CancelCmdLine(); return FALSE; } SELOBJ obj(dwhObj,dwExportFlag); pRayJg=(CLDSLineAngle*)console.FromPartHandle(obj.hRelaObj,CLS_LINEANGLE); if(obj.ciTriggerType==SELOBJ::TRIGGER_KEYRETURN) { //回车确认不需人依赖杆件 pRayJg=NULL; break; } if(pRayJg && pRayJg->pStart && pRayJg->pEnd) { //已选中依赖杆件 if(pRayJg->pStart==pBaseNode[0]||pRayJg->pStart==pBaseNode[1]|| pRayJg->pEnd==pBaseNode[0]||pRayJg->pEnd==pBaseNode[1]) break; } } if(pRayJg) { g_pSolidDraw->SetEntSnapStatus(pRayJg->handle); pCmdLine->FinishCmdLine(CXhChar16("0x%X",pRayJg->handle)); } else pCmdLine->FinishCmdLine("无射线角钢"); //-----vvvvvvv-设计共用版,填充共用板的设计参数--------- try{ CUndoOperObject undo(&Ta,true); CLDSPlate *pCurPlate = (CLDSPlate*)console.AppendPart(CLS_PLATE); pCurPlate->face_N = 1; pCurPlate->jdb_style = 6; //共用板 pCurPlate->Thick=share_dlg.m_nPlankThick; pCurPlate->cMaterial=CSteelMatLibrary::RecordAt(share_dlg.m_iMaterial).cBriefMark; pCurPlate->SetPartNo(share_dlg.m_sPartNo.GetBuffer()); pCurPlate->iSeg=SEGI(share_dlg.m_sSegI.GetBuffer()); pCurPlate->cfgword=pBaseJg[0]->cfgword; //调整钢板配材号与基准构件或基准节点配材号一致 //更正两基准角钢严格平行时的法线计算错误 WJH-2004/07/01 pCurPlate->ucs.axis_z = CalFaceNorm(pBaseJg[0]->Start(),pBaseJg[0]->End(),pBaseJg[1]->Start(),pBaseJg[1]->End()); normalize(pCurPlate->ucs.axis_z); if(dot_prod(console.GetActiveView()->ucs.axis_z,pCurPlate->ucs.axis_z)<0) pCurPlate->ucs.axis_z = -1.0*pCurPlate->ucs.axis_z; pCurPlate->ucs.origin = CalSharePlankRayZhun(pBaseJg,pBaseNode,NULL,pCurPlate->ucs.axis_z); pCurPlate->designInfo.iProfileStyle0123=1; pCurPlate->designInfo.m_hBasePart=pBaseJg[0]->handle; pCurPlate->designInfo.m_hBaseNode=pBaseNode[0]->handle; pCurPlate->designInfo.m_bEnableFlexibleDesign=TRUE; //启用柔性设计 pCurPlate->designInfo.iFaceType=1; pCurPlate->designInfo.origin.datum_pos_style=3; pCurPlate->designInfo.origin.des_para.AXIS_INTERS.hDatum1=pBaseJg[0]->handle; pCurPlate->designInfo.origin.des_para.AXIS_INTERS.hDatum2=pBaseJg[1]->handle; pCurPlate->designInfo.norm.norm_style=2; //两角钢交叉线法线 pCurPlate->designInfo.norm.hVicePart=pBaseJg[0]->handle; pCurPlate->designInfo.norm.hCrossPart=pBaseJg[1]->handle; pCurPlate->designInfo.norm.nearVector=console.GetActiveView()->ucs.axis_z;//近似法线 pCurPlate->designInfo.origin.UpdatePos(console.GetActiveModel()); pCurPlate->ucs.origin=pCurPlate->designInfo.origin.Position(); //初始化共用板的连接杆件设计信息 int x_wing0_y_wing1=0; CDesignLjPartPara *pLjJgParaArr[2]={NULL}; for(int i=0;i<2;i++) { pLjJgParaArr[i]=pCurPlate->designInfo.partList.Add(pBaseJg[i]->handle); pLjJgParaArr[i]->m_bAdjustLjEndPos=FALSE; //共用板两根基准杆件对称时都不需要调整摆放位置 wht 10-02-26 pLjJgParaArr[i]->hPart=pBaseJg[i]->handle; IsInsideJg(pBaseJg[i],pCurPlate->ucs.axis_z,&x_wing0_y_wing1); pLjJgParaArr[i]->angle.cur_wing_x0_y1=(BYTE)x_wing0_y_wing1; //对基准角钢布置螺栓 g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->SetEntSnapStatus(pBaseJg[i]->handle); CLayAngleBoltDlg dlg; ATOM_LIST<CDesignLsPara>ls_list; dlg.m_iOddCalStyle=pBaseJg[i]->desEndOdd.m_iOddCalStyle; if(pBaseJg[i]->feature==10) { //共用板角钢螺栓一般为单排,数量为2 wht 16-10-21 pBaseJg[i]->connectStart.wnConnBoltN=2; pBaseJg[i]->connectStart.rows=1; dlg.m_fOddment = pBaseJg[i]->startOdd(); dlg.m_iRayDirection=0; //终->始 } else { pBaseJg[i]->connectEnd.wnConnBoltN=2; pBaseJg[i]->connectEnd.rows=1; dlg.m_fOddment = pBaseJg[i]->endOdd(); dlg.m_iRayDirection=1; //终->始 } LSSPACE_STRU basespace; GetLsSpace(basespace,pBaseJg[i]->connectEnd.d); if(pBaseJg[i]->GetClassTypeId()==CLS_LINEANGLE) dlg.m_pLinePart = pBaseJg[i]; dlg.m_pNode = pBaseNode[i]; dlg.m_pLsList=&ls_list; //布置板时的参数 dlg.m_bIncPlateProfilePara = TRUE; dlg.m_bTwoEdgeProfile = TRUE; //插空布置螺栓 dlg.m_nLsEndSpace = basespace.EndSpace+basespace.SingleRowSpace/2;//端距 dlg.viewNorm = console.GetActiveView()->ucs.axis_z; if(dlg.DoModal()!=IDOK) { console.DeletePart(pCurPlate->handle); return FALSE; } //获取用户输入 if(pBaseJg[i]->feature==10) { pBaseJg[i]->desStartOdd.m_iOddCalStyle=dlg.m_iOddCalStyle; pBaseJg[i]->SetStartOdd(dlg.m_fOddment); if(dlg.m_iOffsetWing==0) pBaseJg[i]->desStartPos.wing_x_offset.offsetDist=dlg.m_fAngleEndNormOffset; else pBaseJg[i]->desStartPos.wing_y_offset.offsetDist=dlg.m_fAngleEndNormOffset; pBaseJg[i]->SetModified(); pBaseJg[i]->CalPosition(); pBaseJg[i]->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pBaseJg[i]->GetSolidPartObject()); } else { pBaseJg[i]->desEndOdd.m_iOddCalStyle=dlg.m_iOddCalStyle; pBaseJg[i]->SetEndOdd(dlg.m_fOddment); if(dlg.m_iOffsetWing==0) pBaseJg[i]->desEndPos.wing_x_offset.offsetDist=dlg.m_fAngleEndNormOffset; else pBaseJg[i]->desEndPos.wing_y_offset.offsetDist=dlg.m_fAngleEndNormOffset; pBaseJg[i]->SetModified(); pBaseJg[i]->CalPosition(); pBaseJg[i]->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pBaseJg[i]->GetSolidPartObject()); } //定义板外型时的信息 pLjJgParaArr[i]->angle.cbSpaceFlag=dlg.cbSpaceFlag; pLjJgParaArr[i]->end_space=dlg.m_fPlateEdgeSpace; pLjJgParaArr[i]->wing_space=dlg.m_fWingSpace; pLjJgParaArr[i]->ber_space=dlg.m_fBerSpace; pLjJgParaArr[i]->iFaceNo = 1; pLjJgParaArr[i]->angle.bTwoEdge = dlg.m_bTwoEdgeProfile; //根据用户输入在角钢上布置螺栓 int iInitRayNo=1; ATOM_LIST<RAYNO_RECORD>rayNoList; for(CDesignLsPara *pLsPara=ls_list.GetFirst();pLsPara;pLsPara=ls_list.GetNext()) { CLDSBolt *pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->des_base_pos=pLsPara->des_base_pos; pBolt->des_work_norm=pLsPara->des_work_norm; pBolt->set_d(pLsPara->d); pBolt->iSeg = pBaseJg[i]->iSeg; pBolt->SetGrade(pLsPara->grade); pBolt->cfgword=pBaseJg[i]->cfgword; //调整螺栓配材号与基准构件配材号一致 //更新螺栓通厚以及法向偏移量 pBolt->AddL0Thick(pBaseJg[i]->handle,TRUE); pBolt->AddL0Thick(pCurPlate->handle,TRUE); pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->CalGuigeAuto(); pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); if(pBaseNode[i]==pBaseJg[i]->pStart) pBaseJg[i]->AppendStartLsRef(pBolt->GetLsRef()); else if(pBaseNode[i]==pBaseJg[i]->pEnd) pBaseJg[i]->AppendEndLsRef(pBolt->GetLsRef()); else pBaseJg[i]->AppendMidLsRef(pBolt->GetLsRef()); if(pBolt->des_base_pos.datumPoint.datum_pos_style==3) //交叉点定位 { CLDSLineAngle *pCrossAngle=(CLDSLineAngle*)console.FromPartHandle(pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2,CLS_LINEANGLE); if(pCrossAngle) { f3dPoint pos,bolt_vec,wing_vec; if(fabs(pBolt->ucs.axis_z*pCrossAngle->get_norm_x_wing())> fabs(pBolt->ucs.axis_z*pCrossAngle->get_norm_y_wing())) { wing_vec=pCrossAngle->GetWingVecX(); Int3dlf(pos,pBolt->ucs.origin,pBolt->ucs.axis_z, pCrossAngle->Start(),pCrossAngle->get_norm_x_wing()); } else { wing_vec=pCrossAngle->GetWingVecY(); Int3dlf(pos,pBolt->ucs.origin,pBolt->ucs.axis_z, pCrossAngle->Start(),pCrossAngle->get_norm_y_wing()); } bolt_vec=pos-pCrossAngle->Start(); double dd=bolt_vec*wing_vec; if(dd>0&&dd<pCrossAngle->GetWidth()) { //交叉螺栓位于交叉角钢内 pCrossAngle->AppendMidLsRef(pBolt->GetLsRef()); pBolt->AddL0Thick(pCrossAngle->handle,TRUE); } } } //将螺栓添加到板上 pCurPlate->AppendLsRef(pBolt->GetLsRef()); double g=0.0; //将螺栓引入角钢 if(pBaseJg[i]->GetClassTypeId()==CLS_LINEANGLE) g=pBaseJg[i]->GetLsG(pBolt); else { f3dPoint ls_pos=pBolt->ucs.origin; coord_trans(ls_pos,pBaseJg[i]->ucs,FALSE); g=ls_pos.y; } RAYNO_RECORD *pRayNo; for(pRayNo=rayNoList.GetFirst();pRayNo;pRayNo=rayNoList.GetNext()) { if(ftoi(pRayNo->yCoord)==ftoi(g)) { pBolt->dwRayNo=pRayNo->dwRayNo; break; } } if(pRayNo==NULL) { pRayNo=rayNoList.append(); pRayNo->dwRayNo=GetSingleWord(iInitRayNo); pRayNo->hPart=pBolt->des_base_pos.hPart; pRayNo->yCoord=g; pBolt->dwRayNo=pRayNo->dwRayNo; iInitRayNo++; } } if(pBaseNode[i]==pBaseJg[i]->pStart&&pBaseJg[i]->desStartOdd.m_iOddCalStyle==1) pBaseJg[i]->CalStartOddment(); else if(pBaseNode[i]==pBaseJg[i]->pEnd&&pBaseJg[i]->desEndOdd.m_iOddCalStyle==1) pBaseJg[i]->CalEndOddment(); pBaseJg[i]->SetModified(); } if(pRayJg) { //根据射线角钢调整共用板的连接杆件设计参数 CDesignLjPartPara *pRayJgPara=pCurPlate->designInfo.partList.Add(pRayJg->handle); pRayJgPara->hPart=pRayJg->handle; BOOL bInsideJg=IsInsideJg(pRayJg,pCurPlate->ucs.axis_z,&x_wing0_y_wing1); pRayJgPara->angle.cur_wing_x0_y1=(BYTE)x_wing0_y_wing1; pCurPlate->ucs.origin = CalSharePlankRayZhun(pBaseJg,pBaseNode,pRayJg,pCurPlate->ucs.axis_z); //布置射线角钢螺栓 g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->SetEntSnapStatus(pRayJg->handle); ATOM_LIST<CDesignLsPara>ls_list; CLayAngleBoltDlg ray_jg_dlg; ray_jg_dlg.m_bIncPlateProfilePara = TRUE; if(pRayJg->pStart==pBaseNode[0]||pRayJg->pStart==pBaseNode[1]) { pRayJg->feature = 10; //始端连接 ray_jg_dlg.m_iRayDirection=0; //始->终 //计算角钢正负头 if(pBaseJg[0]) pRayJg->desStartOdd.m_hRefPart1=pBaseJg[0]->handle; if(pBaseJg[1]) pRayJg->desStartOdd.m_hRefPart2=pBaseJg[1]->handle; pRayJg->desStartOdd.m_fCollideDist=g_sysPara.VertexDist; pRayJg->desStartOdd.m_iOddCalStyle=0; //根据碰撞计算正负头 pRayJg->CalStartOddment(); ray_jg_dlg.m_fOddment=pRayJg->startOdd(); } else if(pRayJg->pEnd==pBaseNode[0]||pRayJg->pEnd==pBaseNode[1]) { pRayJg->feature = 11; //终端连接 ray_jg_dlg.m_iRayDirection=1; //终->始 //计算角钢正负头 if(pBaseJg[0]) pRayJg->desEndOdd.m_hRefPart1=pBaseJg[0]->handle; if(pBaseJg[1]) pRayJg->desEndOdd.m_hRefPart2=pBaseJg[1]->handle; pRayJg->desEndOdd.m_fCollideDist=g_sysPara.VertexDist; pRayJg->desEndOdd.m_iOddCalStyle=0; //根据碰撞计算正负头 pRayJg->CalEndOddment(); ray_jg_dlg.m_fOddment=pRayJg->endOdd(); } if(pRayJg->feature==10) //始端连接 { pRayJgPara->start0_end1=0; //pRayJg->des_start_pos.datum_pos_style=15; //直接指定基点坐标 pRayJg->desStartPos.SetToDatumPointStyle(); //简单定位时,为避免后续自动判断改变基点定位类型,改为人工指定模式 wjh-2016.3.24 if(pRayJg->desStartPos.jgber_cal_style==2) pRayJg->desStartPos.bUdfDatumPointMode=TRUE; //基点定位方式 pRayJg->desStartPos.datumPoint.datum_pos_style=3; //角钢心线交点 pRayJg->desStartPos.datumPoint.des_para.AXIS_INTERS.hDatum1=pBaseJg[0]->handle; pRayJg->desStartPos.datumPoint.des_para.AXIS_INTERS.hDatum2=pBaseJg[1]->handle; pRayJg->desStartPos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=0; pRayJg->desStartPos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2=0; if(x_wing0_y_wing1==0) { pRayJg->desStartPos.wing_x_offset.gStyle=4; if(bInsideJg) pRayJg->desStartPos.wing_x_offset.offsetDist=0; else pRayJg->desStartPos.wing_x_offset.offsetDist=-pCurPlate->GetThick(); pRayJg->desStartPos.wing_y_offset.gStyle=0; } else { pRayJg->desStartPos.wing_x_offset.gStyle=0; pRayJg->desStartPos.wing_y_offset.gStyle=4; if(bInsideJg) pRayJg->desStartPos.wing_y_offset.offsetDist=0; else pRayJg->desStartPos.wing_y_offset.offsetDist=-pCurPlate->GetThick(); } } else { pRayJgPara->start0_end1=1; //pRayJg->desEndPos.datum_pos_style=15;; //直接指定基点坐标 pRayJg->desEndPos.SetToDatumPointStyle(); //简单定位时,为避免后续自动判断改变基点定位类型,改为人工指定模式 wjh-2016.3.24 if(pRayJg->desEndPos.jgber_cal_style==2) pRayJg->desEndPos.bUdfDatumPointMode=TRUE; //基点定位方式 pRayJg->desEndPos.datumPoint.datum_pos_style=3; //角钢心线交点 pRayJg->desEndPos.datumPoint.des_para.AXIS_INTERS.hDatum1=pBaseJg[0]->handle; pRayJg->desEndPos.datumPoint.des_para.AXIS_INTERS.hDatum2=pBaseJg[1]->handle; pRayJg->desEndPos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=0; pRayJg->desEndPos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2=0; if(x_wing0_y_wing1==0) { pRayJg->desEndPos.wing_x_offset.gStyle=4; if(bInsideJg) pRayJg->desEndPos.wing_x_offset.offsetDist=0; else pRayJg->desEndPos.wing_x_offset.offsetDist=-pCurPlate->GetThick(); pRayJg->desEndPos.wing_y_offset.gStyle=0; } else { pRayJg->desEndPos.wing_x_offset.gStyle=0; pRayJg->desEndPos.wing_y_offset.gStyle=4; if(bInsideJg) pRayJg->desEndPos.wing_y_offset.offsetDist=0; else pRayJg->desEndPos.wing_y_offset.offsetDist=-pCurPlate->GetThick(); } } ray_jg_dlg.m_pLinePart = pRayJg; ray_jg_dlg.m_pNode = pBaseNode[1]; ray_jg_dlg.m_pLsList=&ls_list; ray_jg_dlg.viewNorm = console.GetActiveView()->ucs.axis_z; //板的连接参数 ray_jg_dlg.m_bIncPlateProfilePara = TRUE; ray_jg_dlg.m_bTwoEdgeProfile = TRUE; if(ray_jg_dlg.DoModal()!=IDOK) { console.DeletePart(pCurPlate->handle); return FALSE; } //获取用户输入 if(pRayJg->feature==10) { pRayJg->desStartOdd.m_iOddCalStyle=ray_jg_dlg.m_iOddCalStyle; pRayJg->SetStartOdd(ray_jg_dlg.m_fOddment); if(ray_jg_dlg.m_iOddCalStyle==1) pRayJg->CalStartOddment(); if(ray_jg_dlg.m_iOffsetWing==0) pRayJg->desStartPos.wing_x_offset.offsetDist=ray_jg_dlg.m_fAngleEndNormOffset; else pRayJg->desStartPos.wing_y_offset.offsetDist=ray_jg_dlg.m_fAngleEndNormOffset; pRayJg->SetModified(); pRayJg->CalPosition(); pRayJg->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pRayJg->GetSolidPartObject()); } else { pRayJg->desEndOdd.m_iOddCalStyle=ray_jg_dlg.m_iOddCalStyle; pRayJg->SetEndOdd(ray_jg_dlg.m_fOddment); if(ray_jg_dlg.m_iOddCalStyle==1) pRayJg->CalEndOddment(); if(ray_jg_dlg.m_iOffsetWing==0) pRayJg->desEndPos.wing_x_offset.offsetDist=ray_jg_dlg.m_fAngleEndNormOffset; else pRayJg->desEndPos.wing_y_offset.offsetDist=ray_jg_dlg.m_fAngleEndNormOffset; pRayJg->SetModified(); pRayJg->CalPosition(); pRayJg->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pRayJg->GetSolidPartObject()); } //根据用户输入在角钢上布置螺栓 int iInitRayNo=1; ATOM_LIST<RAYNO_RECORD>rayNoList; for(CDesignLsPara *pLsPara=ls_list.GetFirst();pLsPara;pLsPara=ls_list.GetNext()) { CLDSBolt *pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->des_base_pos=pLsPara->des_base_pos; pBolt->des_work_norm=pLsPara->des_work_norm; pBolt->set_d(pLsPara->d); pBolt->iSeg = pRayJg->iSeg; pBolt->SetGrade(pLsPara->grade); pBolt->cfgword=pRayJg->cfgword; //调整螺栓配材号与基准构件配材号一致 //更新螺栓通厚以及法向偏移量 pBolt->AddL0Thick(pRayJg->handle,TRUE); pBolt->AddL0Thick(pCurPlate->handle,TRUE); pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->CalGuigeAuto(); pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); if(pBolt->des_base_pos.datumPoint.datum_pos_style==3) //交叉点定位 { CLDSLineAngle *pCrossAngle=(CLDSLineAngle*)console.FromPartHandle(pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2,CLS_LINEANGLE); if(pCrossAngle) { f3dPoint pos,bolt_vec,wing_vec; if(fabs(pBolt->ucs.axis_z*pCrossAngle->get_norm_x_wing())> fabs(pBolt->ucs.axis_z*pCrossAngle->get_norm_y_wing())) { wing_vec=pCrossAngle->GetWingVecX(); Int3dlf(pos,pBolt->ucs.origin,pBolt->ucs.axis_z, pCrossAngle->Start(),pCrossAngle->get_norm_x_wing()); } else { wing_vec=pCrossAngle->GetWingVecY(); Int3dlf(pos,pBolt->ucs.origin,pBolt->ucs.axis_z, pCrossAngle->Start(),pCrossAngle->get_norm_y_wing()); } bolt_vec=pos-pCrossAngle->Start(); double dd=bolt_vec*wing_vec; if(dd>0&&dd<pCrossAngle->GetWidth()) { //交叉螺栓位于交叉角钢内 pCrossAngle->AppendMidLsRef(pBolt->GetLsRef()); pBolt->AddL0Thick(pCrossAngle->handle,TRUE); } } } //将螺栓添加到板上 pCurPlate->AppendLsRef(pBolt->GetLsRef()); //将螺栓添加到板上 if(pRayJg->feature == 10) pRayJg->AppendStartLsRef(pBolt->GetLsRef()); else pRayJg->AppendEndLsRef(pBolt->GetLsRef()); double g=0.0; if(pRayJg->GetClassTypeId()==CLS_LINEANGLE) g=pRayJg->GetLsG(pBolt); else { f3dPoint ls_pos=pBolt->ucs.origin; coord_trans(ls_pos,pRayJg->ucs,FALSE); g=ls_pos.y; } for(RAYNO_RECORD *pRayNo=rayNoList.GetFirst();pRayNo;pRayNo=rayNoList.GetNext()) { if(ftoi(pRayNo->yCoord)==ftoi(g)) { pBolt->dwRayNo=pRayNo->dwRayNo; break; } } if(pRayNo==NULL) { pRayNo=rayNoList.append(); pRayNo->dwRayNo=GetSingleWord(iInitRayNo); pRayNo->hPart=pBolt->des_base_pos.hPart; pRayNo->yCoord=g; pBolt->dwRayNo=pRayNo->dwRayNo; iInitRayNo++; } } //板外型参数 pRayJgPara->angle.cbSpaceFlag=ray_jg_dlg.cbSpaceFlag; pRayJgPara->end_space=ray_jg_dlg.m_fPlateEdgeSpace; pRayJgPara->wing_space=ray_jg_dlg.m_fWingSpace; pRayJgPara->ber_space=ray_jg_dlg.m_fBerSpace; pRayJgPara->iFaceNo=1; pRayJgPara->angle.bTwoEdge = ray_jg_dlg.m_bTwoEdgeProfile; if(pRayJg->feature==10&&pRayJg->desStartOdd.m_iOddCalStyle==1) pRayJg->CalStartOddment(); else if(pRayJg->feature==11&&pRayJg->desEndOdd.m_iOddCalStyle==1) pRayJg->CalEndOddment(); pRayJg->SetModified(); } // pCurPlate->DesignPlate(); pCurPlate->SetModified(); pCurPlate->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength(),g_sysPara.display.nSmoothness); g_pSolidDraw->NewSolidPart(pCurPlate->GetSolidPartObject()); g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->SetEntSnapStatus(pCurPlate->handle); OnOperOther(); ReleaseFunc(); //解开函数运行锁定状态 static CMirMsgDlg mir_dlg; if(mir_dlg.DoModal()==IDOK) MirTaAtom(pCurPlate,mir_dlg.mirmsg); g_pSolidDraw->Draw(); //切换到实体显示模式 g_pSolidSet->SetDisplayType(DISP_SOLID); Invalidate(FALSE); } catch(char *sError) { g_pSolidDraw->ReleaseSnapStatus(); ReleaseFunc(); //解开函数运行锁定状态 OnOperOther(); AfxMessageBox(sError); //提示异常错误信息 return FALSE; } m_pDoc->SetModifiedFlag(); // 修改数据后应调用此函数置修改标志. ReleaseFunc(); //解开函数运行锁定状态 return TRUE; } //设计角钢接头 void CLDSView::OnCommonJgJoint() { m_nPrevCommandID=ID_COMMON_JG_JOINT; #ifdef AFX_TARG_ENU_ENGLISH m_sPrevCommandName="Repeat Angle Joint"; #else m_sPrevCommandName="重复角钢接头"; #endif Command("CommonJgJoint"); } int CLDSView::CommonJgJoint() { CCmdLineDlg *pCmdLine = ((CMainFrame*)AfxGetMainWnd())->GetCmdLinePage(); CCmdLockObject cmdlock(this); if(!cmdlock.LockSuccessed()) return FALSE; //选择设计节点 g_pSolidDraw->ReleaseSnapStatus(); CLDSNode* pSelNode=NULL; CString cmdStr; #ifdef AFX_TARG_ENU_ENGLISH cmdStr.Format("CommonJgJoint Please select the node of joint:"); #else cmdStr.Format("CommonJgJoint 请选择要设计接头的节点:"); #endif pCmdLine->FillCmdLine(cmdStr,""); DWORD dwhObj=0,dwExportFlag=0; /*CSnapTypeVerify verify(OBJPROVIDER::SOLIDSPACE,GetSingleWord(SELECTINDEX_NODE)); verify.AddVerifyFlag(OBJPROVIDER::LINESPACE,SNAP_POINT); if(pSelNode==NULL) { CDisplayNodeAtFrontLife displayNode; displayNode.DisplayNodeAtFront(); while(1) { if(g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verify)<0) { pCmdLine->CancelCmdLine(); return 0; } SELOBJ obj(dwhObj,dwExportFlag); pSelNode=Ta.Node.FromHandle(obj.hRelaObj); if(pSelNode) break; pCmdLine->FillCmdLine(cmdStr,""); } } pCmdLine->FinishCmdLine(CXhChar16("0x%X",pSelNode->handle)); g_pSolidDraw->SetEntSnapStatus(pSelNode->handle);*/ //选择两根基准角钢 CLDSLineAngle *pFirstJg=NULL,*pLastJg=NULL; CSnapTypeVerify verify(OBJPROVIDER::SOLIDSPACE,GetSingleWord(SELECTINDEX_LINEANGLE)|GetSingleWord(SELECTINDEX_GROUPLINEANGLE)); verify.AddVerifyFlag(OBJPROVIDER::LINESPACE,SNAP_LINE); for(int i=0;i<2;i++) { CLDSLineAngle* pSelAngle=NULL; #ifdef AFX_TARG_ENU_ENGLISH cmdStr.Format("CommonJgJoint please select the %d datum angles in the nodes:",i+1); #else cmdStr.Format("CommonJgJoint 请选择接头的第%d根连接基准角钢:",i+1); #endif pCmdLine->FillCmdLine(cmdStr,""); while(1) { if((g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verify))<0) { pCmdLine->CancelCmdLine(); return 0; } SELOBJ obj(dwhObj,dwExportFlag); pSelAngle=(CLDSLineAngle*)Ta.FromPartHandle(obj.hRelaObj,CLS_LINEANGLE,CLS_GROUPLINEANGLE); if(pSelAngle==NULL) continue; if(pSelNode==NULL) { double scaleOfS2E=this->GetPickPosScaleOnRodS2E(pSelAngle); if(scaleOfS2E<0.3&&pSelAngle->pStart!=NULL) pSelNode=pSelAngle->pStart; else if(scaleOfS2E>0.7&&pSelAngle->pEnd!=NULL) pSelNode=pSelAngle->pEnd; } if(pSelAngle!=NULL) break; //pCmdLine->FillCmdLine(cmdStr,""); } g_pSolidDraw->SetEntSnapStatus(pSelAngle->handle); pCmdLine->FinishCmdLine(CXhChar16("0x%X",pSelAngle->handle)); if(pFirstJg==NULL) pFirstJg=pSelAngle; else if(pLastJg==NULL) pLastJg=pSelAngle; } if(pSelNode==NULL) { verify.ClearSnapFlag(); verify.AddVerifyFlag(OBJPROVIDER::SOLIDSPACE,GetSingleWord(SELECTINDEX_NODE)); verify.AddVerifyFlag(OBJPROVIDER::LINESPACE,SNAP_POINT); CDisplayNodeAtFrontLife displayNode; displayNode.DisplayNodeAtFront(); while(1) { if(g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verify)<0) { pCmdLine->CancelCmdLine(); return 0; } SELOBJ obj(dwhObj,dwExportFlag); pSelNode=Ta.Node.FromHandle(obj.hRelaObj); if(pSelNode) break; pCmdLine->FillCmdLine(cmdStr,""); } } pCmdLine->FinishCmdLine(CXhChar16("0x%X",pSelNode->handle)); g_pSolidDraw->SetEntSnapStatus(pSelNode->handle); //设计角钢接头设计 return FinishDesignJoint(pSelNode,pFirstJg,pLastJg); } //布置脚钉 void CLDSView::OnLayoutFootnail() { m_nPrevCommandID=ID_LAYOUT_FOOTNAIL; #ifdef AFX_TARG_ENU_ENGLISH m_sPrevCommandName="Repeat to layout climbing bolt"; #else m_sPrevCommandName="重复布置脚钉"; #endif Command("LayoutFootnail"); } #include "FootNailSpaceDlg.h" int CLDSView::LayoutFootnail() { CString cmdStr; int nail_type=0;//0.槽钢脚钉板 1.角钢 bool bDownToUp; //脚钉自下向上布置 PARTSET partset; THANDLE start_handle,cur_handle=0,last_end_handle=0; f3dPoint start,end,vec,nail_pos,wing_x_vec,wing_y_vec,ls_pos; CCmdLineDlg *pCmdLine = ((CMainFrame*)AfxGetMainWnd())->GetCmdLinePage(); CLDSLinePart *pSelLinePart, *pFirstLinePart, *pLastLinePart=NULL; //-----VVVVVVV-标识函数运行状态为真,即同一时刻只能有一个塔创建函数运行--------- CCmdLockObject cmdlock(this); if(!cmdlock.LockSuccessed()) return FALSE; if (CLsLibrary::GetFootNailFamily()==0) { //如系统未设脚钉规格库,则提示用户设定以防后续代码将脚钉布置为普通螺栓 wjh-2019.9.21 CSelNailSeriesDlg setnails; setnails.DoModal(); } if (CLsLibrary::GetFootNailFamily()==0) { AfxMessageBox("螺栓库中未指定脚钉规格系列的脚钉属性!"); return false; } //切换到实体显示模式 g_pSolidSet->SetDisplayType(DISP_SOLID); Invalidate(FALSE); static char cToward='U'; #ifdef AFX_TARG_ENU_ENGLISH cmdStr.Format("Layout climbing bolt[from up to down(D)/from down to up(U)]<%C>:",cToward); #else cmdStr.Format("布置脚钉[自上而下(D)/自下而上(U)]<%C>:",cToward); #endif pCmdLine->FillCmdLine(cmdStr,""); while(1) { //设置命令行响应鼠标左键抬起的消息,同按回车键效果相同 if(!pCmdLine->GetStrFromCmdLine(cmdStr,CCmdLineDlg::LBUTTONUP_AS_RETURN)) return 0; //中途退出 m_bStartOpenWndSelTest=FALSE; //否则可能会导致命令结束后点击鼠标时一下次变为不合理的开窗状态 wjh-2015.9.8 if(cmdStr.GetLength()>0&&toupper(cmdStr[0])=='U') cToward='U'; else if(cmdStr.GetLength()>0&&toupper(cmdStr[0])=='D') cToward='D'; if(cToward=='U') bDownToUp = TRUE; else if(cToward=='D') bDownToUp = FALSE; else { #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Need selected key-word",""); #else pCmdLine->FillCmdLine("需要选项关键字",""); #endif pCmdLine->FinishCmdLine(); pCmdLine->FillCmdLine(cmdStr,""); continue; } break; } g_pSolidDraw->ReleaseSnapStatus(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Please select leg member which will layout climbing bolts<Click empty to over>:",""); #else pCmdLine->FillCmdLine("请依次选择要布置脚钉的主材<空点鼠标左键结束选择>:",""); #endif g_pSolidSnap->SetSelectPartsType(GetSingleWord(SELECTINDEX_LINETUBE)); int i=0; CUndoOperObject undo(&Ta,true); try { while(1) { long *id_arr=NULL; int nRetCode=g_pSolidSnap->GetLastSelectEnts(id_arr); //设置命令行响应鼠标左键抬起的消息,同按回车键效果相同 if(!pCmdLine->GetStrFromCmdLine(cmdStr,CCmdLineDlg::LBUTTONUP_AS_RETURN)) return 0; //中途退出 m_bStartOpenWndSelTest=FALSE; //否则可能会导致命令结束后点击鼠标时一下次变为不合理的开窗状态 wjh-2015.9.8 if(g_pSolidSnap->GetLastSelectEnts(id_arr)>i) { CLDSPart *pPart = console.FromPartHandle(id_arr[i]); pSelLinePart=NULL; if(pPart&&pPart->IsLinePart()) pSelLinePart=(CLDSLinePart*)pPart; if(pSelLinePart==NULL) { #ifdef AFX_TARG_ENU_ENGLISH AfxMessageBox("Don't select effective rod!Please select again!"); #else AfxMessageBox("没有选择有效的杆件!请重新选择!"); #endif g_pSolidDraw->SetEntSnapStatus(id_arr[i],FALSE); continue; } if(pLastLinePart!=NULL&&pLastLinePart==pSelLinePart) { #ifdef AFX_TARG_ENU_ENGLISH AfxMessageBox("Repeat to select the same leg member,Please select again!"); #else AfxMessageBox("重复选择了同一根主材,请重新选择!"); #endif g_pSolidDraw->SetEntSnapStatus(pSelLinePart->handle,FALSE); continue; } if(pSelLinePart->pStart&&pSelLinePart->pEnd) { if(pSelLinePart->pStart->handle==last_end_handle) cur_handle = pSelLinePart->pEnd->handle; else if(pSelLinePart->pEnd->handle==last_end_handle) cur_handle = pSelLinePart->pStart->handle; else if(last_end_handle!=0) { #ifdef AFX_TARG_ENU_ENGLISH AfxMessageBox("The selected rod has no connection with previous rod,Please select again!"); #else AfxMessageBox("所选杆件与上一杆件没有连接,请重新选择!"); #endif g_pSolidDraw->SetEntSnapStatus(pSelLinePart->handle,FALSE); continue; } else if(bDownToUp) //脚钉自下向上布置 { if(pSelLinePart->pStart->Position(false).z>pSelLinePart->pEnd->Position(false).z) { //初选的第一根杆件 start_handle = pSelLinePart->pStart->handle; cur_handle = pSelLinePart->pEnd->handle; } else //起始点高,终止点低 { start_handle = pSelLinePart->pEnd->handle; cur_handle = pSelLinePart->pStart->handle; } } else //if(!bDownToUp) //脚钉自上向下布置 { if(pSelLinePart->pStart->Position(false).z>pSelLinePart->pEnd->Position(false).z) { //初选的第一根杆件 start_handle = pSelLinePart->pEnd->handle; cur_handle = pSelLinePart->pStart->handle; } else //起始点高,终止点低 { start_handle = pSelLinePart->pStart->handle; cur_handle = pSelLinePart->pEnd->handle; } } last_end_handle = cur_handle; partset.append(pSelLinePart); pLastLinePart = pSelLinePart; } else { #ifdef AFX_TARG_ENU_ENGLISH if(AfxMessageBox("Are you sure you want to layout bolts on the selected short angle?",MB_YESNO|MB_ICONQUESTION)==IDYES) #else if(AfxMessageBox("你确定要在选中的短角钢上布置螺栓吗?",MB_YESNO|MB_ICONQUESTION)==IDYES) #endif { partset.append(pSelLinePart); break; //在短角钢上布置螺栓时只能单独在某一根短角钢上布置螺栓 } else continue; } g_pSolidDraw->SetEntSnapStatus(pSelLinePart->handle,TRUE); i++; } else { #ifdef AFX_TARG_ENU_ENGLISH if(AfxMessageBox("Are you sure you have select all rods?",MB_YESNO|MB_ICONQUESTION)==IDYES) #else if(AfxMessageBox("你确定已经选完了要进行设计的所有杆件吗?",MB_YESNO|MB_ICONQUESTION)==IDYES) #endif break; else continue; } } g_pSolidDraw->ReleaseSnapStatus(); CFootnailSpaceDlg naildlg; CLDSBolt ls(console.GetActiveModel()),*pLs; BOOL X0_OR_Y1_WING=FALSE;//FALSE:X肢 TRUE:Y肢 double dist=0,used_dist=0,odd_dist=0,prev_odd=0,overlap_length=0; double extra_dist=0; //上一根杆件遗留的空白长度 //判断杆件类型 pFirstLinePart = (CLDSLinePart*)partset.GetFirst(); if(!pFirstLinePart) return 0; //中途退出 if(pFirstLinePart->GetClassTypeId()==CLS_LINEANGLE) { JGZJ jgzj; double fPreRodRemainingLen=0; //前一杆件的剩余长度,跨杆件布置第一个螺栓时脚钉间距需要减去前一杆件剩余长度 wht 15-08-13 double wing_wide,wing_thick;naildlg.m_iLineType = 0; for(CLDSLineAngle *pCurJg=(CLDSLineAngle*)partset.GetFirst();pCurJg!=NULL;pCurJg=(CLDSLineAngle*)partset.GetNext()) { UCS_STRU ucs; pCurJg->getUCS(ucs); g_pSolidDraw->SetEntSnapStatus(pCurJg->handle,TRUE); // CXhChar16 sBoltPadPartNo; CLDSBolt* pStartBolt=NULL; if(pCurJg==(CLDSLineAngle*)pFirstLinePart) { for(CLsRef *pRef=pCurJg->GetFirstLsRef();pRef!=NULL;pRef=pCurJg->GetNextLsRef()) { if(pRef->GetLsPtr()->m_dwFlag.IsHasFlag(CLDSBolt::FOOT_NAIL)) { if(pStartBolt==NULL) pStartBolt=pRef->GetLsPtr(); if(bDownToUp) { if((*pRef)->ucs.origin.z<pStartBolt->ucs.origin.z) pStartBolt=pRef->GetLsPtr(); } else if((*pRef)->ucs.origin.z>pStartBolt->ucs.origin.z) pStartBolt=pRef->GetLsPtr(); } } //如果有脚钉的话,设置起始脚钉 #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Please select start climbing nails and press return key, none nails type 'N' key:",""); #else pCmdLine->FillCmdLine("请选择起始脚钉回车,无起始脚钉[N]:",""); #endif g_pSolidSet->SetDisplayType(DISP_SOLID); g_pSolidSnap->SetSelectPartsType(GetSingleWord(SELECTINDEX_BOLT)); g_pSolidDraw->ReleaseSnapStatus(); if(pStartBolt) { g_pSolidDraw->SetEntSnapStatus(pStartBolt->handle); //将脚钉位置放大显示 SCOPE_STRU scope; scope.VerifyVertex(pStartBolt->ucs.origin); scope.fMinX-=150; scope.fMaxX+=150; scope.fMinY-=150; scope.fMaxY+=150; scope.fMinZ-=150; scope.fMaxZ+=150; g_pSolidOper->FocusTo(scope,0.2); } if(!pCmdLine->GetStrFromCmdLine(cmdStr,CCmdLineDlg::KEYWORD_AS_RETURN,"N")) { pCmdLine->CancelCmdLine(); return 0; } long *id_arr=NULL; int n = g_pSolidSnap->GetLastSelectEnts(id_arr); if(cmdStr.CompareNoCase("N")==0||n!=1) pStartBolt=NULL; else if(n==1) { CLDSBolt *pSelectedBolt=(CLDSBolt*)console.FromPartHandle(id_arr[0],CLS_BOLT); if(pSelectedBolt) pStartBolt=pSelectedBolt; } } else extra_dist=0; // long old_start_handle=start_handle; if(pStartBolt&&pCurJg==pFirstLinePart) { vec=pCurJg->End()-pCurJg->Start(); normalize(vec); //计算拾取的起始脚钉在角钢楞线上的投影 int wingx0_y1=0; pCurJg->GetBoltIntersPos(pStartBolt,start,&wingx0_y1); X0_OR_Y1_WING=!wingx0_y1; SnapPerp(&start,pCurJg->Start(),pCurJg->End(),start); //start=pCurJg->Start()+((start-pCurJg->Start())*vec)*vec; if(bDownToUp&&vec.z<=0) { start_handle = pCurJg->pEnd->handle; end=pCurJg->End()+vec*pCurJg->endOdd(); extra_dist=(pCurJg->Start()-vec*pCurJg->startOdd()-start)*vec; if(fabs(prev_odd)>EPS) overlap_length=prev_odd+pCurJg->startOdd(); else overlap_length=0.0; prev_odd=pCurJg->endOdd(); } else if(bDownToUp&&vec.z>0) { vec*=-1.0; //调转至终->始 start_handle = pCurJg->pStart->handle; end=pCurJg->Start()+vec*pCurJg->startOdd(); extra_dist=(pCurJg->End()-vec*pCurJg->endOdd()-start)*vec; if(fabs(prev_odd)>EPS) overlap_length=prev_odd+pCurJg->endOdd(); else overlap_length=0.0; prev_odd=pCurJg->startOdd(); } else if(!bDownToUp&&vec.z>=0) { start_handle = pCurJg->pEnd->handle; end=pCurJg->End()+vec*pCurJg->endOdd(); extra_dist=(pCurJg->Start()-vec*pCurJg->startOdd()-start)*vec; if(fabs(prev_odd)>EPS) overlap_length=prev_odd+pCurJg->startOdd(); else overlap_length=0.0; prev_odd=pCurJg->endOdd(); } else if(!bDownToUp&&vec.z<0) { vec*=-1.0; //调转至终->始 start_handle = pCurJg->pStart->handle; end=pCurJg->Start()+vec*pCurJg->startOdd(); extra_dist=(pCurJg->End()-vec*pCurJg->endOdd()-start)*vec; if(fabs(prev_odd)>EPS) overlap_length=prev_odd+pCurJg->endOdd(); else overlap_length=0.0; prev_odd=pCurJg->startOdd(); } else logerr.Log("error"); } else if((pCurJg->pEnd&&pCurJg->pEnd->handle==start_handle)||pCurJg->pEnd==NULL) { //在短角钢上布置脚钉时由终端==>始端布置 wht 09-12-03 start = pCurJg->End(); end = pCurJg->Start(); vec=end-start; normalize(vec); if(pCurJg->pStart) start_handle = pCurJg->pStart->handle; Sub_Pnt(start,start,vec*pCurJg->endOdd()); Add_Pnt(end,end,vec*pCurJg->startOdd()); if(fabs(prev_odd)>EPS) overlap_length=prev_odd+pCurJg->endOdd(); else overlap_length=0.0; prev_odd=pCurJg->startOdd(); } else if((pCurJg->pStart&&pCurJg->pStart->handle==start_handle)||pCurJg->pStart==NULL) { start = pCurJg->Start(); end = pCurJg->End(); vec=end-start; normalize(vec); if(pCurJg->pEnd) start_handle = pCurJg->pEnd->handle; Sub_Pnt(start,start,vec*pCurJg->startOdd()); Add_Pnt(end,end,vec*pCurJg->endOdd()); if(fabs(prev_odd)>EPS) overlap_length=prev_odd+pCurJg->startOdd(); else overlap_length=0.0; prev_odd=pCurJg->endOdd(); } dist = pCurJg->GetLength(); wing_x_vec = pCurJg->GetWingVecX(); wing_y_vec = pCurJg->GetWingVecY(); wing_wide = pCurJg->GetWidth(); wing_thick = pCurJg->GetThick(); getjgzj(jgzj,pCurJg->GetWidth()); if(!pCurJg->m_bEnableTeG) pCurJg->xWingXZhunJu = pCurJg->xWingYZhunJu = jgzj; ls.m_hFamily= CLsLibrary::GetFootNailFamily();//脚钉 used_dist = 0; //预判当前杆件剩余长度是否足够布置下一个脚钉 wht 15-08-13 if(g_sysPara.FootNailDist>dist+extra_dist) { fPreRodRemainingLen=dist+extra_dist; continue; } while(1) { naildlg.InitState(pCurJg->handle,dist+extra_dist-used_dist,dist,used_dist); naildlg.m_iLayWing = X0_OR_Y1_WING; naildlg.m_pRod=pCurJg; naildlg.m_xDatumStart=start; naildlg.m_xDatumLenVec=vec; if(fPreRodRemainingLen>0) { naildlg.m_fPreRodRemainingLen=fPreRodRemainingLen; fPreRodRemainingLen=0; } else naildlg.m_fPreRodRemainingLen=0; //if(odd_dist==0) { naildlg.wing_wide=ftol(pCurJg->GetWidth()); naildlg.xWingXZhunJu=pCurJg->xWingXZhunJu; naildlg.xWingYZhunJu=pCurJg->xWingYZhunJu; naildlg.m_bEnableTeG=pCurJg->m_bEnableTeG; if(pCurJg->m_bFootNail) //角钢脚钉 { naildlg.m_nNailSpace=30; naildlg.m_iLayWing=1; //Y肢 } if(naildlg.DoModal()!=IDOK) goto end; used_dist+=(naildlg.m_nNailSpace-naildlg.m_fPreRodRemainingLen); X0_OR_Y1_WING = naildlg.m_iLayWing; } //else //上次有剩余 // used_dist = odd_dist; used_dist+=overlap_length; overlap_length=0.0; //考虑重叠部分尺寸一次后清掉重叠尺寸 //布置角钢上的脚钉时odd_dist变量弃用 //弹出对话框点击确定后再判断当前角钢是否足够布置下一颗脚钉,会导致本次布置脚钉失效 //应在开始布置当前角钢第一颗脚钉和布置完每一颗脚钉后预判当前角钢剩余长度是否足够布置下一颗脚钉 wht 15-08-13 /*if(used_dist>dist+extra_dist) { odd_dist = used_dist-dist-extra_dist; break; }*/ //if(fabs(odd_dist)<EPS) //上次设计没有剩余值 Add_Pnt(ls_pos,start,vec*ftol(used_dist)); //else //上次设计时有剩余值 //{ // Add_Pnt(ls_pos,start,vec*ftol(odd_dist)); // odd_dist = 0.0; //} restore_Ls_guige(naildlg.m_sNailGuiGe,ls); if(!X0_OR_Y1_WING) //X肢上的脚钉 { Add_Pnt(ls_pos,ls_pos,wing_x_vec*naildlg.m_nGDist); ls.set_norm(pCurJg->get_norm_x_wing()); if(naildlg.m_bShiftWing) X0_OR_Y1_WING = !X0_OR_Y1_WING; //XY肢互相间隔 } else //Y肢上的脚钉 { Add_Pnt(ls_pos,ls_pos,wing_y_vec*naildlg.m_nGDist); ls.set_norm(pCurJg->get_norm_y_wing()); if(naildlg.m_bShiftWing) X0_OR_Y1_WING = !X0_OR_Y1_WING; //XY肢互相间隔 } //螺栓设计信息填充 ls_pos=ls_pos-ls.get_norm()*pCurJg->GetThick(); // sprintf(ls.des_base_pos.norm_offset.key_str,"-0X%X",pCurJg->handle); ls.EmptyL0DesignPara(); //清空螺栓通厚参数 ls.AddL0Thick(pCurJg->handle,TRUE,TRUE); //ls.L0 = pCurJg->GetThick(); //ls.des_base_pos.bDatumPointInUcs=TRUE; ls.des_base_pos.datumPoint.datum_pos_style=1; //角钢上端楞点为基准 ls.des_base_pos.datumPoint.des_para.RODEND.hRod=pCurJg->handle; ls.des_base_pos.datumPoint.des_para.RODEND.bIncOddEffect=TRUE; ls.des_base_pos.hPart = pCurJg->handle; f3dPoint perp; SnapPerp(&perp,start,end,ls_pos); //TODO:这里可能还存在问题,在最简单的接头间隙处一端10,一端-50,当overlap_length=-10,此值为10 wjh-2016.11.9 double offset_dist = DISTANCE(perp,start)-extra_dist; //if(pCurJg==(CLDSLineAngle*)pFirstLinePart&&!nail_start.IsZero()) // offset_dist = DISTANCE(perp,nail_start);//当第一根角钢有脚钉的时候特殊处理 //if(nflag==0&&!nail_start.IsZero()) //{ // dist -=offset_dist; // nflag =1; //} if(pCurJg->pStart&&pCurJg->pStart->handle==old_start_handle) ls.des_base_pos.direction=0; else ls.des_base_pos.direction=1; ls.des_base_pos.len_offset_dist=ftoi(offset_dist); ls.des_base_pos.wing_offset_dist=naildlg.m_nGDist; ls.des_base_pos.datumPoint.des_para.RODEND.direction=ls.des_base_pos.direction; ls.des_base_pos.datumPoint.des_para.RODEND.wing_offset_dist=0; ls.des_base_pos.datumPoint.des_para.RODEND.wing_offset_style=4; if(naildlg.m_bShiftWing) { ls.des_base_pos.datumPoint.des_para.RODEND.offset_wing=!X0_OR_Y1_WING; ls.des_base_pos.offset_wing = !X0_OR_Y1_WING; ls.des_work_norm.norm_wing=!X0_OR_Y1_WING; } else { ls.des_base_pos.datumPoint.des_para.RODEND.offset_wing=X0_OR_Y1_WING; ls.des_base_pos.offset_wing = X0_OR_Y1_WING; ls.des_work_norm.norm_wing=X0_OR_Y1_WING; } if(ls.des_work_norm.norm_wing==0) { if(ls.get_norm()*pCurJg->get_norm_x_wing()>0) ls.des_work_norm.direction=0; else ls.des_work_norm.direction=1; } else { if(ls.get_norm()*pCurJg->get_norm_y_wing()>0) ls.des_work_norm.direction=0; else ls.des_work_norm.direction=1; } ls.des_work_norm.norm_style=1; ls.des_work_norm.hVicePart = pCurJg->handle; ls.SetBelongModel(console.GetActiveModel()); ls.correct_worknorm(); ls.correct_pos(); ls_pos=ls.ucs.origin; //是否与已设计过的螺栓距离较近 CLDSBolt *pNearBolt=naildlg.m_pMergeBolt;//NULL; //for(CLsRef* pLsRef=pCurJg->GetFirstLsRef();pLsRef!=NULL;pLsRef=pCurJg->GetNextLsRef()) //{//EPS_COS2误差系数还是太大所以在原先基础上再减去0.03 // if(fabs(ls.get_norm()*(*pLsRef)->get_norm())<EPS_COS2-0.03) // continue; // f3dPoint basePt = (*pLsRef)->ucs.origin; // project_point(basePt,ls_pos,ls.get_norm()); // if(DISTANCE(ls_pos,basePt)<g_sysPara.fNailRepScope) // { // pNearBolt = pLsRef->GetLsPtr(); // break; // } //} if(pNearBolt==NULL) { pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls,false); pLs->layer(0)=pCurJg->Layer(0); pLs->cfgword=pCurJg->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->iSeg=pCurJg->iSeg; pLs->des_base_pos=ls.des_base_pos; pLs->des_work_norm=ls.des_work_norm; pLs->ucs.origin=ls_pos; //将螺栓引入到角钢 wht 11-01-14 pCurJg->AppendMidLsRef(pLs->GetLsRef()); CLDSGroupLineAngle *pGroupJg=NULL; pGroupJg=(CLDSGroupLineAngle*)console.FromPartHandle(pCurJg->group_father_jg_h,CLS_GROUPLINEANGLE); if(pGroupJg) { //当前角钢为组合角钢子角钢 for(int i=0;i<4;i++) { if(pGroupJg->son_jg_h[i]==pCurJg->handle) continue; CLDSLineAngle *pSonAngle=NULL; if(pGroupJg->son_jg_h[i]>0x20) pSonAngle=(CLDSLineAngle*)console.FromPartHandle(pGroupJg->son_jg_h[i],CLS_LINEANGLE); if(pSonAngle==NULL||pSonAngle->m_bVirtualPart) continue; //不存在对应的子角钢或子角钢为虚拟构件 wht 11-07-25 if(pSonAngle->IsLsInWing(pLs))//螺栓在子角钢上可以引入 { pSonAngle->AppendMidLsRef(pLs->GetLsRef()); pLs->AddL0Thick(pSonAngle->handle,TRUE); //子角钢 //脚钉穿过两根子角钢时,需要对脚钉设计垫板,保证其受力 wxc-2017.7.14 BOLTSET boltset; boltset.append(pLs); int thick=ftoi(pGroupJg->jg_space-g_sysPara.m_nGroupJgMachiningGap); CLDSPlate* pBoltPad=DesignBoltPad(pCurJg,NULL,boltset,thick,g_sysPara.m_nGroupJgMachiningGap*0.5); if(pBoltPad) { if(sBoltPadPartNo.GetLength()<=0) { CInputAnStringValDlg inputStrDlg; inputStrDlg.m_sItemTitle="输入脚钉垫板编号:"; if(inputStrDlg.DoModal()==IDOK) sBoltPadPartNo.Copy(inputStrDlg.m_sItemValue); } pBoltPad->SetPartNo(sBoltPadPartNo); pLs->AddL0Thick(ftoi(g_sysPara.m_nGroupJgMachiningGap));//组合角钢加工间隙 } else pLs->AddL0Thick(ftoi(pGroupJg->jg_space)); //角钢间隙 break; } } } pLs->CalGuigeAuto(); pLs->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pLs->GetSolidPartObject()); g_pSolidDraw->Draw(); } else { //保存原螺栓的有效长度 pNearBolt->set_oldL(ftoi(pNearBolt->L)); if(pNearBolt->get_d()==16) pNearBolt->set_L(180); else if(pNearBolt->get_d()==20) pNearBolt->set_L(200); else if(pNearBolt->get_d()==24) pNearBolt->set_L(240); else pNearBolt->set_L(ls.get_L()); pNearBolt->m_hFamily = CLsLibrary::GetFootNailFamily(); pNearBolt->CalGuigeAuto(); pNearBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pNearBolt->GetSolidPartObject()); g_pSolidDraw->Draw(); } //预判当前杆件剩余长度是否足够布置下一个脚钉 wht 15-08-13 double pre_used_dist=used_dist+g_sysPara.FootNailDist; if(pre_used_dist>dist+extra_dist) { fPreRodRemainingLen=(dist+extra_dist)-used_dist; break; } Ta.EndUndoListen(); } g_pSolidDraw->SetEntSnapStatus(pCurJg->handle,FALSE); } } else if(pFirstLinePart->GetClassTypeId()==CLS_LINETUBE) { BOOL bFirst=TRUE; static CDesignFootNailPlateDlg angle_dlg; CLDSLineAngle *pLineAngle=NULL; CLDSLineSlot *pLineSlot = NULL,*pLineSlot2 = NULL; long hFirstLineSlot=NULL; //标准脚钉板 naildlg.m_iLineType = 1; //杆件类型为钢管 //查找指定钢管上的脚钉 CLDSPart* pFootNail=NULL; ATOM_LIST<CLDSLinePart*> nailRodList; for(CLDSLinePart* pRod=console.EnumRodFirst();pRod;pRod=console.EnumRodNext()) { if(pRod->GetClassTypeId()==CLS_LINESLOT) { CLDSLineSlot* pSlot=(CLDSLineSlot*)pRod; if(pSlot->pStart!=NULL || pSlot->pEnd!=NULL) continue; if(pSlot->GetLsRefList()->GetNodeNum()!=1) continue; if(pSlot->m_hPartWeldParent!=pFirstLinePart->handle && pSlot->hAttachTube!=pFirstLinePart->handle) continue; nailRodList.append(pSlot); } else if(pRod->GetClassTypeId()==CLS_LINEANGLE) { CLDSLineAngle* pAngle=(CLDSLineAngle*)pRod; if(!pAngle->m_bFootNail) continue; if(pAngle->m_hPartWeldParent!=pFirstLinePart->handle) continue; nailRodList.append(pRod); } else continue; } //布置钢管脚钉 for(CLDSLineTube *pCurTube=(CLDSLineTube*)partset.GetFirst();pCurTube!=NULL;pCurTube=(CLDSLineTube*)partset.GetNext()) { pCurTube->BuildUCS(); g_pSolidDraw->SetEntSnapStatus(pCurTube->handle,TRUE); CLDSPart* pStartNail=NULL; if(pCurTube==(CLDSLineTube*)pFirstLinePart) { for(CLDSLinePart** ppRod=nailRodList.GetFirst();ppRod;ppRod=nailRodList.GetNext()) { if(pStartNail==NULL) pStartNail=(*ppRod); if(bDownToUp) { if((*ppRod)->ucs.origin.z<pStartNail->ucs.origin.z) pStartNail=(*ppRod); } else if((*ppRod)->ucs.origin.z>pStartNail->ucs.origin.z) pStartNail=(*ppRod); } //如果有脚钉的话,设置起始脚钉 #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Please select start climbing nails and press return key, none nails type 'N' key:",""); #else pCmdLine->FillCmdLine("请选择起始脚钉回车,无起始脚钉[N]:",""); #endif g_pSolidSet->SetDisplayType(DISP_SOLID); g_pSolidSnap->SetSelectPartsType(GetSingleWord(SELECTINDEX_BOLT)); g_pSolidDraw->ReleaseSnapStatus(); if(pStartNail) { g_pSolidDraw->SetEntSnapStatus(pStartNail->handle); //将脚钉位置放大显示 SCOPE_STRU scope; scope.VerifyVertex(pStartNail->ucs.origin); scope.fMinX-=150; scope.fMaxX+=150; scope.fMinY-=150; scope.fMaxY+=150; scope.fMinZ-=150; scope.fMaxZ+=150; g_pSolidOper->FocusTo(scope,0.2); } if(!pCmdLine->GetStrFromCmdLine(cmdStr,CCmdLineDlg::KEYWORD_AS_RETURN,"N")) { pCmdLine->CancelCmdLine(); return 0; } long *id_arr=NULL; int n = g_pSolidSnap->GetLastSelectEnts(id_arr); if(cmdStr.CompareNoCase("N")==0||n!=1) pStartNail=NULL; else if(n==1) { CLDSPart *pSelectedPart=(CLDSBolt*)console.FromPartHandle(id_arr[0]); if(pSelectedPart) pStartNail=pSelectedPart; } } else extra_dist=0; long old_start_handle=start_handle; pCurTube->BuildUCS(); f3dPoint axis_z=pCurTube->End()-pCurTube->Start(); if(pStartNail&&pCurTube==pFirstLinePart) { f3dPoint nail_norm; nail_norm=pStartNail->ucs.axis_z; start=pStartNail->ucs.origin; if(pStartNail->GetClassTypeId()==CLS_LINESLOT) { CLDSLineSlot* pSlot=(CLDSLineSlot*)pStartNail; pSlot->BuildUCS(); nail_norm=pSlot->WorkPlaneNorm(); hFirstLineSlot=pSlot->handle; //此时pStartNail不一定是脚钉,槽钢原点已不是中心点 wjh-2015.9.1 start=pSlot->desDatumPoint.Position(); } else if(pStartNail->GetClassTypeId()==CLS_LINEANGLE) { CLDSLineAngle* pAngle=(CLDSLineAngle*)pStartNail; hFirstLineSlot=pAngle->handle; start=pAngle->Start(); } //TODO:应进行定量计算旋转定位角度 if(fabs(nail_norm*pCurTube->ucs.axis_x)>EPS_COS2) X0_OR_Y1_WING=TRUE; else X0_OR_Y1_WING=FALSE; vec=pCurTube->End()-pCurTube->Start(); normalize(vec); SnapPerp(&start,pCurTube->Start(),pCurTube->End(),start); if((bDownToUp&&vec.z<=0) || (!bDownToUp&&vec.z>=0)) { start_handle = pCurTube->pEnd->handle; end=pCurTube->End()+vec*pCurTube->endOdd(); extra_dist=(pCurTube->Start()-vec*pCurTube->startOdd()-start)*vec; if(fabs(prev_odd)>EPS) overlap_length=prev_odd+pCurTube->startOdd(); else overlap_length=0.0; prev_odd=pCurTube->endOdd(); } else //if((bDownToUp&&vec.z>0) || (!bDownToUp&&vec.z<0)) { vec*=-1.0; //调转至终->始 start_handle = pCurTube->pStart->handle; end=pCurTube->Start()+vec*pCurTube->startOdd(); extra_dist=(pCurTube->End()-vec*pCurTube->endOdd()-start)*vec; if(fabs(prev_odd)>EPS) overlap_length=prev_odd+pCurTube->endOdd(); else overlap_length=0.0; prev_odd=pCurTube->startOdd(); } } else if(pCurTube->pEnd->handle==start_handle) { start = pCurTube->End(); end = pCurTube->Start(); start_handle = pCurTube->pStart->handle; Sub_Pnt(vec,end,start); normalize(vec); Sub_Pnt(start,start,vec*pCurTube->endOdd()); Add_Pnt(end,end,vec*pCurTube->startOdd()); if(fabs(prev_odd)>EPS) overlap_length=prev_odd+pCurTube->endOdd(); else overlap_length=0.0; prev_odd=pCurTube->startOdd(); } else { start = pCurTube->Start(); end = pCurTube->End(); start_handle = pCurTube->pEnd->handle; Sub_Pnt(vec,end,start); normalize(vec); Sub_Pnt(start,start,vec*pCurTube->startOdd()); Add_Pnt(end,end,vec*pCurTube->endOdd()); if(fabs(prev_odd)>EPS) overlap_length=prev_odd+pCurTube->startOdd(); else overlap_length=0.0; prev_odd=pCurTube->endOdd(); } dist = pCurTube->GetLength(); ls.m_hFamily= CLsLibrary::GetFootNailFamily();//脚钉 used_dist = 0; naildlg.m_pRod=pCurTube; while(1) { naildlg.m_iLayWing=X0_OR_Y1_WING; naildlg.m_bHasWeldRoad=pCurTube->m_bHasWeldRoad;//基准钢管是否存在焊道线 naildlg.m_xDatumStart=start; naildlg.m_xDatumLenVec=vec; naildlg.hFirstLineSlot=hFirstLineSlot; naildlg.InitState(pCurTube->handle,dist+extra_dist-used_dist,dist,used_dist,naildlg.m_fNailAngle,naildlg.m_fNailAngle2); if(odd_dist==0) { if(naildlg.DoModal()!=IDOK) goto end; used_dist+=naildlg.m_nNailSpace; } else //上次有剩余 used_dist = odd_dist; if(fabs(naildlg.m_fCurNailAngle-naildlg.m_fNailAngle-naildlg.m_fNailAngle2)<1) X0_OR_Y1_WING=1; else X0_OR_Y1_WING=0; if(naildlg.m_iNailType==0) //布置槽钢类型的脚钉板 { //第一次添件脚钉连接板的时候弹出设置对话框 以后不再弹出 restore_Ls_guige(naildlg.m_sNailGuiGe,ls); pLineSlot = (CLDSLineSlot*)console.AppendPart(CLS_LINESLOT); pLineSlot->m_hPartWeldParent = pCurTube->handle; CLDSLineSlot *pStandardFootNailPlate = (CLDSLineSlot*)console.FromPartHandle(hFirstLineSlot,CLS_LINESLOT); if(pStandardFootNailPlate==NULL) { pLineSlot->CopyProperty(&naildlg.xNailSlot); //TODO:pLineSlot->feature赋值,代码不够规范 wjh-2015.9.1 pLineSlot->feature=naildlg.xNailSlot.feature; hFirstLineSlot=pLineSlot->handle; } else { pLineSlot->CopyProperty(pStandardFootNailPlate); pLineSlot->feature=pStandardFootNailPlate->feature; //脚钉的长度 } //必须置于pLineSlot->CopyProperty(pStandardFootNailPlate)之后,否则属性会被冲掉 wjh-2015.9.1 pLineSlot->CopyModuleInstanceInfo(pCurTube); f3dPoint workNorm=pCurTube->ucs.axis_x; double rotangle=naildlg.m_fCurNailAngle*RADTODEG_COEF; if(naildlg.m_iDatumLine==1) //自焊缝线起始旋转 rotangle+=pCurTube->CalWeldRoadAngle(); RotateVectorAroundVector(workNorm,rotangle,axis_z); pLineSlot->m_iNormCalStyle=0; //直接指定槽钢工作面法线 pLineSlot->SetWorkPlaneNorm(workNorm); pLineSlot->ucs.axis_y=-workNorm; pLineSlot->ucs.axis_z = -pCurTube->ucs.axis_z; normalize(pLineSlot->ucs.axis_z); //RotateVectorAroundVector(pLineSlot->ucs.axis_y,cur_angle,axis_z);//pCurTube->ucs.axis_z); pLineSlot->ucs.axis_x=pLineSlot->ucs.axis_y^pLineSlot->ucs.axis_z; normalize(pLineSlot->ucs.axis_x); if(naildlg.m_bDualSide) { //双侧布脚钉 pLineSlot2 = (CLDSLineSlot*)console.AppendPart(CLS_LINESLOT); pLineSlot2->m_hPartWeldParent = pCurTube->handle; pLineSlot2->CopyProperty(pLineSlot); pLineSlot2->feature=pLineSlot->feature; //必须置于pLineSlot->CopyProperty(pStandardFootNailPlate)之后,否则属性会被冲掉 wjh-2015.9.1 pLineSlot2->CopyModuleInstanceInfo(pCurTube); f3dPoint workNorm=pCurTube->ucs.axis_x; double rotangle=naildlg.m_fCurNailAngle2*RADTODEG_COEF; if(naildlg.m_iDatumLine==1) //自焊缝线起始旋转 rotangle+=pCurTube->CalWeldRoadAngle(); RotateVectorAroundVector(workNorm,rotangle,axis_z); pLineSlot2->m_iNormCalStyle=0; //直接指定槽钢工作面法线 pLineSlot2->SetWorkPlaneNorm(workNorm); pLineSlot2->ucs.axis_y=-workNorm; pLineSlot2->ucs.axis_z = -pCurTube->ucs.axis_z; normalize(pLineSlot2->ucs.axis_z); pLineSlot2->ucs.axis_x=pLineSlot2->ucs.axis_y^pLineSlot2->ucs.axis_z; normalize(pLineSlot2->ucs.axis_x); } else pLineSlot2 = NULL; } else //布置角钢 { double wing_wide=0,wing_thick=0; pLineAngle=(CLDSLineAngle*)console.AppendPart(CLS_LINEANGLE); pLineAngle->m_bFootNail=TRUE;//表示该角钢为脚钉 pLineAngle->CopyModuleInstanceInfo(pCurTube); pLineAngle->ucs.axis_z=pCurTube->ucs.axis_x; double rot_angle=pCurTube->CalWeldRoadAngle(); if(naildlg.m_iDatumLine==1) //以基准边为基准还是以焊道线为基准 RotateVectorAroundVector(pLineAngle->ucs.axis_z,rot_angle,axis_z); pLineAngle->ucs.axis_x=axis_z; normalize(pLineAngle->ucs.axis_x); pLineAngle->ucs.axis_y=pLineAngle->ucs.axis_z^pLineAngle->ucs.axis_x; normalize(pLineAngle->ucs.axis_y); pLineAngle->ucs.axis_z=pLineAngle->ucs.axis_x^pLineAngle->ucs.axis_y; normalize(pLineAngle->ucs.axis_z); pLineAngle->m_hPartWeldParent=pCurTube->handle; CLDSLineAngle *pStandardFootNailAngle = (CLDSLineAngle*)console.FromPartHandle(hFirstLineSlot,CLS_LINEANGLE); if(pStandardFootNailAngle==NULL) { pLineAngle->CopyProperty(&naildlg.xNailAngle); //TODO:pLineSlot->feature赋值,代码不够规范 wjh-2015.9.1 angle_dlg.m_fParamL=pLineAngle->feature=naildlg.xNailAngle.feature;//angle_dlg.xNailAngle.feature; hFirstLineSlot=pLineAngle->handle; } else { pLineAngle->CopyProperty(pStandardFootNailAngle); angle_dlg.m_fParamL=pLineAngle->feature=pStandardFootNailAngle->feature; //脚钉的长度 } /*angle_dlg.m_pLineTube=pCurTube; angle_dlg.part_type=1; //防坠角钢 if(bFirst) { if(angle_dlg.DoModal()!=IDOK) return 0; bFirst=FALSE; }*/ pLineAngle->cMaterial = CSteelMatLibrary::RecordAt(angle_dlg.m_iMaterial).cBriefMark; pLineAngle->iSeg = SEGI(angle_dlg.m_sSegNo.GetBuffer()); pLineAngle->SetPartNo(angle_dlg.m_sPartNo.GetBuffer()); restore_JG_guige(angle_dlg.m_sGuiGe.GetBuffer(),wing_wide,wing_thick); pLineAngle->set_wing_thick(wing_thick); pLineAngle->set_wing_wide(wing_wide); } f3dPoint line_vec=pCurTube->End()-pCurTube->Start(); normalize(line_vec); //if(bDownToUp) //脚钉自下向上布置 //{ // if(pCurTube->pStart->Position(false).z>pCurTube->pEnd->Position(false).z) // pCurTube->ucs.origin = pCurTube->Start()-line_vec*pCurTube->startOdd(); // else //起始点高,终止点低 // pCurTube->ucs.origin = pCurTube->End()+line_vec*pCurTube->endOdd(); //} //else //if(!bDownToUp) //脚钉自上向下布置 //{ // if(pCurTube->pStart->Position(false).z>pCurTube->pEnd->Position(false).z) // pCurTube->ucs.origin = pCurTube->End()+line_vec*pCurTube->endOdd(); // else //起始点高,终止点低 // pCurTube->ucs.origin = pCurTube->Start()-line_vec*pCurTube->startOdd(); //} double cur_angle=naildlg.m_fCurNailAngle*RADTODEG_COEF; used_dist+=overlap_length; overlap_length=0.0; //考虑重叠部分尺寸一次后清掉重叠尺寸 if(used_dist>dist) { odd_dist = used_dist-dist; long handle=0; if(naildlg.m_iNailType==0) //槽钢 handle=pLineSlot->handle; else //角钢 handle=pLineAngle->handle; console.DispPartSet.DeleteNode(handle); console.DeletePart(handle); break; } if(naildlg.m_iNailType==0) //槽钢 { //计算脚钉板坐标系原点位置 double H = pLineSlot->GetHeight(); //槽钢底边宽度 double W = pLineSlot->GetWidth(); //槽钢肢宽 double T = pLineSlot->GetThick(); double dist = sqrt(SQR(0.5*pCurTube->GetDiameter())-SQR(0.5*H-T)); pLineSlot->ucs.origin = start-pLineSlot->ucs.axis_y*(dist+W)-pLineSlot->ucs.axis_z*(pLineSlot->feature*0.5); if(pLineSlot2) pLineSlot2->ucs.origin = start-pLineSlot2->ucs.axis_y*(dist+W)-pLineSlot2->ucs.axis_z*(pLineSlot2->feature*0.5); } else //角钢 { RotateVectorAroundVector(pLineAngle->ucs.axis_z,cur_angle,axis_z); pLineAngle->ucs.axis_y=pLineAngle->ucs.axis_z^pLineAngle->ucs.axis_x; normalize(pLineAngle->ucs.axis_y); pLineAngle->ucs.axis_z=pLineAngle->ucs.axis_x^pLineAngle->ucs.axis_y; normalize(pLineAngle->ucs.axis_z); pLineAngle->ucs.origin = start; } if(naildlg.m_bShiftWing) //脚钉交替布置 X0_OR_Y1_WING = !X0_OR_Y1_WING; if(fabs(odd_dist)<EPS) //上次设计没有剩余值 { if(naildlg.m_iNailType==0) //槽钢 { Add_Pnt(pLineSlot->ucs.origin, pLineSlot->ucs.origin, vec*ftol(used_dist)); if(pLineSlot2) Add_Pnt(pLineSlot2->ucs.origin, pLineSlot2->ucs.origin, vec*ftol(used_dist)); } else //角钢 Add_Pnt(pLineAngle->ucs.origin, pLineAngle->ucs.origin, vec*ftol(used_dist));; } else //上次设计时有剩余值 { if(naildlg.m_iNailType==0) //槽钢 { Add_Pnt(pLineSlot->ucs.origin, pLineSlot->ucs.origin,vec*ftol(odd_dist)); if(pLineSlot2) Add_Pnt(pLineSlot2->ucs.origin, pLineSlot2->ucs.origin,vec*ftol(odd_dist)); } else //角钢 Add_Pnt(pLineAngle->ucs.origin, pLineAngle->ucs.origin,vec*ftol(odd_dist));; odd_dist = 0.0; } if(naildlg.m_iNailType==0) //槽钢 { //脚钉板基本信息 f3dPoint datumStartPos,datumLenVec,pt=start+vec*ftol(used_dist);//-pLineSlot->ucs.axis_z*pLineSlot->feature*0.5; pt+=pLineSlot->WorkPlaneNorm()*pCurTube->GetDiameter()*0.5; pLineSlot->desDatumPoint.SetPosition(pt); //设定脚钉槽钢底座的参数化定位信息 pLineSlot->hAttachTube=pCurTube->handle; pLineSlot->desDatumPoint.datum_pos_style=11;//柱面定位点 pLineSlot->desDatumPoint.des_para.COLUMN_INTERS.hLineTube=pCurTube->handle; pLineSlot->desDatumPoint.des_para.COLUMN_INTERS.cPointAndVectorFlag|=0x02; pLineSlot->desDatumPoint.des_para.COLUMN_INTERS.bSpecRo=FALSE; if((bDownToUp &&pCurTube->pStart->Position('Z')>pCurTube->pEnd->Position('Z')) || //脚钉自下向上布置 (!bDownToUp&&pCurTube->pStart->Position('Z')<pCurTube->pEnd->Position('Z'))) //脚钉自上向下布置 { pLineSlot->desDatumPoint.des_para.COLUMN_INTERS.SectCenterParam.hNode=pCurTube->pStart->handle; datumStartPos=pCurTube->GetDatumPos(pCurTube->pStart); datumLenVec=pCurTube->End()-pCurTube->Start(); } else { pLineSlot->desDatumPoint.des_para.COLUMN_INTERS.SectCenterParam.hNode=-pCurTube->pEnd->handle; datumStartPos=pCurTube->GetDatumPos(pCurTube->pEnd); datumLenVec=pCurTube->Start()-pCurTube->End(); } normalize(datumLenVec); pLineSlot->desDatumPoint.des_para.COLUMN_INTERS.SectCenterParam.len_offset=(pt-datumStartPos)*datumLenVec; if(naildlg.m_bHorizonSlotNail) //水平布置脚钉槽钢底座 { f3dPoint verify_vec=pt-datumStartPos; f3dPoint verify_vec2=(verify_vec^datumLenVec)^datumLenVec; normalize(verify_vec2); if(verify_vec*verify_vec2>0) pLineSlot->desDatumPoint.des_para.COLUMN_INTERS.RayVector.ray_vec= verify_vec2; else pLineSlot->desDatumPoint.des_para.COLUMN_INTERS.RayVector.ray_vec=-verify_vec2; pLineSlot->desDatumPoint.des_para.COLUMN_INTERS.ray_vec_style=4; pLineSlot->m_iNormCalStyle=2; } else if(naildlg.m_iDatumLine==0) //钢管基准边为旋转起始边 pLineSlot->desDatumPoint.des_para.COLUMN_INTERS.ray_vec_style=2; else if(naildlg.m_iDatumLine==1)//钢管焊道边为旋转起始边 pLineSlot->desDatumPoint.des_para.COLUMN_INTERS.ray_vec_style=3; pLineSlot->desDatumPoint.des_para.COLUMN_INTERS.ray_angle=naildlg.m_fCurNailAngle; pLineSlot->fLen=pLineSlot->feature; pLineSlot->CalTubeSlotPos(); //螺栓 //restore_Ls_guige(naildlg.m_sNailGuiGe,ls); Add_Pnt(ls_pos,pLineSlot->Start()+pLineSlot->ucs.axis_z*pLineSlot->feature*0.5,pLineSlot->ucs.axis_y*pLineSlot->GetThick()); ls.set_norm(-pLineSlot->ucs.axis_y); //螺栓位置设计信息填充 pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls,false); pLs->iSeg=pLineSlot->iSeg; pLs->layer(0)=pCurTube->Layer(0); pLs->cfgword=pLineSlot->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->AddL0Thick(pLineSlot->handle,TRUE); pLs->des_base_pos.hPart = pLineSlot->handle; pLs->des_base_pos.cLocationStyle=TRUE; pLs->des_base_pos.wing_offset_dist=0; pLs->des_base_pos.len_offset_dist=pLineSlot->feature*0.5; pLs->des_base_pos.norm_offset.AddThick(-pLineSlot->handle,TRUE); pLs->des_work_norm.norm_style=4; //基准构件上的相对方向 pLs->des_work_norm.nearVector.Set(0,-1,0); pLs->des_work_norm.hVicePart=pLineSlot->handle; pLs->ucs.origin=ls_pos; pLs->CalGuigeAuto(); pLs->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pLs->GetSolidPartObject()); if(pLineSlot->FindLsByHandle(pLs->handle)==NULL) pLineSlot->AppendMidLsRef(pLs->GetLsRef()); pLineSlot->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pLineSlot->GetSolidPartObject()); g_pSolidDraw->Draw(); if(pLineSlot2) { //f3dPoint datumStartPos,datumLenVec; pt=start+vec*ftol(used_dist);//-pLineSlot->ucs.axis_z*pLineSlot->feature*0.5; pt+=pLineSlot2->WorkPlaneNorm()*pCurTube->GetDiameter()*0.5; pLineSlot2->desDatumPoint.SetPosition(pt); //设定脚钉槽钢底座的参数化定位信息 pLineSlot2->hAttachTube=pCurTube->handle; pLineSlot2->desDatumPoint.datum_pos_style=11;//柱面定位点 pLineSlot2->desDatumPoint.des_para.COLUMN_INTERS.hLineTube=pCurTube->handle; pLineSlot2->desDatumPoint.des_para.COLUMN_INTERS.cPointAndVectorFlag|=0x02; pLineSlot2->desDatumPoint.des_para.COLUMN_INTERS.bSpecRo=FALSE; if((bDownToUp &&pCurTube->pStart->Position('Z')>pCurTube->pEnd->Position('Z')) || //脚钉自下向上布置 (!bDownToUp&&pCurTube->pStart->Position('Z')<pCurTube->pEnd->Position('Z'))) //脚钉自上向下布置 { pLineSlot2->desDatumPoint.des_para.COLUMN_INTERS.SectCenterParam.hNode=pCurTube->pStart->handle; datumStartPos=pCurTube->GetDatumPos(pCurTube->pStart); datumLenVec=pCurTube->End()-pCurTube->Start(); } else { pLineSlot2->desDatumPoint.des_para.COLUMN_INTERS.SectCenterParam.hNode=-pCurTube->pEnd->handle; datumStartPos=pCurTube->GetDatumPos(pCurTube->pEnd); datumLenVec=pCurTube->Start()-pCurTube->End(); } normalize(datumLenVec); pLineSlot2->desDatumPoint.des_para.COLUMN_INTERS.SectCenterParam.len_offset=(pt-datumStartPos)*datumLenVec; if(naildlg.m_bHorizonSlotNail) //水平布置脚钉槽钢底座 { f3dPoint verify_vec=pt-datumStartPos; f3dPoint verify_vec2=(verify_vec^datumLenVec)^datumLenVec; normalize(verify_vec2); if(verify_vec*verify_vec2>0) pLineSlot2->desDatumPoint.des_para.COLUMN_INTERS.RayVector.ray_vec= verify_vec2; else pLineSlot2->desDatumPoint.des_para.COLUMN_INTERS.RayVector.ray_vec=-verify_vec2; pLineSlot2->desDatumPoint.des_para.COLUMN_INTERS.ray_vec_style=4; pLineSlot2->m_iNormCalStyle=2; } else if(naildlg.m_iDatumLine==0) //钢管基准边为旋转起始边 pLineSlot2->desDatumPoint.des_para.COLUMN_INTERS.ray_vec_style=2; else if(naildlg.m_iDatumLine==1)//钢管焊道边为旋转起始边 pLineSlot2->desDatumPoint.des_para.COLUMN_INTERS.ray_vec_style=3; pLineSlot2->desDatumPoint.des_para.COLUMN_INTERS.ray_angle=naildlg.m_fCurNailAngle2; pLineSlot2->fLen=pLineSlot2->feature; pLineSlot2->CalTubeSlotPos(); //螺栓 //restore_Ls_guige(naildlg.m_sNailGuiGe,ls); Add_Pnt(ls_pos,pLineSlot2->Start()+pLineSlot2->ucs.axis_z*pLineSlot2->feature*0.5,pLineSlot2->ucs.axis_y*pLineSlot2->GetThick()); ls.set_norm(-pLineSlot2->ucs.axis_y); //螺栓位置设计信息填充 pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls,false); pLs->iSeg=pLineSlot->iSeg; pLs->layer(0)=pCurTube->Layer(0); pLs->cfgword=pLineSlot->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->AddL0Thick(pLineSlot2->handle,TRUE); pLs->des_base_pos.hPart = pLineSlot2->handle; pLs->des_base_pos.cLocationStyle=TRUE; pLs->des_base_pos.wing_offset_dist=0; pLs->des_base_pos.len_offset_dist=pLineSlot2->feature*0.5; pLs->des_base_pos.norm_offset.AddThick(-pLineSlot2->handle,TRUE); pLs->des_work_norm.norm_style=4; //基准构件上的相对方向 pLs->des_work_norm.nearVector.Set(0,-1,0); pLs->des_work_norm.hVicePart=pLineSlot2->handle; pLs->ucs.origin=ls_pos; pLs->CalGuigeAuto(); pLs->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pLs->GetSolidPartObject()); if(pLineSlot2->FindLsByHandle(pLs->handle)==NULL) pLineSlot2->AppendMidLsRef(pLs->GetLsRef()); pLineSlot2->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pLineSlot2->GetSolidPartObject()); g_pSolidDraw->Draw(); } } else //角钢 { pLineAngle->SetStartOdd(-pCurTube->GetDiameter()*0.5); GEPOINT xAngleStart=pLineAngle->ucs.origin; GEPOINT xAngleEnd =pLineAngle->ucs.origin+pLineAngle->ucs.axis_z*(angle_dlg.m_fParamL+pCurTube->GetDiameter()*0.5); pLineAngle->SetStart(xAngleStart); pLineAngle->SetEnd(xAngleEnd); pLineAngle->desStartPos.datumPoint.SetPosition(pLineAngle->Start()); pLineAngle->desEndPos.datumPoint.SetPosition(pLineAngle->End()); pLineAngle->des_norm_y.bSpecific=TRUE; pLineAngle->des_norm_y.spec_norm.vector=-pLineAngle->ucs.axis_x; pLineAngle->des_norm_x.bSpecific=FALSE; pLineAngle->des_norm_x.bByOtherWing=TRUE; //设置设终端位置后再设置法线方向 pLineAngle->set_norm_x_wing(-pLineAngle->ucs.axis_y); pLineAngle->set_norm_y_wing(-pLineAngle->ucs.axis_x); pLineAngle->cal_x_wing_norm(); pLineAngle->cal_y_wing_norm(); xAngleStart+=(pLineAngle->vxWingNorm+pLineAngle->vyWingNorm)*(pLineAngle->size_wide*0.5); xAngleEnd +=(pLineAngle->vxWingNorm+pLineAngle->vyWingNorm)*(pLineAngle->size_wide*0.5); pLineAngle->SetStart(xAngleStart); pLineAngle->SetEnd(xAngleEnd); pLineAngle->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pLineAngle->GetSolidPartObject()); g_pSolidDraw->Draw(); } Ta.EndUndoListen(); } g_pSolidDraw->SetEntSnapStatus(pCurTube->handle,FALSE); } } } catch(char *sError) { AfxMessageBox(sError); } end: m_pDoc->SetModifiedFlag(); // 修改数据后应调用此函数置修改标志. pCmdLine->FinishCmdLine(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Command:",""); #else pCmdLine->FillCmdLine("命令:",""); #endif return 0; } //布置脚踏板 int CLDSView::LayoutPedalPlate() { CCmdLockObject cmdlock(this); if (!cmdlock.LockSuccessed()) return FALSE; CCmdLineDlg *pCmdLine = ((CMainFrame*)AfxGetMainWnd())->GetCmdLinePage(); g_pSolidSet->SetDisplayType(DISP_SOLID); Invalidate(FALSE); g_pSolidDraw->ReleaseSnapStatus(); //确定脚踏板布置方式 CString cmdStr,valueStr; static char cToward = 'U'; #ifdef AFX_TARG_ENU_ENGLISH cmdStr.Format("Layout pedal plate[from up to down(D)/from down to up(U)]<%C>:", cToward); #else cmdStr.Format("布置脚踏板[自上而下(D)/自下而上(U)]<%C>:", cToward); #endif pCmdLine->FillCmdLine(cmdStr, ""); while (1) { if (!pCmdLine->GetStrFromCmdLine(valueStr, CCmdLineDlg::KEYWORD_AS_RETURN, "D|U")) { pCmdLine->CancelCmdLine(); return 0; } if (valueStr.CompareNoCase("d") == 0|| valueStr.CompareNoCase("D") == 0) cToward = toupper(valueStr[0]); else if (valueStr.CompareNoCase("u") == 0 || valueStr.CompareNoCase("U") == 0) cToward = toupper(valueStr[0]); else if (valueStr.GetLength() > 0) { pCmdLine->FinishCmdLine("关键字输入有误,请重新录入!"); pCmdLine->FillCmdLine(cmdStr, ""); continue; } break; } BOOL bDownToUp = (cToward == 'U') ? TRUE : FALSE; //选择待布置脚踏板的主材角钢 DWORD dwhObj = 0, dwExportFlag = 0; CSnapTypeVerify verifier(OBJPROVIDER::SOLIDSPACE, GetSingleWord(SELECTINDEX_LINEANGLE)); verifier.AddVerifyFlag(OBJPROVIDER::LINESPACE, SNAP_LINE); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Please select leg member which will layout pedal plate<Click empty to over>:", ""); #else pCmdLine->FillCmdLine("请依次选择要布置脚踏板的主材<空点鼠标左键结束选择>:", ""); #endif PARTSET partset; THANDLE hStart = 0, hCur = 0, hEnd = 0; CLDSLineAngle* pLastJg = NULL; while (1) { if (g_pSolidSnap->SnapObject(&dwhObj, &dwExportFlag, &verifier) < 0) { pCmdLine->CancelCmdLine(); return FALSE; } SELOBJ obj(dwhObj, dwExportFlag); dwhObj = obj.hRelaObj; if (dwhObj == 0 && obj.ciTriggerType == SELOBJ::TRIGGER_KEYRETURN) break; else if (dwhObj > 0) { CLDSLineAngle* pSelJg = (CLDSLineAngle*)console.FromPartHandle(dwhObj, CLS_LINEANGLE); if (pSelJg == NULL || pSelJg->pStart == NULL || pSelJg->pEnd == NULL) { #ifdef AFX_TARG_ENU_ENGLISH AfxMessageBox("Don't select effective rod!Please select again!"); #else AfxMessageBox("没有选择有效的杆件!请重新选择!"); #endif continue; } if (pLastJg != NULL && pLastJg == pSelJg) { #ifdef AFX_TARG_ENU_ENGLISH AfxMessageBox("Repeat to select the same leg member,Please select again!"); #else AfxMessageBox("重复选择了同一根主材,请重新选择!"); #endif continue; } if (pSelJg->pStart->handle == hEnd) hCur = pSelJg->pEnd->handle; else if (pSelJg->pEnd->handle == hEnd) hCur = pSelJg->pStart->handle; else if (hEnd != 0) { #ifdef AFX_TARG_ENU_ENGLISH AfxMessageBox("The selected rod has no connection with previous rod,Please select again!"); #else AfxMessageBox("所选杆件与上一杆件没有连接,请重新选择!"); #endif continue; } else if (bDownToUp) //自下向上布置 { if (pSelJg->pStart->Position(false).z > pSelJg->pEnd->Position(false).z) { hStart = pSelJg->pStart->handle; hCur = pSelJg->pEnd->handle; } else //起始点高,终止点低 { hStart = pSelJg->pEnd->handle; hCur = pSelJg->pStart->handle; } } else //if(!bDownToUp) //自上向下布置 { if (pSelJg->pStart->Position(false).z > pSelJg->pEnd->Position(false).z) { hStart = pSelJg->pEnd->handle; hCur = pSelJg->pStart->handle; } else //起始点高,终止点低 { hStart = pSelJg->pStart->handle; hCur = pSelJg->pEnd->handle; } } hEnd = hCur; pLastJg = pSelJg; partset.append(pSelJg); g_pSolidDraw->SetEntSnapStatus(pSelJg->handle, TRUE); } } if (partset.GetNodeNum() <= 0) { AfxMessageBox("没有选中待布置的角钢,设计失败!"); pCmdLine->CancelCmdLine(); return 0; } //选择起始脚踏板 CLDSLineAngle* pFirstJg = (CLDSLineAngle*)partset.GetFirst(); CLDSParamPlate* pStartPedalPlate = NULL; verifier.ClearSnapFlag(); verifier.SetVerifyFlag(OBJPROVIDER::SOLIDSPACE,GetSingleWord(SELECTINDEX_PARAMPLATE)); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Please select start climbing nails and press return key, none nails type 'N' key:", ""); #else pCmdLine->FillCmdLine("请选择起始脚踏板,没有按回车键:", ""); #endif while (1) { if (g_pSolidSnap->SnapObject(&dwhObj, &dwExportFlag, &verifier) < 0) { pCmdLine->CancelCmdLine(); return 0; } SELOBJ obj(dwhObj, dwExportFlag); dwhObj = obj.hRelaObj; if (dwhObj == 0 && obj.ciTriggerType == SELOBJ::TRIGGER_KEYRETURN) break; pStartPedalPlate = (CLDSParamPlate*)console.FromPartHandle(dwhObj, CLS_PARAMPLATE); if (pStartPedalPlate && pStartPedalPlate->m_iParamType == TYPE_PEDALPLATE) { long hBaseAngle = 0; pStartPedalPlate->GetDesignItemValue(KEY2C("A"), &hBaseAngle); if (pFirstJg->handle == hBaseAngle) break; } } if (pStartPedalPlate) { g_pSolidDraw->SetEntSnapStatus(pStartPedalPlate->handle); pCmdLine->FinishCmdLine(CXhChar16("0x%X", pStartPedalPlate->handle)); SCOPE_STRU scope; scope.VerifyVertex(pStartPedalPlate->ucs.origin); scope.fMinX -= 150; scope.fMaxX += 150; scope.fMinY -= 150; scope.fMaxY += 150; scope.fMinZ -= 150; scope.fMaxZ += 150; g_pSolidOper->FocusTo(scope, 0.2); } else pCmdLine->FinishCmdLine(); //布置脚踏板 CUndoOperObject undo(&Ta, true); f3dPoint view_norm= console.GetActiveView()->ucs.axis_z; double ddx = view_norm * pFirstJg->vxWingNorm; double ddy = view_norm * pFirstJg->vyWingNorm; BYTE ciWorkWing = (fabs(ddx) > fabs(ddy)) ? 0 : 1; double fPreOdd = 0, fPreRodRemainingLen = 0; for (CLDSLineAngle *pCurJg = (CLDSLineAngle*)partset.GetFirst(); pCurJg; pCurJg = (CLDSLineAngle*)partset.GetNext()) { g_pSolidDraw->SetEntSnapStatus(pCurJg->handle, TRUE); long hCurLineNode = hStart; f3dPoint line_vec = (pCurJg->End() - pCurJg->Start()).normalized(); f3dPoint line_ptS = pCurJg->Start() - line_vec * pCurJg->startOdd(); f3dPoint line_ptE = pCurJg->End() + line_vec * pCurJg->endOdd(); BYTE ciLinkS0E1 = (pCurJg->pStart->handle == hCurLineNode) ? 0 : 1; hStart = (ciLinkS0E1 == 0) ? pCurJg->pEnd->handle : pCurJg->pStart->handle; double fCurLinkOdd = (ciLinkS0E1 == 0) ? pCurJg->startOdd() : pCurJg->endOdd(); double fJointGap= (fabs(fPreOdd) > EPS) ? (fPreOdd + fCurLinkOdd) : 0; //接头间隙 fPreOdd = (ciLinkS0E1 == 0) ? pCurJg->endOdd() : pCurJg->startOdd(); double fSumLen = pCurJg->GetLength(), fUsedLen = 0, fExtraLen = 0; if (pStartPedalPlate && pCurJg == pFirstJg) { double ddx = pStartPedalPlate->ucs.axis_z*pCurJg->vxWingNorm; double ddy = pStartPedalPlate->ucs.axis_z*pCurJg->vyWingNorm; ciWorkWing = (fabs(ddx) > fabs(ddy)) ? 0 : 1; f3dPoint ptS = (ciLinkS0E1 == 0) ? line_ptS : line_ptE; f3dPoint ptE = (ciLinkS0E1 == 0) ? line_ptE : line_ptS; f3dPoint vec = (ptE - ptS).normalized(); f3dPoint start = pStartPedalPlate->ucs.origin; project_point(start, pCurJg->xPosStart, pStartPedalPlate->ucs.axis_z); SnapPerp(&start, pCurJg->Start(), pCurJg->End(), start); fExtraLen = (start - ptS)*vec; } if (g_sysPara.FootNailDist > fSumLen - fExtraLen) { //预判当前杆件剩余长度是否足够布置下一个脚踏板 fPreRodRemainingLen = fSumLen - fExtraLen; continue; } while (1) { CDesPedalPlateDlg dlg; dlg.m_bNewPlate = TRUE; dlg.m_pPedalPlate = NULL; dlg.m_pDatumAngle = pCurJg; dlg.layout_para.m_ciWorkWing = ciWorkWing; dlg.layout_para.m_ciLineS0E1 = ciLinkS0E1; dlg.layout_para.m_fSumLen = fSumLen; dlg.layout_para.m_fExtraLen = fExtraLen; dlg.layout_para.m_fCanLen = fSumLen - fExtraLen - fUsedLen; dlg.layout_para.m_fUseLen = fUsedLen; dlg.layout_para.m_fPreRemainDist = fPreRodRemainingLen; dlg.layout_para.m_fJointGap = fJointGap; if (dlg.DoModal() != IDOK) return 0; fUsedLen = dlg.CalOffDist(); fPreRodRemainingLen = fJointGap = fExtraLen = 0; CLDSParamPlate* pPedalPlate = dlg.CreatePedalPlate(); pPedalPlate->DesignPlate(); pPedalPlate->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pPedalPlate->GetSolidPartObject()); g_pSolidDraw->Draw(); //预判当前杆件剩余长度是否足够布置下一个脚踏板 double pre_used_dist = fUsedLen + g_sysPara.FootNailDist; if (pre_used_dist > fSumLen + fExtraLen) { fPreRodRemainingLen = fSumLen + fExtraLen - fUsedLen; break; } } g_pSolidDraw->SetEntSnapStatus(pCurJg->handle, FALSE); } // m_pDoc->SetModifiedFlag(); // 修改数据后应调用此函数置修改标志. pCmdLine->FinishCmdLine(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Command:", ""); #else pCmdLine->FillCmdLine("命令:", ""); #endif return 0; } //设计底脚板 void CLDSView::OnFootPlank() { DesignFoot(); } int CLDSView::DesignOldFoot() //设计旧式塔脚 { #ifdef __SMART_DRAW_INC_ DesignFoot(); #else m_nPrevCommandID=ID_FOOT_PLANK; #ifdef AFX_TARG_ENU_ENGLISH m_sPrevCommandName="Repeat base plates"; #else m_sPrevCommandName="重复底脚板"; #endif g_pSolidSet->SetOperType(OPER_OSNAP); m_curTask = TASK_DESIGN_FOOT_PLANK; m_nObjectSnapedCounts=0; m_setSnapObjects.Empty(); //切换到单线显示状态 g_pSolidSet->SetDisplayType(DISP_LINE); g_pSolidDraw->Draw(); #ifdef AFX_TARG_ENU_ENGLISH g_pPromptMsg->SetMsg("Please select base plates' nodes and leg member!"); #else g_pPromptMsg->SetMsg("请选择要设计底脚板的节点及主材角钢!"); #endif #endif return 0; } //设计牛蹄板 int CLDSView::DesignHoof() //设计牛蹄板 { OnDesHoofPlank(); return TRUE; } void CLDSView::OnDesHoofPlank() { //组合角钢接头处的牛蹄板连接 m_nPrevCommandID=ID_DES_HOOF_PLANK; #ifdef AFX_TARG_ENU_ENGLISH m_sPrevCommandName="Repeat design hoof plates"; #else m_sPrevCommandName="重复牛蹄板"; #endif g_pSolidSet->SetOperType(OPER_OSNAP); m_curTask = TASK_DESIGN_HOOF_PLANK; m_nObjectSnapedCounts=0; m_setSnapObjects.Empty(); //切换到单线显示状态 g_pSolidSet->SetDisplayType(DISP_LINE); g_pSolidDraw->Draw(); #ifdef AFX_TARG_ENU_ENGLISH g_pPromptMsg->SetMsg("Please select base plates' nodes and leg member!"); #else g_pPromptMsg->SetMsg("请选择要设计底脚板的节点及主材角钢!"); #endif } //切割角钢 void CLDSView::OnCutJg() { m_nPrevCommandID=ID_CUT_JG; #ifdef AFX_TARG_ENU_ENGLISH m_sPrevCommandName="Repeat to specify datum angle's leg cut"; #else m_sPrevCommandName="重复指定基准角钢切角切肢"; #endif m_curTask = TASK_CAL_CUT_JG; g_pSolidSet->SetOperType(OPER_OSNAP); g_pSolidSnap->SetSnapType(SNAP_ALL); m_nObjectSnapedCounts=0; m_setSnapObjects.Empty(); long *id_arr=NULL; int selects=g_pSolidSnap->GetLastSelectEnts(id_arr); if(selects>0) { for(int i=0;i<selects;i++) { CLDSLineAngle* pAngle=(CLDSLineAngle*)console.FromPartHandle(id_arr[i],CLS_LINEANGLE); if(pAngle!=NULL) m_setSnapObjects.append(pAngle); if(m_setSnapObjects.GetNodeNum()==2) break; } if(m_setSnapObjects.GetNodeNum()==2) FinishCalCutJg(m_setSnapObjects[0],m_setSnapObjects[1]); else if(m_setSnapObjects.GetNodeNum()==1) { m_nObjectSnapedCounts=1; #ifdef AFX_TARG_ENU_ENGLISH g_pPromptMsg->SetMsg("Select one datum angle to cut ray angle!"); #else g_pPromptMsg->SetMsg("选择一根基准角钢用以切割射线角钢!"); #endif } return; } g_pSolidDraw->ReleaseSnapStatus(); #ifdef AFX_TARG_ENU_ENGLISH g_pPromptMsg->SetMsg("Please select a cutted ray angle!"); #else g_pPromptMsg->SetMsg("请选择被切割的射线角钢!"); #endif } //设计节点板 void CLDSView::OnDesignJdb() { m_nPrevCommandID=ID_DESIGN_JDB; #ifdef AFX_TARG_ENU_ENGLISH m_sPrevCommandName="Repeat to design node plate"; #else m_sPrevCommandName="重复节点板"; #endif Command("DesignNodePlate"); } CMirMsgDlg mirmsgDlg; //连接板对称信息 int CLDSView::DesignNodePlate() //通过命令行调用FinishDesignJdb { CCmdLockObject cmdlock(this); if(!cmdlock.LockSuccessed()) return FALSE; return FinishDesignJdb(NULL); } BOOL CLDSView::FinishDesignJdb(CLDSNode *pSelNode) { #if !defined(__TSA_)&&!defined(__TSA_FILE_) CLDSPlate *pCurPlate = NULL,*pMirPlank=NULL,*pSideMirPlank=NULL; CDesignJdb designJdb; BOOL bHasMirJdb = FALSE; //是否对称生成对角部位的连接板 CCmdLineDlg *pCmdLine = ((CMainFrame*)AfxGetMainWnd())->GetCmdLinePage(); if(pSelNode==NULL) { g_pSolidDraw->ReleaseSnapStatus(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Please select nodes which to be designed!",""); #else pCmdLine->FillCmdLine("DesignNodePlate 选择节点板的依赖节点:",""); #endif DWORD dwhObj=0,dwExportFlag=0; CSnapTypeVerify verifier(OBJPROVIDER::SOLIDSPACE,GetSingleWord(SELECTINDEX_NODE)); verifier.AddVerifyType(OBJPROVIDER::LINESPACE,AtomType::prPoint); CDisplayNodeAtFrontLife displayNode; displayNode.DisplayNodeAtFront(); while(1) { if(g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verifier)<0) { pCmdLine->CancelCmdLine(); return 0; } SELOBJ obj(dwhObj,dwExportFlag); dwhObj=obj.hRelaObj; pSelNode= console.FromNodeHandle(dwhObj); if(pSelNode&&pSelNode->IsNode()) break; } } g_pSolidDraw->SetEntSnapStatus(pSelNode->handle); pCmdLine->FinishCmdLine(CXhChar16("节点0x%X",pSelNode->handle)); BOOL bTerminateByUser=FALSE; CLogErrorLife loglife; CUndoOperObject undo(&Ta,true); try{ if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pSelNode->dwPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of the node!"; #else throw "没有此节点的修改权限!"; #endif g_pSolidDraw->SetEntSnapStatus(pSelNode->handle,TRUE); //高亮显示节点板基准点 //选择装配定位杆件 f3dLine line_3d; CString cmdStr; SmartPartPtr pBasePart; CLDSLinePart *pBaseLinePart=NULL,*pNodeFatherPart=NULL; //g_pSolidDraw->ReleaseSnapStatus(); //static int iPlateFaceType; //单面板 int iPlateFaceType=1; //单面板(刘伟说客户反映节点板类型还是去掉记忆功能更实用 wjh-2015.6.24) iPlateFaceType=max(1,iPlateFaceType); iPlateFaceType=min(4,iPlateFaceType); BOOL bHasSpecifyType=FALSE; //是否已制定过节点板类型 pNodeFatherPart=(CLDSLinePart*)console.FromPartHandle(pSelNode->hFatherPart,CLS_LINEPART); if(pSelNode->m_cPosCalType==4&&pNodeFatherPart&&pNodeFatherPart->GetClassTypeId()==CLS_LINEANGLE) { //选择节点板类型 1.单面板 2.双面板 3.三面板 4.内部交叉板 #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Please select node-plate's type<1.planar plate|2.2-plane plate|3.3-plane plate|4.inner cross plate>[4]:",""); #else pCmdLine->FillCmdLine("DesignNodePlate 请指定节点板类型<1.单面板|2.双面板|3.三面板|4.内部交叉板>[4]:",""); #endif while(1) { if(!pCmdLine->GetStrFromCmdLine(cmdStr,CCmdLineDlg::KEYWORD_AS_RETURN|CCmdLineDlg::LBUTTONDOWN_AS_RETURN,"1|2|3|4")) { pCmdLine->CancelCmdLine(); return FALSE; } if(cmdStr.GetLength()==0) iPlateFaceType=4; else iPlateFaceType = atoi(cmdStr); if(iPlateFaceType<1||iPlateFaceType>4) { pCmdLine->FinishCmdLine(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Illegal input,please repeat to select node-plate's type<1.planar plate|2.2-plane plate|3.3-plane plate|4.inner cross plate>[4]:",""); #else pCmdLine->FillCmdLine("非法输入,请重新指定节点板类型<1.单面板|2.双面板|3.三面板|4.内部交叉板>[4]:",""); #endif continue; } else break; } bHasSpecifyType=TRUE; pBasePart=pNodeFatherPart; pBaseLinePart=pNodeFatherPart; } if(iPlateFaceType!=4) { CSnapTypeVerify verifier(OBJPROVIDER::LINESPACE,SNAP_LINE|SNAP_ARC); verifier.AddVerifyFlag(OBJPROVIDER::SOLIDSPACE,SELECT_LINEPART|SELECT_ARCPART); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Please select node-plate's assemble locate rod:",""); #else pCmdLine->FillCmdLine("DesignNodePlate 请选择节点板的装配定位杆件:",""); #endif int ret=0; DWORD dwhObj=0,dwExportFlag=0; while(1) { if((ret=g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verifier))<0) { pCmdLine->CancelCmdLine(); return FALSE; } SELOBJ obj(dwhObj,dwExportFlag); dwhObj=obj.hRelaObj; if(dwhObj==0&&obj.ciTriggerType==SELOBJ::TRIGGER_KEYRETURN) { long* id_arr=NULL; if(g_pSolidSnap->GetLastSelectEnts(id_arr)>0) dwhObj=id_arr[0]; } if(dwhObj>0) pBasePart=console.FromPartHandle(dwhObj); if(pBasePart.IsNULL()) continue; if(pBasePart->IsLinePart()) pBaseLinePart=pBasePart.pRod; break; } pCmdLine->FinishCmdLine(CXhChar16("0x%X",pBasePart->handle)); } if(pBaseLinePart) g_pSolidDraw->SetEntSnapStatus(pBaseLinePart->handle); //未指定节点板类型 if(pBaseLinePart==NULL) //以弧形杆件为基准,只能做单面板 iPlateFaceType=1; else if(!bHasSpecifyType) { //根据基准杆件类型预判节点板类型 if(pBaseLinePart->GetClassTypeId()==CLS_LINETUBE) { TUBEJOINT *pCurJoint=NULL; if(pBaseLinePart->pStart==pSelNode) pCurJoint=&((CLDSLineTube*)pBaseLinePart)->m_tJointStart; else if(pBaseLinePart->pEnd==pSelNode) pCurJoint=&((CLDSLineTube*)pBaseLinePart)->m_tJointEnd; if(pCurJoint&&pCurJoint->type==1&&pCurJoint->hLinkObj>0&&pCurJoint->hViceLinkObj<0) { CLDSLineTube *pCoupleTube=(CLDSLineTube*)console.FromPartHandle(pCurJoint->hLinkObj,CLS_LINETUBE); if(pCoupleTube&&!(fabs(pBaseLinePart->ucs.axis_y*pCoupleTube->ucs.axis_y)>EPS_COS)) iPlateFaceType=2; //基准钢管为对接相贯,此处应该生成双面板 } } else if(pBaseLinePart->GetClassTypeId()==CLS_LINEANGLE&&((CLDSLineAngle*)pBaseLinePart)->group_father_jg_h>0x20) { //涉及组合角钢时,优先以组合角钢为装配定位基准杆件 wjh-2016.11.04 CLDSGroupLineAngle* pGroupAngle=(CLDSGroupLineAngle*)Ta.Parts.FromHandle(((CLDSLineAngle*)pBaseLinePart)->group_father_jg_h,CLS_GROUPLINEANGLE); if(pGroupAngle) pBasePart=pBaseLinePart=pGroupAngle; } //选择节点板类型 1.单面板 2.双面板 3.三面板 4.内部交叉板 CString sPrompt=""; #ifdef AFX_TARG_ENU_ENGLISH sPrompt.Format("Please select node-plate's type<1.planar plate|2.2-plane plate|3.3-plane plate|4.inner cross plate>[%d]:",iPlateFaceType); #else sPrompt.Format("DesignNodePlate 请指定节点板类型<1.单面板|2.双面板|3.三面板|4.内部交叉板>[%d]:",iPlateFaceType); #endif pCmdLine->FillCmdLine(sPrompt,""); while(1) { //由于前面使用SnapObject时可能会有鼠标左键抬起的消息残留,故只能用LBUTTONDOWN_AS_RETURN wjh-2016.10.25 if(!pCmdLine->GetStrFromCmdLine(cmdStr,CCmdLineDlg::KEYWORD_AS_RETURN|CCmdLineDlg::LBUTTONDOWN_AS_RETURN,"1|2|3|4")) { pCmdLine->CancelCmdLine(); return FALSE; } if(cmdStr.GetLength()!=0) iPlateFaceType = atoi(cmdStr); else pCmdLine->FinishCmdLine(CXhChar16("%d",iPlateFaceType)); if(iPlateFaceType<1||iPlateFaceType>4) { pCmdLine->FinishCmdLine(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Illegal input,please repeat to select node-plate's type<1.planar plate|2.2-plane plate|3.3-plane plate|4.inner cross plate>[4]:",""); #else pCmdLine->FillCmdLine("非法输入,请重新指定节点板类型<1.单面板|2.双面板|3.三面板|4.内部交叉板>[4]:",""); #endif continue; } else break; } } // g_pSolidSet->SetDisplayType(DISP_SOLID);//切换到实体显示模式 g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->Draw(); pCurPlate = (CLDSPlate*)console.AppendPart(CLS_PLATE); pCurPlate->cfgword=pSelNode->cfgword; //调整钢板配材号与基准构件或基准节点配材号一致 pCurPlate->designInfo.m_hBaseNode = pSelNode->handle; if(pBasePart.IsHasPtr()) pCurPlate->designInfo.m_hBasePart = pBasePart->handle; designJdb.SetViewFlag(m_eViewFlag); CStackVariant<char> stackprop0(&CLDSBolt::BOLTL0_CALMODE, CLDSBolt::L0CAL_BY_SUMM_THICK); //下一行代码已改由系统配置属性来控制 wjh-2019.8.25 //CStackVariant<char> stackprop0i(&CLDSBolt::BOLTL0_PREFER_MODE,CLDSBolt::L0CAL_INC_GAP_THICK); if(iPlateFaceType<4) { //普通连接板 pCurPlate->face_N = iPlateFaceType; pCurPlate->jdb_style = 0; if(!designJdb.DesignCommonPlank(pCurPlate)) { bTerminateByUser=TRUE; #ifdef AFX_TARG_ENU_ENGLISH throw "Design failed"; #else throw "设计失败"; #endif } } else //if(iPlateFaceType==4)//设计的是交叉板(需要特殊处理) { pCurPlate->jdb_style = 1; pCurPlate->face_N = 1; if(!designJdb.DesignCrossPlank(pCurPlate)) { bTerminateByUser=TRUE; #ifdef AFX_TARG_ENU_ENGLISH throw "Design failed"; #else throw "设计失败"; #endif } } if(designJdb.m_pPlank) { designJdb.m_pPlank->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength(),g_sysPara.display.nSmoothness); g_pSolidDraw->NewSolidPart(designJdb.m_pPlank->GetSolidPartObject()); mirmsgDlg.m_bUseMirrorSymmetry=TRUE; if(mirmsgDlg.DoModal()==IDOK) MirTaAtom(designJdb.m_pPlank,mirmsgDlg.mirmsg); if(designJdb.m_pPlank->GetThick()<=0) { console.DispPartSet.DeleteNode(designJdb.m_pPlank->handle); console.DeletePart(designJdb.m_pPlank->handle); } } g_pSolidDraw->Draw(); } catch(char *s) { //发生异常设计失败,删除系统中已生成的错误节点板 if(pCurPlate) { console.DispPartSet.DeleteNode(pCurPlate->handle); console.DeletePart(pCurPlate->handle); } if(!bTerminateByUser) AfxMessageBox(s); //提示异常错误信息 g_pSolidDraw->ReleaseSnapStatus(); return FALSE; } m_pDoc->SetModifiedFlag(); // 修改数据后应调用此函数置修改标志. #endif FinishDesignJdb(NULL); //继续执行节点板设计命令(刘伟说汇金通提出) wjh-2016.12.7 return TRUE; } //折叠板设计 void CLDSView::OnFoldPlank() { m_nPrevCommandID=ID_FOLD_PLANK; #ifdef AFX_TARG_ENU_ENGLISH m_sPrevCommandName="Repeat to design folded plate"; #else m_sPrevCommandName="重复折叠板"; #endif CLDSPlate *pCurPlate=NULL; CDesignJdb designJdb; CLDSNode *pBaseNode[2]={NULL}; CLDSLineAngle *pBaseJg[2]={NULL},*pMirJg=NULL; int i; //CLDSNode::ATTACH_PART *pAttach=NULL; //-----vvvvvvv-标识函数运行状态为真,即同一时刻只能有一个塔创建函数运行--------- if(!LockFunc()) return; UINT nRetCode=1; //现已不需要检测加密锁状态了 wjh-2017.9.18 BOOL bTerminateByUser=FALSE; Ta.BeginUndoListen(); try { if(m_eViewFlag == PERSPECTIVE) #ifdef AFX_TARG_ENU_ENGLISH throw "Can't design folded plate in perspective view,please convert to another view"; #else throw "不能在透视图下进行折叠板设计,请转到其它视图进行折叠板设计"; #endif if(m_eViewFlag==RANDOM_VIEW) #ifdef AFX_TARG_ENU_ENGLISH throw "Can't design folded plate in spread view,please convert to another view"; #else throw "不能在展开图下进行折叠板设计,请转到其它视图进行折叠板设计"; #endif #ifdef DOG_CHECK if(nRetCode!=1) #ifdef AFX_TARG_ENU_ENGLISH throw "Hardware lock's detection is wrong,program is error!"; #else throw "检测加密狗出错,程序出错!"; #endif #endif ///////////////捕捉区域///////////////////////// f3dLine line; f3dPoint *point; g_pSolidDraw->ReleaseSnapStatus(); #ifdef AFX_TARG_ENU_ENGLISH g_pPromptMsg->SetMsg("Please select first angle in turn!"); #else g_pPromptMsg->SetMsg("请依次选择第一根角钢!"); #endif while(g_pSolidSnap->SnapLine(line)>0) { pBaseJg[0]=(CLDSLineAngle*)console.FromPartHandle(line.ID,CLS_LINEANGLE); if(pBaseJg[0]) break; } if(pBaseJg[0]) g_pSolidDraw->SetEntSnapStatus(pBaseJg[0]->handle); else #ifdef AFX_TARG_ENU_ENGLISH throw "Quit midway"; #else throw "中途退出"; #endif #ifdef AFX_TARG_ENU_ENGLISH g_pPromptMsg->SetMsg("Please select first angle's design nodes int turn!"); #else g_pPromptMsg->SetMsg("请依次选择第一根角钢的设计节点!"); #endif while(g_pSolidSnap->SnapPoint(point)>0) { pBaseNode[0]=console.FromNodeHandle(point->ID); if(theApp.m_bCooperativeWork&&pBaseNode[0]&&!theApp.IsHasModifyPerm(pBaseNode[0]->dwPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of the node!"; #else throw "没有此节点的修改权限!"; #endif if(pBaseNode[0]&&pBaseJg[0]->pStart==pBaseNode[0]) { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pBaseJg[0]->dwStartPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of angle's start!"; #else throw "没有此角钢始端的修改权限!"; #endif break; } else if(pBaseNode[0]&&pBaseJg[0]->pEnd==pBaseNode[0]) { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pBaseJg[0]->dwEndPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of angle's end!"; #else throw "没有此角钢终端的修改权限!"; #endif break; } else #ifdef AFX_TARG_ENU_ENGLISH AfxMessageBox("The selected angle don't fit!"); #else AfxMessageBox("选择角钢不合适!"); #endif } if(pBaseNode[0]) g_pSolidDraw->SetEntSnapStatus(pBaseNode[0]->handle); else #ifdef AFX_TARG_ENU_ENGLISH throw "Quit midway"; #else throw "中途退出"; #endif #ifdef AFX_TARG_ENU_ENGLISH g_pPromptMsg->SetMsg("Please select second angle's another design node in turn!"); #else g_pPromptMsg->SetMsg("请依次选择第二根角钢另一设计节点!"); #endif while(g_pSolidSnap->SnapPoint(point)>0) { pBaseNode[1]=console.FromNodeHandle(point->ID); if(pBaseNode[1]) { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pBaseNode[1]->dwPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of the node!"; #else throw "没有此节点的修改权限!"; #endif g_pSolidDraw->SetEntSnapStatus(pBaseNode[1]->handle); break; } else #ifdef AFX_TARG_ENU_ENGLISH AfxMessageBox("The selected node don't fit!"); throw "Quit midway"; #else AfxMessageBox("选择节点不合适!"); throw "中途退出"; #endif } #ifdef AFX_TARG_ENU_ENGLISH g_pPromptMsg->SetMsg("Please select second angle in turn!"); #else g_pPromptMsg->SetMsg("请依次选择第二根角钢!"); #endif while(g_pSolidSnap->SnapLine(line)>0) { pBaseJg[1]=(CLDSLineAngle*)console.FromPartHandle(line.ID,CLS_LINEANGLE); if(pBaseJg[1]&&pBaseJg[1]->pStart==pBaseNode[1]) { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pBaseJg[1]->dwStartPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of angle's start!"; #else throw "没有此角钢始端的修改权限!"; #endif g_pSolidDraw->SetEntSnapStatus(pBaseJg[1]->handle); break; } else if(pBaseJg[1]&&pBaseJg[1]->pEnd==pBaseNode[1]) { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pBaseJg[1]->dwEndPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of angle's end!"; #else throw "没有此角钢终端的修改权限!"; #endif g_pSolidDraw->SetEntSnapStatus(pBaseJg[1]->handle); break; } else #ifdef AFX_TARG_ENU_ENGLISH throw "The selected angle don't fit,Quit midway!"; #else throw "选择角钢不合适,中途退出!"; #endif } /*g_pPromptMsg->SetMsg("请依次选择第三根角钢!"); while(g_pSolidSnap->SnapLine(line)) { pBaseJg[2]=Ta.LineAngles.FromHandle(line->ID); if(pBaseJg[2]&&( pBaseJg[2]->pStart==pBaseNode[1]||pBaseJg[2]->pEnd==pBaseNode[1])) break; else AfxMessageBox("选择角钢不合适!"); } if(pBaseJg[2]) g_pSolidDraw->SetEntSnapStatus(pBaseJg[2]->handle); else throw "中途退出";*/ for(i=0;i<2;i++) { if(pBaseJg[i]==NULL) #ifdef AFX_TARG_ENU_ENGLISH throw "The selected datum angle is error,quit midway!"; #else throw "基准角钢选择错误,设计失败中途退出!"; #endif if(m_eViewFlag==FRONT_VIEW||m_eViewFlag==BACK_VIEW) pMirJg=(CLDSLineAngle*)pBaseJg[i]->GetMirPart(MIRMSG(1),pBaseNode[i]->Position()); //X轴对称 else pMirJg=(CLDSLineAngle*)pBaseJg[i]->GetMirPart(MIRMSG(2),pBaseNode[i]->Position()); //Y轴对称 if(pMirJg==NULL) #ifdef AFX_TARG_ENU_ENGLISH throw "Lack of symmetry angle,quit midway!"; #else throw "缺少对称角钢,设计失败中途退出!"; #endif if(i==0) { designJdb.face2_jgset.append(pBaseJg[i]); designJdb.face2_jgset.append(pMirJg); } else { designJdb.face3_jgset.append(pBaseJg[i]); designJdb.face3_jgset.append(pMirJg); } } pCurPlate = (CLDSPlate*)console.AppendPart(CLS_PLATE); pCurPlate->cfgword=pBaseNode[0]->cfgword; //调整钢板配材号与基准构件或基准节点配材号一致 pCurPlate->designInfo.m_hBaseNode = pBaseNode[0]->handle; pCurPlate->jdb_style=1; ////之前折叠板赋值为3是错的会与钢管夹板混淆,现重新修正为1,并增加IsFoldPlate()函数 wjh-2016.1.09 pCurPlate->face_N = 3; designJdb.SetViewFlag(m_eViewFlag); pCurPlate->ucs.axis_x=pBaseNode[1]->Position(true)-pBaseNode[0]->Position(true);//定义板坐标系X轴 pCurPlate->ucs.origin=pBaseNode[0]->Position(true); if(designJdb.DesignFoldPlank(pCurPlate)) { int iViewIndex=2; g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->SetEntSnapStatus(pBaseNode[0]->handle); g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->SetEntSnapStatus(pBaseNode[1]->handle); g_pSolidDraw->ReleaseSnapStatus(); } else//设计失败,删除系统中已生成的错误节点板 { bTerminateByUser=TRUE; #ifdef AFX_TARG_ENU_ENGLISH throw "Design failed"; #else throw "设计失败"; #endif } g_pSolidDraw->ReleaseSnapStatus(); Ta.EndUndoListen(); } catch(char *s) { //发生异常设计失败,删除系统中已生成的错误节点板 if(pCurPlate) console.DeletePart(pCurPlate->handle); if(!bTerminateByUser) AfxMessageBox(s); //提示异常错误信息 g_pSolidDraw->ReleaseSnapStatus(); ReleaseFunc(); //解开函数运行锁定状态 Ta.EndUndoListen(); return; } m_pDoc->SetModifiedFlag(); // 修改数据后应调用此函数置修改标志. ReleaseFunc(); //解开函数运行锁定状态 } BOOL CLDSView::FinishDesignJoint(CLDSDbObject *pNodeAtom,CLDSDbObject *pJgAtom1,CLDSDbObject *pJgAtom2) { BOOL bFinish=FALSE; #if !defined(__TSA_)&&!defined(__TSA_FILE_) CLDSNode *pSelNode; CLDSLineAngle *pMainJg[2]; CDesignJoint designJoint; if(pNodeAtom==NULL||pJgAtom1==NULL||pJgAtom2==NULL) return FALSE; CUndoOperObject undo(&Ta); try { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pNodeAtom->dwPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of the node!"; #else throw "没有此节点的修改权限!"; #endif if(pNodeAtom->GetClassTypeId()!=CLS_NODE) #ifdef AFX_TARG_ENU_ENGLISH throw "Part type is error,the selected first part should be node!"; #else throw "构件类型错误,你所选的第一个构件应该是节点!"; #endif pSelNode = (CLDSNode*)pNodeAtom; //CLDSNode::ATTACH_PART *pAttach = FindJointPosIndex(pSelNode); if(pJgAtom1->GetClassTypeId()!=CLS_LINEANGLE&&pJgAtom1->GetClassTypeId()!=CLS_GROUPLINEANGLE) #ifdef AFX_TARG_ENU_ENGLISH throw "Part type is error,the selected second part should be angle!"; #else throw "构件类型错误,你所选的第二个构件应该是角钢!"; #endif pMainJg[1] = (CLDSLineAngle*)pJgAtom1; if(pJgAtom2->GetClassTypeId()!=CLS_LINEANGLE&&pJgAtom2->GetClassTypeId()!=CLS_GROUPLINEANGLE) #ifdef AFX_TARG_ENU_ENGLISH throw "Part type is error,the selected third part should be angle!"; #else throw "构件类型错误,你所选的第三个构件应该是角钢!"; #endif pMainJg[0] = (CLDSLineAngle*)pJgAtom2; if(pMainJg[0]->pStart->handle==pSelNode->handle) { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pMainJg[0]->dwStartPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of angle's start!"; #else throw "没有此角钢始端的修改权限!"; #endif pMainJg[0]->feature = 0;//起点与当前节点相连接 } else { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pMainJg[0]->dwEndPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of angle's end!"; #else throw "没有此角钢终端的修改权限!"; #endif pMainJg[0]->feature = 1;//终点与当前节点相连接 } if(pMainJg[1]->pStart->handle==pSelNode->handle) { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pMainJg[1]->dwStartPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of angle's start!"; #else throw "没有此角钢始端的修改权限!"; #endif pMainJg[1]->feature = 0;//起点与当前节点相连接 } else { if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pMainJg[1]->dwEndPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of angle's end!"; #else throw "没有此角钢终端的修改权限!"; #endif pMainJg[1]->feature = 1;//终点与当前节点相连接 } if(pMainJg[0]->GetClassTypeId()!=pMainJg[1]->GetClassTypeId()) #ifdef AFX_TARG_ENU_ENGLISH throw "Two datum part's material are different,it isn't fit design joint here!"; #else throw "两基准材类型不同,不适合在此处设计接头!"; #endif else if(pMainJg[0]->GetClassTypeId()==CLS_GROUPLINEANGLE &&((CLDSGroupLineAngle*)pMainJg[0])->group_style!=((CLDSGroupLineAngle*)pMainJg[1])->group_style) #ifdef AFX_TARG_ENU_ENGLISH throw "Two datum part's material are different,it isn't fit design joint here!"; #else throw "两基准材类型不同,不适合在此处设计接头!"; #endif CLDSLineAngle *pTemJg; if( pMainJg[1]->GetThick()>pMainJg[0]->GetThick() || (pMainJg[1]->GetThick()==pMainJg[0]->GetThick()&& pMainJg[1]->GetWidth()>pMainJg[0]->GetWidth())) { //第一根基准角钢应该为肢厚较厚或肢宽较宽的那根 pTemJg = pMainJg[0]; pMainJg[0] = pMainJg[1]; pMainJg[1] = pTemJg; } CJoint joint; joint.cfgword=Ta.GetDefaultCfgPartNo(); joint.base_jg_handle_arr[0] = pMainJg[0]->handle; joint.base_jg_handle_arr[1] = pMainJg[1]->handle; joint.base_node_handle = pSelNode->handle; joint.SetBelongModel(console.GetActiveModel()); joint.SetLayer(pMainJg[0]->layer()); //(theApp.env.layer); joint.iSeg=pSelNode->iSeg; bFinish=designJoint.CreateJoint(&joint); for(CLDSPart* pSubPart=joint.GetFirstPart();pSubPart;pSubPart=joint.GetNextPart()) { pSubPart->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pSubPart->GetSolidPartObject()); } g_pSolidDraw->Draw(); } catch(char *sError) { AfxMessageBox(sError); } m_pDoc->SetModifiedFlag(); if(bFinish) #ifdef AFX_TARG_ENU_ENGLISH MessageBox("Design joint is success!"); #else MessageBox("接头设计成功!"); #endif #endif return bFinish; } BOOL CLDSView::FinishAddFillPlank(CLDSDbObject *pFirObj, CLDSDbObject *pSecObj/*=NULL*/, CLDSDbObject *pThirObj/*=NULL*/) { #if !defined(__TSA_)&&!defined(__TSA_FILE_) CLDSGroupLineAngle *pGroupJg=NULL; CLDSNode *pStart=NULL,*pEnd=NULL; static CLayFillPlankDlg fill_plank_dlg; int i,j; BOOL bTerminateByUser=FALSE; Ta.BeginUndoListen(); try { f3dPoint start,end,vec,vert_vec; if(pFirObj->GetClassTypeId()==CLS_GROUPLINEANGLE) { pGroupJg=(CLDSGroupLineAngle*)pFirObj; if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pGroupJg->dwPermission)) #ifdef AFX_TARG_ENU_ENGLISH throw "Not have modify permission of the combined angle!"; #else throw "没有此组合角钢的基本修改权限!"; #endif pStart=pGroupJg->pStart; pEnd=pGroupJg->pEnd; vec=pGroupJg->End()-pGroupJg->Start(); normalize(vec); } else if(pFirObj->GetClassTypeId()==CLS_NODE) { #ifdef AFX_TARG_ENU_ENGLISH if(pSecObj==NULL||pThirObj==NULL) throw "The number of selected parts is not enough!Layout filler plate failure!"; else if(pSecObj->GetClassTypeId()!=CLS_GROUPLINEANGLE||pThirObj->GetClassTypeId()!=CLS_NODE) throw "The selected part's type is error!Layout filler plate failure!"; else if(pSecObj->GetClassTypeId()!=CLS_GROUPLINEANGLE) throw "The selected angle isn't combined angle that no need to layout filler plate!"; pGroupJg=(CLDSGroupLineAngle*)pSecObj; if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pGroupJg->dwPermission)) throw "Not have modify permission of the combined angle!"; #else if(pSecObj==NULL||pThirObj==NULL) throw "选择构件不足!填板布置失败!"; else if(pSecObj->GetClassTypeId()!=CLS_GROUPLINEANGLE||pThirObj->GetClassTypeId()!=CLS_NODE) throw "选择构件类型不对!填板布置失败!"; else if(pSecObj->GetClassTypeId()!=CLS_GROUPLINEANGLE) throw "选择角钢不是组合角钢不需布置填板!"; pGroupJg=(CLDSGroupLineAngle*)pSecObj; if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pGroupJg->dwPermission)) throw "没有此组合角钢的基本修改权限!"; #endif pStart=(CLDSNode*)pFirObj; pEnd=(CLDSNode*)pThirObj; start=pGroupJg->GetDatumPosBer(pStart); end=pGroupJg->GetDatumPosBer(pEnd); vec=end-start; normalize(vec); } fill_plank_dlg.m_pGroupAngle=pGroupJg; #ifdef AFX_TARG_ENU_ENGLISH if(fill_plank_dlg.DoModal()!=IDOK) { bTerminateByUser=TRUE; throw "Quit midway!Layout filler plate failure!"; } if(fill_plank_dlg.m_nPlankNum<=0) throw "The specified filler plate's number is 0,no need to add!"; #else if(fill_plank_dlg.DoModal()!=IDOK) { bTerminateByUser=TRUE; throw "中途退出!填板布置失败!"; } if(fill_plank_dlg.m_nPlankNum<=0) throw "指定填板数为零,不需添加!"; #endif int nSecType = 0; if(fill_plank_dlg.m_bDifferentType) nSecType = !fill_plank_dlg.m_iLsLayOutStyle; else nSecType = fill_plank_dlg.m_iLsLayOutStyle; if(fill_plank_dlg.m_nThick<=0) fill_plank_dlg.m_nThick=ftoi(pGroupJg->jg_space); //组合角钢角钢间隙的一半,生成螺栓时使用,保证螺栓在角钢准线上 wht 11-07-01 double fHalfGroupJgSpace=0.5*pGroupJg->jg_space; CLDSLineAngle *pBaseJg=(CLDSLineAngle*)console.FromPartHandle(pGroupJg->m_hDatumSonAngle,CLS_LINEANGLE); if(pBaseJg==NULL) #ifdef AFX_TARG_ENU_ENGLISH throw "The combined angle lacks of datum angle!Layout filler plate failure!"; #else throw "组合角钢缺少基准角钢!填板布置失败!"; #endif CLDSBolt ls(console.GetActiveModel()); //螺栓 int ls_d=atoi(fill_plank_dlg.m_sLsGuiGe); ls.set_d(ls_d); JGZJ jgzj_x,jgzj_y; getjgzj(jgzj_x,pGroupJg->GetWidth()); jgzj_y=jgzj_x; if(pGroupJg->m_bEnableTeG) { jgzj_x=pGroupJg->xWingXZhunJu; jgzj_y=pGroupJg->xWingYZhunJu; } LSSPACE_STRU LsSpace; GetLsSpace(LsSpace,ls_d); int plank_len=GetLsGroupLen(ls.get_d(),fill_plank_dlg.m_nLsNum,fill_plank_dlg.m_iLsRows+1); double unit_scale=1.0/(fill_plank_dlg.m_nPlankNum+1); for(i=0;i<fill_plank_dlg.m_nPlankNum;i++) { f3dPoint ber_pick,ls_pos; CLDSPlate *pPlank=(CLDSPlate*)console.AppendPart(CLS_PLATE); pPlank->cfgword=pBaseJg->cfgword; //调整钢板配材号与基准构件或基准节点配材号一致 pPlank->Thick=fill_plank_dlg.m_nThick; pPlank->SetPartNo(fill_plank_dlg.m_sPartNo.GetBuffer()); pPlank->iSeg=SEGI(fill_plank_dlg.m_sSegI.GetBuffer()); pPlank->cMaterial=CSteelMatLibrary::RecordAt(fill_plank_dlg.m_iPlateMaterial).cBriefMark; pPlank->designInfo.m_bEnableFlexibleDesign=TRUE; //启用柔性设计 pPlank->ucs.axis_y.Set(); //不清零后续重新设计时不重置Y轴坐标系,最终导致填板走向与组合角钢不一致 wjh-2016.4.13 pPlank->designInfo.iProfileStyle0123=2; //包络外形 //设置钢板柔性化参数 pPlank->designInfo.m_hBasePart=pGroupJg->handle; pPlank->designInfo.norm.norm_style=1; //角钢肢法线方向 pPlank->designInfo.norm.hVicePart=pBaseJg->handle; pPlank->designInfo.norm.direction=0; //填板位置参数 wht 11-01-23 pPlank->m_fNormOffset=-(0.5*fill_plank_dlg.m_nThick); pPlank->designInfo.origin.datum_pos_style=10; //两节点间的比例等分点 pPlank->designInfo.origin.des_para.SCALE_NODE.hLinePart=pGroupJg->handle; pPlank->designInfo.origin.des_para.SCALE_NODE.hStartNode=pStart->handle; pPlank->designInfo.origin.des_para.SCALE_NODE.hEndNode=pEnd->handle; pPlank->designInfo.origin.des_para.SCALE_NODE.start_offset_dist=fill_plank_dlg.m_fStartOffset; pPlank->designInfo.origin.des_para.SCALE_NODE.end_offset_dist=fill_plank_dlg.m_fEndOffset; pPlank->designInfo.origin.des_para.SCALE_NODE.offset_scale=unit_scale*(i+1); pPlank->designInfo.origin.des_para.SCALE_NODE.offset_dist=0; //螺栓法线设计参数 ls.iSeg=SEGI(fill_plank_dlg.m_sSegI.GetBuffer()); //指定螺栓段号 wht 11-07-01 ls.des_work_norm.norm_style=4; //基准构件上的相对法线 ls.des_work_norm.hVicePart=pPlank->handle; ls.des_work_norm.nearVector.Set(0,0,1); if(pGroupJg->group_style==0) //对角型组合 { CLDSLineAngle *pOtherJg=(CLDSLineAngle*)console.FromPartHandle(pGroupJg->son_jg_h[1],CLS_LINEANGLE); JGZJ jgzj; if(fill_plank_dlg.m_iWing==0) { //初始板在X肢上 if(!fill_plank_dlg.m_bSwapWing||i%2==0) pPlank->designInfo.norm.norm_wing=0; else pPlank->designInfo.norm.norm_wing=1; } else { //初始板在Y肢上 if(!fill_plank_dlg.m_bSwapWing||i%2==0) pPlank->designInfo.norm.norm_wing=1; else pPlank->designInfo.norm.norm_wing=0; } pPlank->DesignSetupUcs(); //计算钢板装配坐标系 if(fabs(pPlank->ucs.axis_x*pBaseJg->GetWingVecX())>EPS_COS2) { vert_vec=pBaseJg->GetWingVecX(); //螺栓在X肢上 jgzj=jgzj_x; } else { vert_vec=pBaseJg->GetWingVecY(); //螺栓在Y肢上 jgzj=jgzj_y; } ls.EmptyL0DesignPara(); //清空螺栓设计参数 ls.AddL0Thick(pPlank->handle,TRUE); ls.AddL0Thick(pBaseJg->handle,TRUE); if(!ls.CalGuigeAuto()) { char ss[200]=""; #ifdef AFX_TARG_ENU_ENGLISH sprintf(ss,"Can't find fit bolt's G M%dX%.0f.",ls.get_d(),ls.L0); #else sprintf(ss,"找不到合适的螺栓规格M%dX%.0f.",ls.get_d(),ls.L0); #endif throw ss; } for(j=0;j<fill_plank_dlg.m_nLsNum;j++) { //基准角钢上填板螺栓 CLDSBolt *pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls); pLs->cfgword=pBaseJg->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->des_work_norm=ls.des_work_norm; pLs->set_norm(pPlank->ucs.axis_z); if(fill_plank_dlg.m_iLsRows==0) //单排排列 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace+LsSpace.SingleRowSpace*j) +vert_vec*(fHalfGroupJgSpace+jgzj.g); else //双排排列 { if(fill_plank_dlg.m_iLsLayOutStyle==0) //靠近楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*(fHalfGroupJgSpace+jgzj.g1); else //奇数个螺栓 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*(fHalfGroupJgSpace+jgzj.g2); } else //远离楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*(fHalfGroupJgSpace+jgzj.g2); else //奇数个螺栓 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*(fHalfGroupJgSpace+jgzj.g1); } } pLs->des_base_pos.norm_offset.AddThick(-pBaseJg->handle,TRUE); pLs->des_base_pos.norm_offset.AddThick(-ftol(pPlank->GetThick()*0.5)); ls_pos=ls_pos+pLs->get_norm()*pLs->des_base_pos.norm_offset.Thick(pLs->BelongModel()); pLs->ucs.origin=ls_pos; pBaseJg->AppendMidLsRef(pLs->GetLsRef()); pPlank->AppendLsRef(pLs->GetLsRef()); //螺栓位置参数 pLs->des_base_pos.hPart=pPlank->handle; pLs->des_base_pos.datumPoint.datum_pos_style=9; //构件上的相对位置 pLs->des_base_pos.datumPoint.des_para.hPart=pPlank->handle; pLs->des_base_pos.datumPoint.datum_pos=ls_pos; coord_trans(pLs->des_base_pos.datumPoint.datum_pos,pPlank->ucs,FALSE); pLs->des_base_pos.datumPoint.datum_pos.z=0; //Z坐标归零 pLs->des_base_pos.datumPoint.SetPosition(ls_pos); //到位螺栓 pLs->correct_worknorm(); pLs->correct_pos(); pLs->CalGuigeAuto(); pLs->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pLs->GetSolidPartObject()); //非基准角钢上填板螺栓 if(pOtherJg==NULL) continue; //另一单角钢楞线上的基准点 SnapPerp(&ber_pick,pOtherJg->Start(),pOtherJg->End(),pPlank->ucs.origin); pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls); pLs->cfgword=pOtherJg->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->des_work_norm=ls.des_work_norm; pLs->set_norm(pPlank->ucs.axis_z); if(fill_plank_dlg.m_iLsRows==0) //单排排列 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace+LsSpace.SingleRowSpace*j)-vert_vec*jgzj.g; else //双排排列 { if(nSecType==0) //靠近楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g2; else //奇数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g1; } else //远离楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g1; else //奇数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g2; } } pLs->des_base_pos.norm_offset.AddThick(-ftol(pPlank->GetThick()*0.5)); ls_pos=ls_pos+pLs->get_norm()*pLs->des_base_pos.norm_offset.Thick(pLs->BelongModel()); pLs->ucs.origin=ls_pos; pOtherJg->AppendMidLsRef(pLs->GetLsRef()); pPlank->AppendLsRef(pLs->GetLsRef()); //螺栓位置参数 pLs->des_base_pos.hPart=pPlank->handle; pLs->des_base_pos.datumPoint.datum_pos_style=9; //构件上的相对位置 pLs->des_base_pos.datumPoint.des_para.hPart=pPlank->handle; pLs->des_base_pos.datumPoint.datum_pos=ls_pos; coord_trans(pLs->des_base_pos.datumPoint.datum_pos,pPlank->ucs,FALSE); pLs->des_base_pos.datumPoint.datum_pos.z=0; //Z坐标归零 pLs->des_base_pos.datumPoint.SetPosition(ls_pos); //到位螺栓 pLs->correct_worknorm(); pLs->correct_pos(); pLs->CalGuigeAuto(); pLs->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pLs->GetSolidPartObject()); } pPlank->CalStdProfile(); //计算钢板外形 pPlank->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pPlank->GetSolidPartObject()); if(fill_plank_dlg.m_iType==1) { CLDSPlate *pPlank2=NULL; if(fill_plank_dlg.m_iType==1) { pPlank2=(CLDSPlate*)console.AppendPart(CLS_PLATE); pPlank2->CopyProperty(pPlank); //设置钢板柔性化参数 pPlank2->designInfo.m_hBasePart=pGroupJg->handle; pPlank2->designInfo.norm.norm_style=1; //角钢肢法线方向 pPlank2->designInfo.norm.hVicePart=pBaseJg->handle; pPlank2->designInfo.norm.direction=0; //钢板位置参数 pPlank2->designInfo=pPlank->designInfo; } if(fill_plank_dlg.m_iWing==1) { //初始板在X肢上 if(!fill_plank_dlg.m_bSwapWing||i%2==0) pPlank2->designInfo.norm.norm_wing=0; else pPlank2->designInfo.norm.norm_wing=1; } else { //初始板在Y肢上 if(!fill_plank_dlg.m_bSwapWing||i%2==0) pPlank2->designInfo.norm.norm_wing=1; else pPlank2->designInfo.norm.norm_wing=0; } pPlank2->DesignSetupUcs(); //计算钢板装配坐标系 if(fabs(pPlank2->ucs.axis_y*pBaseJg->GetWingVecX())>EPS_COS2) { vert_vec=pBaseJg->GetWingVecX(); //螺栓在X肢上 jgzj=jgzj_x; } else { vert_vec=pBaseJg->GetWingVecY(); //螺栓在Y肢上 jgzj=jgzj_y; } //螺栓法线设计参数 ls.des_work_norm.hVicePart=pPlank2->handle; ls.EmptyL0DesignPara(); //清空螺栓设计参数 ls.AddL0Thick(pPlank2->handle,TRUE); ls.AddL0Thick(pBaseJg->handle,TRUE); if(!ls.CalGuigeAuto()) { char ss[200]=""; #ifdef AFX_TARG_ENU_ENGLISH sprintf(ss,"Can't find fit bolt's G M%dX%.0f.",ls.get_d(),ls.L0); #else sprintf(ss,"找不到合适的螺栓规格M%dX%.0f.",ls.get_d(),ls.L0); #endif throw ss; } for(j=0;j<fill_plank_dlg.m_nLsNum;j++) { //基准角钢上填板螺栓 CLDSBolt *pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls); pLs->cfgword=pBaseJg->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->des_work_norm=ls.des_work_norm; pLs->set_norm(pPlank2->ucs.axis_z); if(fill_plank_dlg.m_iLsRows==0) //单排排列 ls_pos=pPlank2->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace+LsSpace.SingleRowSpace*j)+vert_vec*jgzj.g; else //双排排列 { if(fill_plank_dlg.m_iLsLayOutStyle==0) //靠近楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=pPlank2->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj.g1; else //奇数个螺栓 ls_pos=pPlank2->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj.g2; } else //远离楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=pPlank2->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj.g2; else //奇数个螺栓 ls_pos=pPlank2->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj.g1; } } pLs->des_base_pos.norm_offset.AddThick(-pBaseJg->handle,TRUE); pLs->des_base_pos.norm_offset.AddThick(-ftol(pPlank2->GetThick()*0.5)); ls_pos=ls_pos+pLs->get_norm()*pLs->des_base_pos.norm_offset.Thick(pLs->BelongModel()); pLs->ucs.origin=ls_pos; pBaseJg->AppendMidLsRef(pLs->GetLsRef()); pPlank2->AppendLsRef(pLs->GetLsRef()); //螺栓位置参数 pLs->des_base_pos.hPart=pPlank2->handle; pLs->des_base_pos.datumPoint.datum_pos_style=9; //杆件上的相对位置 pLs->des_base_pos.datumPoint.des_para.hPart=pPlank2->handle; pLs->des_base_pos.datumPoint.datum_pos=ls_pos; coord_trans(pLs->des_base_pos.datumPoint.datum_pos,pPlank2->ucs,FALSE); pLs->des_base_pos.datumPoint.datum_pos.z=0; //Z坐标归零 pLs->des_base_pos.datumPoint.SetPosition(ls_pos); //到位螺栓 pLs->correct_worknorm(); pLs->correct_pos(); pLs->CalGuigeAuto(); pLs->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pLs->GetSolidPartObject()); //非基准角钢上填板螺栓 if(pOtherJg==NULL) continue; pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls); pLs->cfgword=pOtherJg->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->des_work_norm=ls.des_work_norm; pLs->set_norm(pPlank2->ucs.axis_z); if(fill_plank_dlg.m_iLsRows==0) //单排排列 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace+LsSpace.SingleRowSpace*j)-vert_vec*jgzj.g; else //双排排列 { if(nSecType==0) //靠近楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g2; else //奇数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g1; } else //远离楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g1; else //奇数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g2; } } pLs->des_base_pos.norm_offset.AddThick(-ftol(pPlank2->GetThick()*0.5)); ls_pos=ls_pos+pLs->get_norm()*pLs->des_base_pos.norm_offset.Thick(pLs->BelongModel()); pLs->ucs.origin=ls_pos; pOtherJg->AppendMidLsRef(pLs->GetLsRef()); pPlank2->AppendLsRef(pLs->GetLsRef()); //螺栓位置参数 pLs->des_base_pos.hPart=pPlank2->handle; pLs->des_base_pos.datumPoint.datum_pos_style=9; //杆件上的相对位置 pLs->des_base_pos.datumPoint.des_para.hPart=pPlank2->handle; pLs->des_base_pos.datumPoint.datum_pos=ls_pos; coord_trans(pLs->des_base_pos.datumPoint.datum_pos,pPlank2->ucs,FALSE); pLs->des_base_pos.datumPoint.datum_pos.z=0; //Z坐标归零 pLs->des_base_pos.datumPoint.SetPosition(ls_pos); //到位螺栓 pLs->correct_worknorm(); pLs->correct_pos(); pLs->CalGuigeAuto(); pLs->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pLs->GetSolidPartObject()); } pPlank2->CalStdProfile(); //计算钢板外形 // CLDSPlate *pNewPlate=(CLDSPlate*)console.AppendPart(CLS_PLATE); long hNew=pNewPlate->handle; //保存钢板句柄 pPlank->CloneTo(*pNewPlate); //克隆钢板 wht 11-01-07 pNewPlate->handle=hNew; //更新钢板句柄 pNewPlate->relativeObjs.Empty();//清空关联构件列表 pNewPlate->EmptyLsRef(); //清空螺栓引用 //复制螺栓引用 for(CLsRef *pLsRef=pPlank->GetFirstLsRef();pLsRef;pLsRef=pPlank->GetNextLsRef()) pNewPlate->AppendLsRef(*pLsRef); pNewPlate->SetModified(); pNewPlate->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength(),g_sysPara.display.nSmoothness); g_pSolidDraw->NewSolidPart(pNewPlate->GetSolidPartObject()); f3dPoint face_pos,face_norm; face_norm=pPlank2->ucs.axis_z; face_pos=pPlank2->ucs.origin; CutPlateByPlane(pPlank,face_pos,face_norm,fill_plank_dlg.m_fDistance); pPlank->m_hPartWeldParent = pPlank2->handle; face_pos+=face_norm*pNewPlate->GetThick(); face_norm*=-1.0; CutPlateByPlane(pNewPlate,face_pos,face_norm,fill_plank_dlg.m_fDistance); pNewPlate->m_hPartWeldParent = pPlank2->handle; } } else if(pGroupJg->group_style==1)//T字型组合 { CLDSLineAngle *pOtherJg=NULL; if(pGroupJg->m_hDatumSonAngle==pGroupJg->son_jg_h[0]) pOtherJg=(CLDSLineAngle*)console.FromPartHandle(pGroupJg->son_jg_h[1],CLS_LINEANGLE); else pOtherJg=(CLDSLineAngle*)console.FromPartHandle(pGroupJg->son_jg_h[0],CLS_LINEANGLE); if(pOtherJg==NULL) #ifdef AFX_TARG_ENU_ENGLISH throw "Can't find combined angle's another not datum child angle !"; #else throw "找不到组合角钢的另一非基准子角钢!"; #endif vert_vec=pBaseJg->GetWingVecX(); //初始板在Y肢上 pPlank->designInfo.norm.norm_wing=0; pPlank->DesignSetupUcs(); //计算钢板装配坐标系 ls.EmptyL0DesignPara(); //清空螺栓设计参数 ls.AddL0Thick(pPlank->handle,TRUE); ls.AddL0Thick(pBaseJg->handle,TRUE); ls.AddL0Thick(pOtherJg->handle,TRUE); if(!ls.CalGuigeAuto()) { char ss[200]=""; #ifdef AFX_TARG_ENU_ENGLISH sprintf(ss,"Can't find fit bolt's G M%dX%.0f.",ls.get_d(),ls.L0); #else sprintf(ss,"找不到合适的螺栓规格M%dX%.0f.",ls.get_d(),ls.L0); #endif throw ss; } for(j=0;j<fill_plank_dlg.m_nLsNum;j++) { //基准角钢上填板螺栓 CLDSBolt *pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls); pLs->cfgword=pBaseJg->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->des_work_norm=ls.des_work_norm; pLs->set_norm(pPlank->ucs.axis_z); if(fill_plank_dlg.m_iLsRows==0) //单排排列 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace+LsSpace.SingleRowSpace*j)+vert_vec*jgzj_x.g; else //双排排列 { if(fill_plank_dlg.m_iLsLayOutStyle==0) //靠近楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj_x.g1; else //奇数个螺栓 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj_x.g2; } else //远离楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj_x.g2; else //奇数个螺栓 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj_x.g1; } } pLs->des_base_pos.norm_offset.AddThick(-pBaseJg->handle,TRUE); pLs->des_base_pos.norm_offset.AddThick(-ftol(pPlank->GetThick()*0.5)); ls_pos=ls_pos+pLs->get_norm()*pLs->des_base_pos.norm_offset.Thick(pLs->BelongModel()); pLs->ucs.origin=ls_pos; pBaseJg->AppendMidLsRef(pLs->GetLsRef()); if(pOtherJg) pOtherJg->AppendMidLsRef(pLs->GetLsRef()); pPlank->AppendLsRef(pLs->GetLsRef()); //螺栓位置参数 pLs->des_base_pos.hPart=pPlank->handle; pLs->des_base_pos.datumPoint.datum_pos_style=9; //杆件上的相对位置 pLs->des_base_pos.datumPoint.des_para.hPart=pPlank->handle; pLs->des_base_pos.datumPoint.datum_pos=ls_pos; coord_trans(pLs->des_base_pos.datumPoint.datum_pos,pPlank->ucs,FALSE); pLs->des_base_pos.datumPoint.datum_pos.z=0; //Z坐标归零 pLs->des_base_pos.datumPoint.SetPosition(ls_pos); //到位螺栓 pLs->correct_worknorm(); pLs->correct_pos(); pLs->CalGuigeAuto(); pLs->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pLs->GetSolidPartObject()); } pPlank->CalStdProfile(); pPlank->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pPlank->GetSolidPartObject()); } else if(pGroupJg->group_style==2)//十字型组合 { CLDSLineAngle *pOtherJg1=(CLDSLineAngle*)console.FromPartHandle(pGroupJg->son_jg_h[1],CLS_LINEANGLE); CLDSLineAngle *pOtherJg2=(CLDSLineAngle*)console.FromPartHandle(pGroupJg->son_jg_h[2],CLS_LINEANGLE); CLDSLineAngle *pOtherJg3=(CLDSLineAngle*)console.FromPartHandle(pGroupJg->son_jg_h[3],CLS_LINEANGLE); JGZJ jgzj; if(fill_plank_dlg.m_iWing==0) { //初始板在X肢上 if(!fill_plank_dlg.m_bSwapWing||i%2==0) pPlank->designInfo.norm.norm_wing=0; else pPlank->designInfo.norm.norm_wing=1; } else { //初始板在Y肢上 if(!fill_plank_dlg.m_bSwapWing||i%2==0) pPlank->designInfo.norm.norm_wing=1; else pPlank->designInfo.norm.norm_wing=0; } pPlank->DesignSetupUcs(); //设计钢板装配坐标系 if(fabs(pPlank->ucs.axis_x*pBaseJg->GetWingVecX())>EPS_COS2) { vert_vec=pBaseJg->GetWingVecX(); //螺栓在X肢上 jgzj=jgzj_x; } else { vert_vec=pBaseJg->GetWingVecY(); //螺栓在Y肢上 jgzj=jgzj_y; } ls.EmptyL0DesignPara(); //清空螺栓设计参数 ls.AddL0Thick(pPlank->handle,TRUE); ls.AddL0Thick(pBaseJg->handle,TRUE); ls.AddL0Thick(ftol(pBaseJg->GetThick()),FALSE); if(!ls.CalGuigeAuto()) { char ss[200]=""; #ifdef AFX_TARG_ENU_ENGLISH sprintf(ss,"Can't find fit bolt's G M%dX%.0f.",ls.get_d(),ls.L0); #else sprintf(ss,"找不到合适的螺栓规格M%dX%.0f.",ls.get_d(),ls.L0); #endif throw ss; } for(j=0;j<fill_plank_dlg.m_nLsNum;j++) { //基准角钢上填板螺栓 CLDSBolt *pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls); pLs->cfgword=pBaseJg->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->des_work_norm=ls.des_work_norm; pLs->set_norm(pPlank->ucs.axis_z); if(fill_plank_dlg.m_iLsRows==0) //单排排列 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace+LsSpace.SingleRowSpace*j)+vert_vec*jgzj.g; else //双排排列 { if(fill_plank_dlg.m_iLsLayOutStyle==0) //靠近楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj.g1; else //奇数个螺栓 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj.g2; } else //远离楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj.g2; else //奇数个螺栓 ls_pos=pPlank->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj.g1; } } pLs->des_base_pos.norm_offset.AddThick(-pBaseJg->handle,TRUE); pLs->des_base_pos.norm_offset.AddThick(-ftol(pPlank->GetThick()*0.5)); ls_pos=ls_pos+pLs->get_norm()*pLs->des_base_pos.norm_offset.Thick(pLs->BelongModel()); pLs->ucs.origin=ls_pos; pBaseJg->AppendMidLsRef(pLs->GetLsRef()); if(pOtherJg1&&pOtherJg1->IsLsInWing(pLs)) pOtherJg1->AppendMidLsRef(pLs->GetLsRef()); if(pOtherJg3&&pOtherJg3->IsLsInWing(pLs)) pOtherJg3->AppendMidLsRef(pLs->GetLsRef()); pPlank->AppendLsRef(pLs->GetLsRef()); //螺栓位置参数 pLs->des_base_pos.hPart=pPlank->handle; pLs->des_base_pos.datumPoint.datum_pos_style=9; //杆件上的相对位置 pLs->des_base_pos.datumPoint.des_para.hPart=pPlank->handle; pLs->des_base_pos.datumPoint.datum_pos=ls_pos; coord_trans(pLs->des_base_pos.datumPoint.datum_pos,pPlank->ucs,FALSE); pLs->des_base_pos.datumPoint.datum_pos.z=0; //Z坐标归零 pLs->des_base_pos.datumPoint.SetPosition(ls_pos); //非基准角钢上填板螺栓 if(pOtherJg2==NULL) continue; //另一单角钢楞线上的基准点 SnapPerp(&ber_pick,pOtherJg2->Start(),pOtherJg2->End(),pPlank->ucs.origin); pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls); pLs->cfgword=pBaseJg->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->des_work_norm=ls.des_work_norm; pLs->set_norm(pPlank->ucs.axis_z); if(fill_plank_dlg.m_iLsRows==0) //单排排列 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace+LsSpace.SingleRowSpace*j)-vert_vec*jgzj.g; else //双排排列 { if(nSecType==0) //靠近楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g2; else //奇数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g1; } else //远离楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g1; else //奇数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g2; } } sprintf(pLs->des_base_pos.norm_offset.key_str,"-0X%X",pBaseJg->handle); pLs->des_base_pos.norm_offset.AddThick(-ftol(pPlank->GetThick()*0.5)); ls_pos=ls_pos+pLs->get_norm()*pLs->des_base_pos.norm_offset.Thick(pLs->BelongModel()); pLs->ucs.origin=ls_pos; pOtherJg2->AppendMidLsRef(pLs->GetLsRef()); if(pOtherJg1&&pOtherJg1->IsLsInWing(pLs)) pOtherJg1->AppendMidLsRef(pLs->GetLsRef()); if(pOtherJg3&&pOtherJg3->IsLsInWing(pLs)) pOtherJg3->AppendMidLsRef(pLs->GetLsRef()); pPlank->AppendLsRef(pLs->GetLsRef()); //螺栓位置参数 pLs->des_base_pos.hPart=pPlank->handle; pLs->des_base_pos.datumPoint.datum_pos_style=9; //杆件上的相对位置 pLs->des_base_pos.datumPoint.des_para.hPart=pPlank->handle; pLs->des_base_pos.datumPoint.datum_pos=ls_pos; coord_trans(pLs->des_base_pos.datumPoint.datum_pos,pPlank->ucs,FALSE); pLs->des_base_pos.datumPoint.datum_pos.z=0; //Z坐标归零 pLs->des_base_pos.datumPoint.SetPosition(ls_pos); //到位螺栓 pLs->correct_worknorm(); pLs->correct_pos(); pLs->CalGuigeAuto(); pLs->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pLs->GetSolidPartObject()); } pPlank->CalStdProfile(); pPlank->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pPlank->GetSolidPartObject()); if(fill_plank_dlg.m_iType==1) { CLDSPlate *pPlank2=(CLDSPlate*)console.AppendPart(CLS_PLATE); pPlank2->CopyProperty(pPlank); //设置钢板柔性化参数 pPlank2->designInfo.m_hBasePart=pGroupJg->handle; pPlank2->designInfo.norm.norm_style=1; //角钢肢法线方向 pPlank2->designInfo.norm.hVicePart=pBaseJg->handle; pPlank2->designInfo.norm.direction=0; //钢板位置参数 pPlank2->designInfo=pPlank->designInfo; if(fill_plank_dlg.m_iWing==1) { //初始板在X肢上 if(!fill_plank_dlg.m_bSwapWing||i%2==0) pPlank2->designInfo.norm.norm_wing=0; else pPlank2->designInfo.norm.norm_wing=1; } else { //初始板在Y肢上 if(!fill_plank_dlg.m_bSwapWing||i%2==0) pPlank2->designInfo.norm.norm_wing=1; else pPlank2->designInfo.norm.norm_wing=0; } pPlank2->DesignSetupUcs(); //钢板装配坐标系 if(fabs(pPlank2->ucs.axis_y*pBaseJg->GetWingVecX())>EPS_COS2) { vert_vec=pBaseJg->GetWingVecX(); //螺栓在X肢上 jgzj=jgzj_x; } else { vert_vec=pBaseJg->GetWingVecY(); //螺栓在Y肢上 jgzj=jgzj_y; } ls.des_work_norm.hVicePart=pPlank2->handle; ls.EmptyL0DesignPara(); //清空螺栓设计参数 ls.AddL0Thick(pPlank2->handle,TRUE); ls.AddL0Thick(pBaseJg->handle,TRUE); ls.AddL0Thick(ftol(pBaseJg->GetThick()),FALSE); if(!ls.CalGuigeAuto()) { char ss[200]=""; #ifdef AFX_TARG_ENU_ENGLISH sprintf(ss,"Can't find fit bolt's G M%dX%.0f.",ls.get_d(),ls.L0); #else sprintf(ss,"找不到合适的螺栓规格M%dX%.0f.",ls.get_d(),ls.L0); #endif throw ss; } for(j=0;j<fill_plank_dlg.m_nLsNum;j++) { //基准角钢上填板螺栓 CLDSBolt *pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls); pLs->cfgword=pBaseJg->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->des_work_norm=ls.des_work_norm; pLs->set_norm(pPlank2->ucs.axis_z); if(fill_plank_dlg.m_iLsRows==0) //单排排列 ls_pos=pPlank2->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace+LsSpace.SingleRowSpace*j)+vert_vec*jgzj.g; else //双排排列 { if(fill_plank_dlg.m_iLsLayOutStyle==0) //靠近楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=pPlank2->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj.g1; else //奇数个螺栓 ls_pos=pPlank2->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj.g2; } else //远离楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=pPlank2->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj.g2; else //奇数个螺栓 ls_pos=pPlank2->ucs.origin+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)+vert_vec*jgzj.g1; } } pLs->des_base_pos.norm_offset.AddThick(-pBaseJg->handle,TRUE); pLs->des_base_pos.norm_offset.AddThick(-ftol(pPlank2->GetThick()*0.5)); ls_pos=ls_pos+pLs->get_norm()*pLs->des_base_pos.norm_offset.Thick(pLs->BelongModel()); pLs->ucs.origin=ls_pos; pBaseJg->AppendMidLsRef(pLs->GetLsRef()); if(pOtherJg1&&pOtherJg1->IsLsInWing(pLs)) pOtherJg1->AppendMidLsRef(pLs->GetLsRef()); if(pOtherJg3&&pOtherJg3->IsLsInWing(pLs)) pOtherJg3->AppendMidLsRef(pLs->GetLsRef()); pPlank2->AppendLsRef(pLs->GetLsRef()); //螺栓位置参数 pLs->des_base_pos.hPart=pPlank2->handle; pLs->des_base_pos.datumPoint.datum_pos_style=9; //杆件上的相对位置 pLs->des_base_pos.datumPoint.des_para.hPart=pPlank2->handle; pLs->des_base_pos.datumPoint.datum_pos=ls_pos; coord_trans(pLs->des_base_pos.datumPoint.datum_pos,pPlank2->ucs,FALSE); pLs->des_base_pos.datumPoint.datum_pos.z=0; //Z坐标归零 pLs->des_base_pos.datumPoint.SetPosition(ls_pos); //非基准角钢上填板螺栓 if(pOtherJg2==NULL) continue; pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls); pLs->cfgword=pBaseJg->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->des_work_norm=ls.des_work_norm; if(fill_plank_dlg.m_iLsRows==0) //单排排列 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace+LsSpace.SingleRowSpace*j)-vert_vec*jgzj.g; else //双排排列 { if(nSecType==0) //靠近楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g2; else //奇数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g1; } else //远离楞线一侧优先 { if(j%2==0) //偶数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g1; else //奇数个螺栓 ls_pos=ber_pick+vec*(-plank_len*0.5+LsSpace.EndSpace +LsSpace.doubleRowSpace*j*0.5)-vert_vec*jgzj.g2; } } sprintf(pLs->des_base_pos.norm_offset.key_str,"-0X%X",pBaseJg->handle); pLs->des_base_pos.norm_offset.AddThick(-ftol(pPlank2->GetThick()*0.5)); ls_pos=ls_pos+pLs->get_norm()*pLs->des_base_pos.norm_offset.Thick(pLs->BelongModel()); pLs->ucs.origin=ls_pos; pOtherJg2->AppendMidLsRef(pLs->GetLsRef()); if(pOtherJg1&&pOtherJg1->IsLsInWing(pLs)) pOtherJg1->AppendMidLsRef(pLs->GetLsRef()); if(pOtherJg3&&pOtherJg3->IsLsInWing(pLs)) pOtherJg3->AppendMidLsRef(pLs->GetLsRef()); pPlank2->AppendLsRef(pLs->GetLsRef()); //螺栓位置参数 pLs->des_base_pos.hPart=pPlank2->handle; pLs->des_base_pos.datumPoint.datum_pos_style=9; //杆件上的相对位置 pLs->des_base_pos.datumPoint.des_para.hPart=pPlank2->handle; pLs->des_base_pos.datumPoint.datum_pos=ls_pos; coord_trans(pLs->des_base_pos.datumPoint.datum_pos,pPlank2->ucs,FALSE); pLs->des_base_pos.datumPoint.datum_pos.z=0; //Z坐标归零 pLs->des_base_pos.datumPoint.SetPosition(ls_pos); //到位螺栓 pLs->correct_worknorm(); pLs->correct_pos(); pLs->CalGuigeAuto(); pLs->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pLs->GetSolidPartObject()); } pPlank2->CalStdProfile(); pPlank2->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pPlank->GetSolidPartObject()); CLDSPlate *pNewPlate=(CLDSPlate*)console.AppendPart(CLS_PLATE); long hNew=pNewPlate->handle; //保存钢板句柄 pPlank->CloneTo(*pNewPlate); //克隆钢板 wht 11-01-07 pNewPlate->handle=hNew; //更新钢板句柄 pNewPlate->relativeObjs.Empty();//清空关联构件列表 pNewPlate->EmptyLsRef(); //清空螺栓引用 //复制螺栓引用 for(CLsRef *pLsRef=pPlank->GetFirstLsRef();pLsRef;pLsRef=pPlank->GetNextLsRef()) pNewPlate->AppendLsRef(*pLsRef); pNewPlate->SetModified(); pNewPlate->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength(),g_sysPara.display.nSmoothness); g_pSolidDraw->NewSolidPart(pNewPlate->GetSolidPartObject()); f3dPoint face_pos,face_norm; face_norm=pPlank2->ucs.axis_z; face_pos=pPlank2->ucs.origin; CutPlateByPlane(pPlank,face_pos,face_norm,fill_plank_dlg.m_fDistance); pPlank->m_hPartWeldParent = pPlank2->handle; face_pos+=face_norm*pNewPlate->GetThick(); face_norm*=-1.0; CutPlateByPlane(pNewPlate,face_pos,face_norm,fill_plank_dlg.m_fDistance); pNewPlate->m_hPartWeldParent = pPlank2->handle; } } else #ifdef AFX_TARG_ENU_ENGLISH throw "The style of combine angle is error!Layout filler plate failure!"; #else throw "出现了错误的角钢组合型式!填板布置失败!"; #endif pPlank->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pPlank->GetSolidPartObject()); } } catch(char* sError) { Ta.EndUndoListen(); if(!bTerminateByUser) AfxMessageBox(sError); g_pSolidDraw->ReleaseSnapStatus(); return FALSE; } m_pDoc->SetModifiedFlag(); Ta.EndUndoListen(); g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->Draw(); #endif return TRUE; } //-----------VVV---布置角钢螺栓--------VVV-------- //布置角钢螺栓 一、布置单螺栓连接 二、布置单角钢螺栓 //一、布置单角钢螺栓 void CLDSView::OnLayJgEndLs() { m_nPrevCommandID=ID_LAY_JG_END_LS; #ifdef AFX_TARG_ENU_ENGLISH m_sPrevCommandName="Repeat to layout angle's bolts"; #else m_sPrevCommandName="重复布置角钢螺栓"; #endif #ifndef __LDS_ Command("LayoutAngleBolts"); #else Command("AngleBolts"); //临时LayoutAngleBolts命令,看是否可完全取代 wjh-2019.8.6 #endif } //<DEVELOP_PROCESS_MARK nameId="CLDSView::AngleBolts"> void _LocalLayoutSingleRodBolts(CLDSLinePart* pCurRod, BYTE ciCurWorkWing, RODSECTION sect, CLDSLineAngle* pCrossAngle=NULL); int CLDSView::AngleBolts() { CCmdLockObject cmdlock(this); if(!cmdlock.LockSuccessed()) return FALSE; IDrawing* pDrawing=g_pSolidSet->GetSolidBuddyDrawing(); if(pDrawing==NULL) return FALSE; g_pSolidDraw->ReleaseSnapStatus(); CCmdLineDlg *pCmdLine = ((CMainFrame*)AfxGetMainWnd())->GetCmdLinePage(); DWORD dwhObj=0,dwExportFlag=0; //捕捉待布置螺栓的杆件心线 CLDSLinePart* pCurRod=NULL; HIBERID hiberid; f3dLine briefline; #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("AngleBolt Please select angle bolt line:",""); #else pCmdLine->FillCmdLine("AngleBolt 请选择需要布置螺栓的杆件心线:",""); #endif CSnapTypeVerify verifier(OBJPROVIDER::DRAWINGSPACE,GetSingleWord(IDbEntity::DbLine)); verifier.SetEntsSelectLevel(2); //允许选中角钢肢心线 RODSECTION section; section.ciSectType=-1; while(1) { if(g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verifier)<0) { pCmdLine->CancelCmdLine(); return 0; } SELOBJ obj(dwhObj,dwExportFlag,pDrawing); pCurRod=(CLDSLinePart*)console.FromPartHandle(obj.hRelaObj,CLS_LINEANGLE,CLS_LINEFLAT,CLS_LINESLOT); if(pCurRod) { if(pCurRod->pStart&&pCurRod->pEnd) { briefline.startPt=pCurRod->pStart->Position(false); briefline.endPt =pCurRod->pEnd->Position(false); } IDbEntity* pAxisLine=obj.idEnt>0?pDrawing->GetDbEntity(obj.idEnt):NULL; if(pAxisLine&&pAxisLine->GetDbEntType()==IDbEntity::DbLine) { hiberid=pAxisLine->GetHiberId(); POINT point; GetCursorPos(&point); ScreenToClient(&point); IDbLine *pLine=(IDbLine*)pAxisLine; GECS ocs; pDrawing->GetOCS(ocs); f3dLine axisline(ocs.TransPToCS(pLine->StartPosition()), ocs.TransPToCS(pLine->EndPosition())); GEPOINT lineStdVec=axisline.endPt-axisline.startPt; GEPOINT xScrStart=g_pSolidOper->TransPToScr(axisline.startPt); GEPOINT xScrEnd=g_pSolidOper->TransPToScr(axisline.endPt); GEPOINT lineStdVec2(xScrEnd.x-xScrStart.x,xScrEnd.y-xScrStart.y); double scaleOfS2E=0,length=0,lengthProj=lineStdVec2.mod(); if(lengthProj>EPS) { lineStdVec2 /= lengthProj; scaleOfS2E=GEPOINT(point.x-xScrStart.x,point.y-xScrStart.y)*lineStdVec2; scaleOfS2E /= lengthProj; } if((length=lineStdVec.mod())>EPS) { lineStdVec/=length; double sectlen=max(length*0.25,100); if(sectlen>length/2) sectlen=length/2; else if(pCurRod->pStart==NULL||pCurRod->pEnd==NULL) sectlen=length/2; double lendist=scaleOfS2E*length; if(lendist<sectlen) section.ciSectType=1; else if(lendist>length-sectlen) section.ciSectType=2; } } break; } #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("AngleBolt Nonselect valid angle. Please select angle bolt line:",""); #else pCmdLine->FillCmdLine("AngleBolt 没有选中合适的杆件心线,请重新选择需要布置螺栓的杆件心线:",""); #endif } pCmdLine->FinishCmdLine(CXhChar16("0X%X",pCurRod->handle)); //选择节点布置截面定位螺栓或选择另一根杆件肢心线布置交叉点螺栓 CLDSNode* pBaseNode=NULL; CLDSLinePart* pOtherRod=NULL; if(pCurRod->GetClassTypeId()==CLS_LINEANGLE) { #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("AngleBolt Please select connected node which angle's bolts attached,or select other angle bolt line:",""); #else pCmdLine->FillCmdLine("AngleBolt 请选择杆件上布置螺栓的定位基准(节点、相交角钢),或按键<回车|空格>跳出:",""); #endif verifier.ClearSnapFlag(); verifier.SetVerifyFlag(OBJPROVIDER::SOLIDSPACE,GetSingleWord(SELECTINDEX_NODE)|GetSingleWord(SELECTINDEX_LINEANGLE)); verifier.AddVerifyType(OBJPROVIDER::LINESPACE,AtomType::prPoint); } else { #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("AngleBolt Please select connected node which angle's bolts attached,or select other angle bolt line:",""); #else pCmdLine->FillCmdLine("AngleBolt 请选择杆件上布置螺栓的定位截面节点,或按键<回车|空格>跳出:",""); #endif verifier.ClearSnapFlag(); verifier.SetVerifyFlag(OBJPROVIDER::SOLIDSPACE,GetSingleWord(SELECTINDEX_NODE)); verifier.AddVerifyType(OBJPROVIDER::LINESPACE,AtomType::prPoint); } {//此作用域控制节点显示的生命周期 CDisplayNodeAtFrontLife showPoint; showPoint.DisplayNodeAtFront(); while(1) { if(g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verifier)<0) { pCmdLine->CancelCmdLine(); return 0; } SELOBJ obj(dwhObj,dwExportFlag); if(pCurRod->handle==obj.hRelaObj) continue; //不能重复选择同一根角钢 if(obj.hRelaObj==0 && obj.ciTriggerType == SELOBJ::TRIGGER_KEYRETURN) break; //按回车或空格跳出 if((pBaseNode=console.FromNodeHandle(obj.hRelaObj))==NULL) pOtherRod=(CLDSLinePart*)console.FromPartHandle(obj.hRelaObj,CLS_LINEANGLE); if(pBaseNode) { if(briefline.PtInLine(pBaseNode->Position(false))!=0) break; #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("AngleBolt Nonselect valid angle. Please select angle bolt line:",""); #else pCmdLine->FillCmdLine("AngleBolt 没有选中合适的节点,请重新选择节点,或相交的角钢:",""); #endif } else if(pOtherRod) { if(pOtherRod->pStart&&pOtherRod->pEnd) break; #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("AngleBolt Nonselect valid angle. Please select angle bolt line:",""); #else pCmdLine->FillCmdLine("AngleBolt 没有选中有效的交叉角钢,请重新选择节点,或相交的角钢:",""); #endif } } if(pBaseNode) { g_pSolidDraw->SetEntSnapStatus(pBaseNode->handle); pCmdLine->FinishCmdLine(CXhChar16("0X%X",pBaseNode->handle)); } else if(pOtherRod) { g_pSolidDraw->SetEntSnapStatus(pOtherRod->handle); pCmdLine->FinishCmdLine(CXhChar16("0X%X",pOtherRod->handle)); } else pCmdLine->FinishCmdLine("<回车>"); } //布置螺栓 CUndoOperObject undo(&Ta,true); if(pCurRod) { BYTE ciSelWorkWing=0; //当前选中的角钢心线肢,'X','Y' if(pCurRod->IsAngle()) { if(hiberid.HiberUpId(1)==0&&hiberid.HiberUpId(2)==0) ciSelWorkWing=0; //当前选中的是X肢心线 else if(hiberid.HiberUpId(1)==0&&hiberid.HiberUpId(2)==1) ciSelWorkWing=1; //当前选中的是Y肢心线 } else if(pCurRod->GetClassTypeId()==CLS_LINESLOT) { if(hiberid.HiberUpId(1)==0&&hiberid.HiberUpId(2)==0) ciSelWorkWing=0; //槽面 else if(hiberid.HiberUpId(1)==0&&hiberid.HiberUpId(2)==1) ciSelWorkWing=1; //X+肢 else if(hiberid.HiberUpId(1)==0&&hiberid.HiberUpId(2)==2) ciSelWorkWing=2; //X-肢 } else if(pCurRod->GetClassTypeId()==CLS_LINEFLAT) ciSelWorkWing=0; CLDSLineAngle* pOtherAngle=NULL; if(pOtherRod && pOtherRod->IsAngle()) pOtherAngle=(CLDSLineAngle*)pOtherRod; if(pBaseNode!=NULL||section.ciSectType<0) { section.pSectNode=pBaseNode; section.ciSectType=0; } _LocalLayoutSingleRodBolts((CLDSLineAngle*)pCurRod,ciSelWorkWing,section,pOtherAngle); } // g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->Draw(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Command:",""); #else pCmdLine->FillCmdLine("命令:",""); #endif return 0; } //</DEVELOP_PROCESS_MARK> int CLDSView::LayoutAngleBolts() { CLDSLinePart *pLinePart=NULL; CLDSNode *pBaseNode=NULL; CString cmdStr; CCmdLineDlg *pCmdLine = ((CMainFrame*)AfxGetMainWnd())->GetCmdLinePage(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("LayoutAngleBolts Please select angle(slot angle or flat angle)which will be layout bolts:",""); #else pCmdLine->FillCmdLine("LayoutAngleBolts 请选择需要布置螺栓的角钢(槽钢或扁钢):",""); #endif CCmdLockObject cmdlock(this); long *id_arr,n=g_pSolidSnap->GetLastSelectEnts(id_arr); if(n==1) pLinePart=(CLDSLinePart*)console.FromPartHandle(id_arr[0],CLS_LINEPART); if(pLinePart==NULL) { g_pSolidDraw->ReleaseSnapStatus(); Invalidate(FALSE); } DWORD dwhObj=0,dwExportFlag=0; CSnapTypeVerify verifier(OBJPROVIDER::SOLIDSPACE,GetSingleWord(SELECTINDEX_LINEANGLE)| GetSingleWord(SELECTINDEX_LINESLOT)|GetSingleWord(SELECTINDEX_LINEFLAT)); verifier.AddVerifyType(OBJPROVIDER::LINESPACE,AtomType::prLine); f3dLine line; try{ if(pLinePart==NULL) { while(1) { if(g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verifier)<0) { pCmdLine->CancelCmdLine(); //布置完螺栓退出命令时,切换到实体显示模式 g_pSolidSet->SetDisplayType(DISP_SOLID); Invalidate(FALSE); return 0; } SELOBJ obj(dwhObj,dwExportFlag); dwhObj=obj.hRelaObj; if(dwhObj>0x20) { pLinePart=(CLDSLinePart*)console.FromPartHandle(dwhObj,CLS_LINEPART); if(pLinePart) { if(pLinePart->pStart&&pLinePart->pEnd) { line.startPt=pLinePart->pStart->Position(false); line.endPt =pLinePart->pEnd->Position(false); } break; } } #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Please select angle(slot angle or flat angle)which will be layout bolts:",""); #else pCmdLine->FillCmdLine("没有选中合适的构件,请重新选择需要布置螺栓的角钢(槽钢或扁钢):",""); #endif } g_pSolidDraw->SetEntSnapStatus(pLinePart->handle); pCmdLine->FinishCmdLine(CXhChar16("0X%X",pLinePart->handle)); } pCmdLine->FinishCmdLine(); if(!(pLinePart->IsAngle()&&pLinePart->pStart==NULL&&pLinePart->pEnd==NULL)) { //布置短角钢螺栓时,不需要选择节点 #ifdef AFX_TARG_ENU_ENGLISH if(pLinePart->GetClassTypeId()==CLS_LINEANGLE||pLinePart->GetClassTypeId()==CLS_GROUPLINEANGLE) pCmdLine->FillCmdLine("Please select connected node which angle's bolts attached:",""); else if(pLinePart->GetClassTypeId()==CLS_LINESLOT) pCmdLine->FillCmdLine("Please select connected node which slot angle's bolts attached:",""); else if(pLinePart->GetClassTypeId()==CLS_LINEFLAT) pCmdLine->FillCmdLine("Please select connected node which flat angle's bolts attached:",""); else if(pLinePart->GetClassTypeId()==CLS_LINETUBE) pCmdLine->FillCmdLine("Please select connected node which tube's bolts attached:",""); #else if(pLinePart->GetClassTypeId()==CLS_LINEANGLE||pLinePart->GetClassTypeId()==CLS_GROUPLINEANGLE) pCmdLine->FillCmdLine("请选择角钢上布置螺栓所归属的连接节点:",""); else if(pLinePart->GetClassTypeId()==CLS_LINESLOT) pCmdLine->FillCmdLine("请选择槽钢上布置螺栓所归属的连接节点:",""); else if(pLinePart->GetClassTypeId()==CLS_LINEFLAT) pCmdLine->FillCmdLine("请选择扁钢上布置螺栓所归属的连接节点:",""); else if(pLinePart->GetClassTypeId()==CLS_LINETUBE) pCmdLine->FillCmdLine("请选择钢管上布置螺栓所归属的连接节点:",""); #endif CDisplayNodeAtFrontLife showPoint; showPoint.DisplayNodeAtFront(); verifier.ClearSnapFlag(); verifier.SetVerifyFlag(OBJPROVIDER::SOLIDSPACE,GetSingleWord(SELECTINDEX_NODE)); verifier.AddVerifyType(OBJPROVIDER::LINESPACE,AtomType::prPoint); while(1) { if(g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verifier)<0) { pCmdLine->CancelCmdLine(); //布置完螺栓退出命令时,切换到实体显示模式 g_pSolidSet->SetDisplayType(DISP_SOLID); Invalidate(FALSE); return 0; } SELOBJ obj(dwhObj,dwExportFlag); dwhObj=obj.hRelaObj; if(dwhObj>0x20) { pBaseNode=console.FromNodeHandle(dwhObj); if(pBaseNode&&line.PtInLine(pBaseNode->Position(false))!=0) break; } } g_pSolidDraw->SetEntSnapStatus(pBaseNode->handle); pCmdLine->FinishCmdLine(CXhChar16("0X%X",pBaseNode->handle)); showPoint.HideNodeAtFront(); } int i=0; if(pLinePart->GetClassTypeId()==CLS_GROUPLINEANGLE) { //布置组合角钢螺栓 g_pSolidSet->SetDisplayType(DISP_SOLID); g_pSolidDraw->Draw(); CLDSGroupLineAngle *pGroupAngle=(CLDSGroupLineAngle*)pLinePart; for(i=0;i<4;i++) { CLDSLineAngle *pCommBaseJg=NULL,*pBackToBackJgX=NULL,*pBackToBackJgY=NULL; if(pGroupAngle->group_style==2) { //布置十字组合角钢螺栓时,仅需布置1号和3号子角钢的螺栓 wht 09-09-07 //系统会自动将1号角钢上的螺栓引入到2,4号角钢上,将3号角钢上的螺栓引入到2,4号角钢上 if(i==1||i==3) continue; if(i==0) { //1号角钢X肢螺栓引入到2号角钢,Y肢上的螺栓引入到4号角钢 wht 09-10-11 if(pGroupAngle->son_jg_h[1]>=0x20) pBackToBackJgX=(CLDSLineAngle*)console.FromPartHandle(pGroupAngle->son_jg_h[1],CLS_LINEANGLE); if(pGroupAngle->son_jg_h[3]>0x20) pBackToBackJgY=(CLDSLineAngle*)console.FromPartHandle(pGroupAngle->son_jg_h[3],CLS_LINEANGLE); } else if(i==2) { //3号角钢Y肢螺栓引入到2号角钢,X肢上的螺栓引入到4号角钢 wht 09-10-11 if(pGroupAngle->son_jg_h[3]>=0x20) pBackToBackJgX=(CLDSLineAngle*)console.FromPartHandle(pGroupAngle->son_jg_h[3],CLS_LINEANGLE); if(pGroupAngle->son_jg_h[1]>=0x20) pBackToBackJgY=(CLDSLineAngle*)console.FromPartHandle(pGroupAngle->son_jg_h[1],CLS_LINEANGLE); } } if(pGroupAngle&&pGroupAngle->son_jg_h[i]>=0x20) pCommBaseJg=(CLDSLineAngle*)console.FromPartHandle(pGroupAngle->son_jg_h[i],CLS_LINEANGLE); if(pCommBaseJg==NULL||pCommBaseJg->m_bVirtualPart) continue; //不存在对应的子角钢或子角钢为虚拟构件 wht 11-07-25 g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->SetEntSnapStatus(pCommBaseJg->handle); LayoutSingleAngleBolts(pCommBaseJg,pBaseNode,pBackToBackJgX,pBackToBackJgY); } } else if(pLinePart->GetClassTypeId()==CLS_LINEANGLE) //布置单角钢 LayoutSingleAngleBolts((CLDSLineAngle*)pLinePart,pBaseNode); else if (pLinePart->GetClassTypeId()==CLS_LINEFLAT||pLinePart->GetClassTypeId()==CLS_LINESLOT)//槽钢、扁钢螺栓 LayoutSlotOrFlatBolts(pLinePart,pBaseNode); else if (pLinePart->GetClassTypeId()==CLS_LINETUBE) LayoutTubeBolts((CLDSLineTube*)pLinePart,pBaseNode);//钢管 g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->Draw(); m_pDoc->SetModifiedFlag(); // 修改数据后应调用此函数置修改标志. Ta.EndUndoListen(); pCmdLine->FinishCmdLine(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Command:",""); #else pCmdLine->FillCmdLine("命令:",""); #endif } catch(char* sError) { AfxMessageBox(sError); } return 0; } void _LocalLayoutSingleRodBolts(CLDSLinePart* pCurRod,BYTE ciCurWorkWing,RODSECTION sect,CLDSLineAngle* pCrossAngle/*=NULL*/) { if(pCurRod==NULL) return ; int iInitRayNo=1; ATOM_LIST<RAYNO_RECORD>rayNoList; ATOM_LIST<CDesignLsPara>ls_list; CLayAngleBoltDlg laybolt_dlg; laybolt_dlg.m_pLinePart = pCurRod; laybolt_dlg.m_ciSectType = sect.ciSectType; laybolt_dlg.m_pNode = sect.pSectNode; laybolt_dlg.m_pLsList = &ls_list; laybolt_dlg.m_iOffsetWing = ciCurWorkWing; //laybolt_dlg.m_iBoltNorm = ciCurWorkWing; laybolt_dlg.viewNorm = console.GetActiveView()->ucs.axis_z; laybolt_dlg.m_bIncPlateProfilePara = FALSE; laybolt_dlg.m_bTwoEdgeProfile = FALSE; if (pCrossAngle) { laybolt_dlg.m_iDatumPointStyle = 3; //心线交点 laybolt_dlg.m_hCrossAngle.Format("0X%X", pCrossAngle->handle); } if (laybolt_dlg.DoModal() != IDOK) return; //根据用户输入在角钢上布置螺栓 for(CDesignLsPara *pLsPara=ls_list.GetFirst();pLsPara;pLsPara=ls_list.GetNext()) { CLDSBolt *pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->des_base_pos=pLsPara->des_base_pos; pBolt->des_work_norm=pLsPara->des_work_norm; pBolt->set_d(pLsPara->d); pBolt->iSeg = pCurRod->iSeg; pBolt->CopyModuleInstanceInfo(pCurRod); //调整螺栓配材号与基准构件配材号一致 pBolt->SetGrade(pLsPara->grade); pBolt->AddL0Thick(pCurRod->handle,TRUE); pBolt->m_cFuncType=laybolt_dlg.m_iHoleFuncType; pBolt->m_bVirtualPart=(pBolt->m_cFuncType>=2); if (pBolt->d == 12 || pBolt->d == 16 || pBolt->d == 20 || pBolt->d == 24) pBolt->hole_d_increment = 1.5; else pBolt->hole_d_increment = 0; pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->CalGuigeAuto(); HOLE_WALL* pHoleWall = NULL; if (pBolt->m_bVirtualPart) { //添加挂线孔,不显示螺栓实体,显示孔壁 wxc-2019.7.24 if((pHoleWall = console.MakeHoleWall(pBolt, pCurRod))==NULL) { pHoleWall = console.hashHoles.Add(DUALKEY(pBolt->handle, pCurRod->handle)); pHoleWall->pBolt = pBolt; for (int j = 0; j < 4; j++) { if (pHoleWall->items[j].hRelaPart == pCurRod->handle) break; else if (pHoleWall->items[j].hRelaPart == 0) { pHoleWall->items[j].hRelaPart = pCurRod->handle; break; } } pHoleWall->is_visible = TRUE; pHoleWall->Create3dSolidModel(g_pSolidOper->GetScaleUserToScreen(), g_pSolidOper->GetScaleUserToScreen(), g_sysPara.display.nSmoothness); } pBolt->is_visible = FALSE; g_pSolidDraw->NewSolidPart(pHoleWall->GetSolidPartObject()); } else { pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); } // if(sect.ciSectType==0||(sect.pSectNode&&sect.pSectNode==pCurRod->pStart)) pCurRod->AppendStartLsRef(pBolt->GetLsRef()); else if(sect.ciSectType==1||(sect.pSectNode&&sect.pSectNode==pCurRod->pEnd)) pCurRod->AppendEndLsRef(pBolt->GetLsRef()); else pCurRod->AppendMidLsRef(pBolt->GetLsRef()); if (pBolt->m_bVirtualPart) { //绘制角钢上螺栓孔 pCurRod->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pCurRod->GetSolidPartObject()); } //交叉点定位 if(pBolt->des_base_pos.datumPoint.datum_pos_style==3) { CLDSLineAngle *pCrossAngle=(CLDSLineAngle*)console.FromPartHandle(pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2,CLS_LINEANGLE); f3dPoint wing_vec,wing_norm,datum_pos; if(fabs(pBolt->ucs.axis_z*pCrossAngle->get_norm_x_wing())> fabs(pBolt->ucs.axis_z*pCrossAngle->get_norm_y_wing())) { wing_vec=pCrossAngle->GetWingVecX(); wing_norm=pCrossAngle->get_norm_x_wing(); } else { wing_vec=pCrossAngle->GetWingVecY(); wing_norm=pCrossAngle->get_norm_y_wing(); } datum_pos=pCrossAngle->Start(); f3dPoint pos; Int3dlf(pos,pBolt->ucs.origin,pBolt->ucs.axis_z,pCrossAngle->Start(),wing_norm); f3dPoint bolt_vec=pos-datum_pos; double dd=bolt_vec*wing_vec; if(dd>0&&dd<pCrossAngle->GetWidth()) { //交叉螺栓位于交叉角钢内 pCrossAngle->AppendMidLsRef(pBolt->GetLsRef()); pBolt->AddL0Thick(pCrossAngle->handle,TRUE); } if (pBolt->m_bVirtualPart && pHoleWall) { //绘制交叉角钢上螺栓孔及孔壁实体 for (int j = 0; j < 4; j++) { if (pHoleWall->items[j].hRelaPart == pCrossAngle->handle) break; else if (pHoleWall->items[j].hRelaPart == 0) { pHoleWall->items[j].hRelaPart = pCrossAngle->handle; break; } } pHoleWall->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pHoleWall->GetSolidPartObject()); pCrossAngle->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pCrossAngle->GetSolidPartObject()); } } // if(pCurRod->GetClassTypeId()==CLS_LINEANGLE) { CLDSLineAngle* pCurAngle=(CLDSLineAngle*)pCurRod; double g=0.0; g=pCurAngle->GetLsG(pBolt); for(RAYNO_RECORD *pRayNo=rayNoList.GetFirst();pRayNo;pRayNo=rayNoList.GetNext()) { if(ftoi(pRayNo->yCoord)==ftoi(g)) { pBolt->dwRayNo=pRayNo->dwRayNo; break; } } if(pRayNo==NULL) { pRayNo=rayNoList.append(); pRayNo->dwRayNo=GetSingleWord(iInitRayNo); pRayNo->hPart=pBolt->des_base_pos.hPart; pRayNo->yCoord=g; pBolt->dwRayNo=pRayNo->dwRayNo; iInitRayNo++; } } } pCurRod->SetModified(); } void CLDSView::LayoutSingleRodBolts(CLDSLinePart* pCurRod, BYTE ciCurWorkWing, CLDSNode* pBaseNode, CLDSLineAngle* pCrossAngle/*=NULL*/) { _LocalLayoutSingleRodBolts(pCurRod,ciCurWorkWing,RODSECTION(pBaseNode),pCrossAngle); } void CLDSView::LayoutTubeBolts(CLDSLineTube* pLineTube,CLDSNode* pBaseNode) { #ifdef __COMPLEX_PART_INC_ if(pBaseNode==NULL||pLineTube==NULL) return; CLayTubeBoltDlg laybolt_dlg; ATOM_LIST<CDesignLsPara>ls_list; CDesignLsPara ls_stru; int iInitRayNo=1; ATOM_LIST<RAYNO_RECORD>rayNoList; laybolt_dlg.m_pTube = pLineTube; laybolt_dlg.m_pNode = pBaseNode; laybolt_dlg.m_pLsList=&ls_list; laybolt_dlg.viewNorm = console.GetActiveView()->ucs.axis_z; if(laybolt_dlg.DoModal()!=IDOK) return; Ta.BeginUndoListen(); pLineTube->SetModified(); pLineTube->CalPosition(); pLineTube->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength(),g_sysPara.display.nSmoothness); g_pSolidDraw->NewSolidPart(pLineTube->GetSolidPartObject()); //根据用户输入在角钢上布置螺栓 for(CDesignLsPara *pLsPara=ls_list.GetFirst();pLsPara;pLsPara=ls_list.GetNext()) { CLDSLineAngle *pBackToBackJg=NULL; CLDSBolt *pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->des_base_pos=pLsPara->des_base_pos; pBolt->des_work_norm=pLsPara->des_work_norm; pBolt->set_d(pLsPara->d); pBolt->m_bVirtualPart=pLsPara->m_bVirtualPart; pBolt->iSeg = pLineTube->iSeg; pBolt->cfgword=pLineTube->cfgword; //调整螺栓配材号与基准构件配材号一致 pBolt->SetGrade(pLsPara->grade); pBolt->AddL0Thick(pLineTube->handle,TRUE); if(pBackToBackJg) { //更新螺栓通厚以及法向偏移量 pBolt->AddL0Thick(pBackToBackJg->handle,TRUE); if(pBolt->des_work_norm.direction==1) //朝内 pBolt->des_base_pos.norm_offset.AddThick(-pBackToBackJg->handle,TRUE,TRUE); } pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->CalGuigeAuto(); pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); if(pBaseNode==pLineTube->pStart) pLineTube->AppendStartLsRef(pBolt->GetLsRef()); else if(pBaseNode==pLineTube->pEnd) pLineTube->AppendEndLsRef(pBolt->GetLsRef()); else pLineTube->AppendMidLsRef(pBolt->GetLsRef()); double g=0.0; for(RAYNO_RECORD *pRayNo=rayNoList.GetFirst();pRayNo;pRayNo=rayNoList.GetNext()) { if(ftoi(pRayNo->yCoord)==ftoi(g)) { pBolt->dwRayNo=pRayNo->dwRayNo; break; } } if(pRayNo==NULL) { pRayNo=rayNoList.append(); pRayNo->dwRayNo=GetSingleWord(iInitRayNo); pRayNo->hPart=pBolt->des_base_pos.hPart; pRayNo->yCoord=g; pBolt->dwRayNo=pRayNo->dwRayNo; iInitRayNo++; } } if(pBaseNode==pLineTube->pStart&&pLineTube->desStartOdd.m_iOddCalStyle==1) pLineTube->CalStartOddment(); else if(pBaseNode==pLineTube->pEnd&&pLineTube->desEndOdd.m_iOddCalStyle==1) pLineTube->CalEndOddment(); pLineTube->SetModified(); #endif } void CLDSView::LayoutSlotOrFlatBolts(CLDSLinePart *pLinePart,CLDSNode *pBaseNode) { if(pBaseNode==NULL||pLinePart==NULL||(pLinePart->GetClassTypeId()!=CLS_LINEFLAT&&pLinePart->GetClassTypeId()!=CLS_LINESLOT)) return; CLayAngleBoltDlg laybolt_dlg; ATOM_LIST<CDesignLsPara>ls_list; CDesignLsPara ls_stru; int iInitRayNo=1; ATOM_LIST<RAYNO_RECORD>rayNoList; if(pBaseNode==pLinePart->pEnd) { laybolt_dlg.m_iOddCalStyle=pLinePart->desEndOdd.m_iOddCalStyle; laybolt_dlg.m_fOddment=pLinePart->endOdd(); laybolt_dlg.m_iRayDirection=1; //终->始 } else if(pBaseNode==pLinePart->pStart) { laybolt_dlg.m_iOddCalStyle=pLinePart->desStartOdd.m_iOddCalStyle; laybolt_dlg.m_fOddment=pLinePart->startOdd(); laybolt_dlg.m_iRayDirection=0; //始->终 } laybolt_dlg.m_pLinePart = pLinePart; laybolt_dlg.m_pNode = pBaseNode; laybolt_dlg.m_pLsList=&ls_list; laybolt_dlg.viewNorm = console.GetActiveView()->ucs.axis_z; if(laybolt_dlg.DoModal()!=IDOK) return; Ta.BeginUndoListen(); if(pBaseNode==pLinePart->pEnd) { pLinePart->desEndOdd.m_iOddCalStyle=laybolt_dlg.m_iOddCalStyle; pLinePart->SetEndOdd(laybolt_dlg.m_fOddment); /*if(laybolt_dlg.m_iOffsetWing==0) pLinePart->desEndPos.wing_x_offset.offsetDist=laybolt_dlg.m_fAngleEndNormOffset; else pLinePart->desEndPos.wing_y_offset.offsetDist=laybolt_dlg.m_fAngleEndNormOffset;*/ pLinePart->SetModified(); pLinePart->CalPosition(); pLinePart->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength(),g_sysPara.display.nSmoothness); g_pSolidDraw->NewSolidPart(pLinePart->GetSolidPartObject()); } else if(pBaseNode==pLinePart->pStart) { pLinePart->desStartOdd.m_iOddCalStyle=laybolt_dlg.m_iOddCalStyle; pLinePart->SetStartOdd(laybolt_dlg.m_fOddment); /*if(laybolt_dlg.m_iOffsetWing==0) pLinePart->desStartPos.wing_x_offset.offsetDist=laybolt_dlg.m_fAngleEndNormOffset; else pLinePart->desStartPos.wing_y_offset.offsetDist=laybolt_dlg.m_fAngleEndNormOffset;*/ pLinePart->SetModified(); pLinePart->CalPosition(); pLinePart->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength(),g_sysPara.display.nSmoothness); g_pSolidDraw->NewSolidPart(pLinePart->GetSolidPartObject()); } //根据用户输入在角钢上布置螺栓 for(CDesignLsPara *pLsPara=ls_list.GetFirst();pLsPara;pLsPara=ls_list.GetNext()) { CLDSBolt *pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->des_base_pos=pLsPara->des_base_pos; pBolt->des_work_norm=pLsPara->des_work_norm; pBolt->set_d(pLsPara->d); pBolt->iSeg = pLinePart->iSeg; pBolt->cfgword=pLinePart->cfgword; //调整螺栓配材号与基准构件配材号一致 pBolt->SetGrade(pLsPara->grade); pBolt->AddL0Thick(pLinePart->handle,TRUE); pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->CalGuigeAuto(); pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); if(pBaseNode==pLinePart->pStart) pLinePart->AppendStartLsRef(pBolt->GetLsRef()); else if(pBaseNode==pLinePart->pEnd) pLinePart->AppendEndLsRef(pBolt->GetLsRef()); else pLinePart->AppendMidLsRef(pBolt->GetLsRef()); if(pBolt->des_base_pos.datumPoint.datum_pos_style==3) //交叉点定位 { CLDSLineAngle *pCrossAngle=(CLDSLineAngle*)console.FromPartHandle(pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2,CLS_LINEANGLE); if(pCrossAngle) { f3dPoint pos,bolt_vec,wing_vec; if(fabs(pBolt->ucs.axis_z*pCrossAngle->get_norm_x_wing())> fabs(pBolt->ucs.axis_z*pCrossAngle->get_norm_y_wing())) { wing_vec=pCrossAngle->GetWingVecX(); Int3dlf(pos,pBolt->ucs.origin,pBolt->ucs.axis_z, pCrossAngle->Start(),pCrossAngle->get_norm_x_wing()); } else { wing_vec=pCrossAngle->GetWingVecY(); Int3dlf(pos,pBolt->ucs.origin,pBolt->ucs.axis_z, pCrossAngle->Start(),pCrossAngle->get_norm_y_wing()); } bolt_vec=pos-pCrossAngle->Start(); double dd=bolt_vec*wing_vec; if(dd>0&&dd<pCrossAngle->GetWidth()) { //交叉螺栓位于交叉角钢内 pCrossAngle->AppendMidLsRef(pBolt->GetLsRef()); pBolt->AddL0Thick(pCrossAngle->handle,TRUE); } } } /*double g=0.0; g=pLinePart->GetLsG(pBolt); for(RAYNO_RECORD *pRayNo=rayNoList.GetFirst();pRayNo;pRayNo=rayNoList.GetNext()) { if(ftoi(pRayNo->yCoord)==ftoi(g)) { pBolt->dwRayNo=pRayNo->dwRayNo; break; } } if(pRayNo==NULL) { pRayNo=rayNoList.append(); pRayNo->dwRayNo=GetSingleWord(iInitRayNo); pRayNo->hPart=pBolt->des_base_pos.hPart; pRayNo->yCoord=g; pBolt->dwRayNo=pRayNo->dwRayNo; iInitRayNo++; }*/ } if(pBaseNode==pLinePart->pStart&&pLinePart->desStartOdd.m_iOddCalStyle==1) pLinePart->CalStartOddment(); else if(pBaseNode==pLinePart->pEnd&&pLinePart->desEndOdd.m_iOddCalStyle==1) pLinePart->CalEndOddment(); pLinePart->SetModified(); } void CLDSView::LayoutSingleAngleBolts(CLDSLineAngle *pLineAngle, CLDSNode *pBaseNode, CLDSLineAngle *pBackToBackJgX/*=NULL*/,CLDSLineAngle *pBackToBackJgY/*=NULL*/) { CLayAngleBoltDlg laybolt_dlg; ATOM_LIST<CDesignLsPara>ls_list; CDesignLsPara ls_stru; int iInitRayNo=1; ATOM_LIST<RAYNO_RECORD>rayNoList; if(pLineAngle==NULL||(pLineAngle->pStart&&pLineAngle->pEnd&&pBaseNode==NULL)) return; if(pBaseNode&&pBaseNode==pLineAngle->pEnd) { laybolt_dlg.m_iOddCalStyle=pLineAngle->desEndOdd.m_iOddCalStyle; laybolt_dlg.m_fOddment=pLineAngle->endOdd(); laybolt_dlg.m_iRayDirection=1; //终->始 } else if((pBaseNode&&pBaseNode==pLineAngle->pStart)|| (pLineAngle->pStart==NULL&&pLineAngle->pEnd==NULL)) { laybolt_dlg.m_iOddCalStyle=pLineAngle->desStartOdd.m_iOddCalStyle; laybolt_dlg.m_fOddment=pLineAngle->startOdd(); laybolt_dlg.m_iRayDirection=0; //始->终 } laybolt_dlg.m_pLinePart = pLineAngle; laybolt_dlg.m_pNode = pBaseNode; laybolt_dlg.m_pLsList=&ls_list; laybolt_dlg.viewNorm = console.GetActiveView()->ucs.axis_z; if(laybolt_dlg.DoModal()!=IDOK) return; Ta.BeginUndoListen(); if(pBaseNode&&pBaseNode==pLineAngle->pEnd) { pLineAngle->desEndOdd.m_iOddCalStyle=laybolt_dlg.m_iOddCalStyle; pLineAngle->SetEndOdd(laybolt_dlg.m_fOddment); if(laybolt_dlg.m_iOffsetWing==0) pLineAngle->desEndPos.wing_x_offset.offsetDist=laybolt_dlg.m_fAngleEndNormOffset; else pLineAngle->desEndPos.wing_y_offset.offsetDist=laybolt_dlg.m_fAngleEndNormOffset; pLineAngle->SetModified(); pLineAngle->CalPosition(); pLineAngle->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength(),g_sysPara.display.nSmoothness); g_pSolidDraw->NewSolidPart(pLineAngle->GetSolidPartObject()); } else if((pBaseNode&&pBaseNode==pLineAngle->pStart)|| (pLineAngle->pStart==NULL&&pLineAngle->pEnd==NULL)) { pLineAngle->desStartOdd.m_iOddCalStyle=laybolt_dlg.m_iOddCalStyle; pLineAngle->SetStartOdd(laybolt_dlg.m_fOddment); if(laybolt_dlg.m_iOffsetWing==0) pLineAngle->desStartPos.wing_x_offset.offsetDist=laybolt_dlg.m_fAngleEndNormOffset; else pLineAngle->desStartPos.wing_y_offset.offsetDist=laybolt_dlg.m_fAngleEndNormOffset; pLineAngle->SetModified(); pLineAngle->CalPosition(); pLineAngle->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength(),g_sysPara.display.nSmoothness); g_pSolidDraw->NewSolidPart(pLineAngle->GetSolidPartObject()); } //根据用户输入在角钢上布置螺栓 for(CDesignLsPara *pLsPara=ls_list.GetFirst();pLsPara;pLsPara=ls_list.GetNext()) { CLDSLineAngle *pBackToBackJg=NULL; if(pLsPara->des_work_norm.norm_wing==0) //X肢 pBackToBackJg=pBackToBackJgX; else if(pLsPara->des_work_norm.norm_wing==1)//Y肢 pBackToBackJg=pBackToBackJgY; CLDSBolt *pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->des_base_pos=pLsPara->des_base_pos; pBolt->des_work_norm=pLsPara->des_work_norm; pBolt->set_d(pLsPara->d); pBolt->iSeg = pLineAngle->iSeg; pBolt->CopyModuleInstanceInfo(pLineAngle); //调整螺栓配材号与基准构件配材号一致 pBolt->SetGrade(pLsPara->grade); pBolt->AddL0Thick(pLineAngle->handle,TRUE); if(pBackToBackJg) { //更新螺栓通厚以及法向偏移量 pBolt->AddL0Thick(pBackToBackJg->handle,TRUE); if(pBolt->des_work_norm.direction==1) //朝内 pBolt->des_base_pos.norm_offset.AddThick(-pBackToBackJg->handle,TRUE,TRUE); } pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->CalGuigeAuto(); pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); if(pBaseNode==pLineAngle->pStart) { pLineAngle->AppendStartLsRef(pBolt->GetLsRef()); if(pLineAngle->GetClassTypeId()==CLS_LINEANGLE&&pBackToBackJg) //将螺栓引入到背对背的角钢上 wht 09-09-07 pBackToBackJg->AppendStartLsRef(pBolt->GetLsRef()); } else if(pBaseNode==pLineAngle->pEnd) { pLineAngle->AppendEndLsRef(pBolt->GetLsRef()); if(pLineAngle->GetClassTypeId()==CLS_LINEANGLE&&pBackToBackJg) //将螺栓引入到背对背的角钢上 pBackToBackJg->AppendEndLsRef(pBolt->GetLsRef()); } else { pLineAngle->AppendMidLsRef(pBolt->GetLsRef()); if(pBackToBackJg) //将螺栓引入到背对背的角钢上 pBackToBackJg->AppendMidLsRef(pBolt->GetLsRef()); } if(pBolt->des_base_pos.datumPoint.datum_pos_style==3) //交叉点定位 { CLDSLinePart *pLinePart=(CLDSLineAngle*)console.FromPartHandle(pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2,CLS_LINEPART); if(pLinePart) { f3dPoint wing_vec,wing_norm,datum_pos; if(pLinePart->IsAngle()) { //角钢 CLDSLineAngle *pCrossAngle=(CLDSLineAngle*)pLinePart; if(fabs(pBolt->ucs.axis_z*pCrossAngle->get_norm_x_wing())> fabs(pBolt->ucs.axis_z*pCrossAngle->get_norm_y_wing())) { wing_vec=pCrossAngle->GetWingVecX(); wing_norm=pCrossAngle->get_norm_x_wing(); } else { wing_vec=pCrossAngle->GetWingVecY(); wing_norm=pCrossAngle->get_norm_y_wing(); } datum_pos=pLinePart->Start(); } else if(pLinePart->GetClassTypeId()==CLS_LINEFLAT) { //扁铁 wing_norm=pLinePart->ucs.axis_z; wing_vec=pLinePart->ucs.axis_y; datum_pos=pLinePart->Start()-wing_vec*pLinePart->size_wide*0.5; } else if(pLinePart->GetClassTypeId()==CLS_LINESLOT) { //槽钢 wing_norm=pLinePart->ucs.axis_y; wing_vec=pLinePart->ucs.axis_x; datum_pos=pLinePart->Start()-wing_vec*pLinePart->size_wide*0.5; } f3dPoint pos; Int3dlf(pos,pBolt->ucs.origin,pBolt->ucs.axis_z,pLinePart->Start(),wing_norm); f3dPoint bolt_vec=pos-datum_pos; double dd=bolt_vec*wing_vec; if(dd>0&&dd<pLinePart->GetWidth()) { //交叉螺栓位于交叉角钢内 pLinePart->AppendMidLsRef(pBolt->GetLsRef()); pBolt->AddL0Thick(pLinePart->handle,TRUE); } } } double g=0.0; g=pLineAngle->GetLsG(pBolt); for(RAYNO_RECORD *pRayNo=rayNoList.GetFirst();pRayNo;pRayNo=rayNoList.GetNext()) { if(ftoi(pRayNo->yCoord)==ftoi(g)) { pBolt->dwRayNo=pRayNo->dwRayNo; break; } } if(pRayNo==NULL) { pRayNo=rayNoList.append(); pRayNo->dwRayNo=GetSingleWord(iInitRayNo); pRayNo->hPart=pBolt->des_base_pos.hPart; pRayNo->yCoord=g; pBolt->dwRayNo=pRayNo->dwRayNo; iInitRayNo++; } } if(pBaseNode==pLineAngle->pStart&&pLineAngle->desStartOdd.m_iOddCalStyle==1) pLineAngle->CalStartOddment(); else if(pBaseNode==pLineAngle->pEnd&&pLineAngle->desEndOdd.m_iOddCalStyle==1) pLineAngle->CalEndOddment(); pLineAngle->SetModified(); } //二、单螺栓连接包括:1.交叉点单螺栓 2.单角钢端螺栓连接 3.无板单螺栓连接 void CLDSView::OnOneBoltDesign() { //单螺栓连接 m_nPrevCommandID=ID_ONEBOLT_DESIGN; #ifdef AFX_TARG_ENU_ENGLISH m_sPrevCommandName="Repeat to connect single bolts"; #else m_sPrevCommandName="重复单螺栓连接"; #endif Command("1Bolt"); } void CLDSView::OnSpecNodeOneBoltDesign() { //批量生成单螺栓连接 m_nPrevCommandID=ID_SPEC_NODE_ONEBOLT_DESIGN; #ifdef AFX_TARG_ENU_ENGLISH m_sPrevCommandName="Repeat to specify single-bolt connection"; #else m_sPrevCommandName="重复指定节点单螺栓连接"; #endif Command("Spec1Bolt"); } //设计垫板 static BOOL DesignDianBan(CLDSBolt *pLs,BOOL bThrowError,CLDSNode* pNode, double dist,int nType,CDianBanParaDlg *pDlg=NULL) { CDianBanParaDlg dianbandlg; CLDSLinePart *pLinePart1=(CLDSLinePart*)console.FromPartHandle(pNode->arrRelationPole[1],CLS_LINEPART); CLDSLinePart *pLinePart2=(CLDSLinePart*)console.FromPartHandle(pNode->arrRelationPole[0],CLS_LINEPART); if(dianbandlg.m_nSpaceDist==0||dianbandlg.m_nThick==0) { dianbandlg.m_sLsGuiGe.Format("%d",pLs->get_d()); dianbandlg.m_nSpaceDist = (int)(dist+0.5);//圆整 pLs->DianQuan.thick; dianbandlg.m_iPartType=nType; dianbandlg.m_nThick=(nType==1)?pLs->DianQuan.thick:dianbandlg.m_nSpaceDist; if(dianbandlg.m_nThick>0) dianbandlg.m_nNum=dianbandlg.m_nSpaceDist/dianbandlg.m_nThick; } //对称生成螺栓垫板时如果前后间隙值不相同则需要弹出设计对话框 wht 11-01-19 if((pDlg&&pDlg->m_bMirCreate&&dianbandlg.m_nSpaceDist==pDlg->m_nSpaceDist) ||!bThrowError||dianbandlg.DoModal()==IDOK) { // //复制保存的参数到当前对话框 wht 11-01-10 if(pDlg&&pDlg->m_bMirCreate&&dianbandlg.m_nSpaceDist==pDlg->m_nSpaceDist) dianbandlg.CopyProperty(*pDlg); double ddx,ddy; CLDSLineAngle* pDatumAngle=NULL; if(pLinePart1->GetClassTypeId()==CLS_LINEANGLE) { CLDSLineAngle* pAngle=(CLDSLineAngle*)pLinePart1; ddx=pAngle->get_norm_x_wing()*pLs->get_norm(); ddy=pAngle->get_norm_y_wing()*pLs->get_norm(); if( (fabs(ddx)>fabs(ddy)&&ddx>EPS_COS2)|| (fabs(ddy)>fabs(ddx)&&ddy>EPS_COS2)) pDatumAngle=pAngle; } if(pDatumAngle==NULL&&pLinePart2->GetClassTypeId()==CLS_LINEANGLE) { CLDSLineAngle* pAngle=(CLDSLineAngle*)pLinePart2; ddx=pAngle->get_norm_x_wing()*pLs->get_norm(); ddy=pAngle->get_norm_y_wing()*pLs->get_norm(); if( (fabs(ddx)>fabs(ddy)&&ddx>EPS_COS2)|| (fabs(ddy)>fabs(ddx)&&ddy>EPS_COS2)) pDatumAngle=pAngle; } if(!dianbandlg.m_bAutoJudgeLs) pLs->set_d(atol(dianbandlg.m_sLsGuiGe)); if(dianbandlg.m_iPartType == 0) { int iCycle = 0; long nSurplus=(long)(pLs->DianQuan.thick-dianbandlg.m_nNum*dianbandlg.m_nThick); if(dianbandlg.m_bCreateSurplusPlate&&nSurplus>0) iCycle = dianbandlg.m_nNum+1; else iCycle = dianbandlg.m_nNum; for(int i=0;i<iCycle;i++) { if(dianbandlg.m_nThick<=0) continue; CLDSPlate *pPadPlank=(CLDSPlate*)console.AppendPart(CLS_PLATE); pPadPlank->cfgword=pLinePart1->cfgword; //调整钢板配材号与基准构件或基准节点配材号一致 pPadPlank->designInfo.m_hBasePart=pLinePart1->handle; if(i==iCycle-1&&nSurplus>0&&dianbandlg.m_bCreateSurplusPlate) pPadPlank->Thick=nSurplus; else pPadPlank->Thick=dianbandlg.m_nThick; pPadPlank->jdb_style=4; if(pDatumAngle) { pPadPlank->designInfo.m_hBasePart=pDatumAngle->handle; //保证钢板基准构件与原点及法线基准构件一致 wht 15-06-25 pPadPlank->designInfo.origin.datum_pos_style=2; pPadPlank->designInfo.origin.des_para.RODNODE.hRod=pDatumAngle->handle; pPadPlank->designInfo.origin.des_para.RODNODE.wing_offset_style=0; pPadPlank->designInfo.origin.des_para.RODNODE.hNode=pNode->handle; if(fabs(ddx)>fabs(ddy)&&fabs(ddx)>EPS_COS2) //X肢为工作肢 pPadPlank->designInfo.origin.des_para.RODNODE.offset_wing=0; else if(fabs(ddy)>fabs(ddx)&&fabs(ddy)>EPS_COS2) pPadPlank->designInfo.origin.des_para.RODNODE.offset_wing=1; pPadPlank->designInfo.origin.UpdatePos(pPadPlank->BelongModel()); pPadPlank->ucs.origin=pPadPlank->designInfo.origin.Position(); //设置螺栓垫板法线参数 pPadPlank->designInfo.norm.norm_style=1; pPadPlank->designInfo.norm.hVicePart=pDatumAngle->handle; pPadPlank->designInfo.norm.norm_wing=pPadPlank->designInfo.origin.des_para.RODNODE.offset_wing; pPadPlank->designInfo.norm.direction=0; } else { pPadPlank->ucs.origin=pLs->ucs.origin+pLs->get_norm()*(pLs->DianQuan.offset+i*dianbandlg.m_nThick); //设置螺栓垫板原点及法线参数 pPadPlank->designInfo.origin.datum_pos_style=0; pPadPlank->designInfo.origin.datum_pos=pPadPlank->ucs.origin; pPadPlank->designInfo.norm.norm_style=0; pPadPlank->designInfo.norm.vector=pLs->get_norm(); } pPadPlank->ucs.axis_z=pLs->get_norm(); pPadPlank->ucs.axis_y=pLinePart2->End()-pLinePart2->Start(); pPadPlank->cDatumAxis='Y'; normalize(pPadPlank->ucs.axis_y); pPadPlank->ucs.axis_x=pPadPlank->ucs.axis_y^pPadPlank->ucs.axis_z; pPadPlank->ucs.axis_y=pPadPlank->ucs.axis_z^pPadPlank->ucs.axis_x; pPadPlank->AppendLsRef(pLs->GetLsRef()); pPadPlank->SetLayer(pLs->layer()); pPadPlank->cfgword=pLs->cfgword; pPadPlank->iSeg=pLs->iSeg; if(dianbandlg.m_bAutoJudgePad) pPadPlank->CalStdProfile(); else { PROFILE_VERTEX *pVertex = pPadPlank->vertex_list.append(); pVertex->vertex.Set(dianbandlg.m_fPadLen*0.5,dianbandlg.m_fPadWidth*0.5,0); pVertex->vertex.feature=1; pVertex = pPadPlank->vertex_list.append(); pVertex->vertex.Set(-dianbandlg.m_fPadLen*0.5,dianbandlg.m_fPadWidth*0.5,0); pVertex->vertex.feature=1; pVertex = pPadPlank->vertex_list.append(); pVertex->vertex.Set(-dianbandlg.m_fPadLen*0.5,-dianbandlg.m_fPadWidth*0.5,0); pVertex->vertex.feature=1; pVertex = pPadPlank->vertex_list.append(); pVertex->vertex.Set(dianbandlg.m_fPadLen*0.5,-dianbandlg.m_fPadWidth*0.5,0); pVertex->vertex.feature=1; } if(i==iCycle-1&&dianbandlg.m_bCreateSurplusPlate) pPadPlank->SetPartNo(dianbandlg.m_sPartNoSurplus.GetBuffer()); else pPadPlank->SetPartNo(dianbandlg.m_sPartNo.GetBuffer()); if(UI::blEnableIntermediateUpdateUI) { pPadPlank->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength(),g_sysPara.display.nSmoothness); g_pSolidDraw->NewSolidPart(pPadPlank->GetSolidPartObject()); } } pLs->DianQuan.N = 0; pLs->DianQuan.offset = 0; pLs->DianQuan.thick = 0; } else { pLs->DianQuan.N = dianbandlg.m_nNum; pLs->DianQuan.thick = dianbandlg.m_nThick; if(pLs->DianQuan.thick!=CLDSPart::library->GetBoltPadThick(pLs->get_d())) pLs->DianQuan.AutoMatchThick=false; //特殊指定垫圈厚度,以后不再重新设计 if(pDatumAngle) pLs->DianQuan.offset=pDatumAngle->GetThick(); else pLs->DianQuan.offset=0; } } else { //必须清零,否则会是一堆随机数,有可能导致螺栓通厚超长 wjh-2015.4.8 pLs->DianQuan.N = 0; pLs->DianQuan.offset = 0; pLs->DianQuan.thick = 0; } //保存垫板对话框设置参数 wht 11-01-10 if(pDlg&&(!pDlg->m_bMirCreate||(pDlg->m_bMirCreate&&dianbandlg.m_nSpaceDist!=pDlg->m_nSpaceDist))) pDlg->CopyProperty(dianbandlg); return TRUE; } extern BOOL UnifyAngleBoltParamG(DESIGN_LS_POS &designLsPos); //1.设计交叉点单螺栓 BOOL DesignIntersNode(CLDSNode *pNode,BOOL bThrowError,CDianBanParaDlg *pDlg=NULL) { CLDSLinePart *pLinePart1=NULL,*pLinePart2=NULL; CLDSLineAngle *pAngle1=NULL, *pAngle2=NULL; CLDSLineFlat *pLineFlat1=NULL,*pLineFlat2=NULL; JGZJ jgzj1,jgzj2; f3dPoint wing_vec1,wing_vec2,ls_pos,ls_norm; double dist; CLDSBolt ls(console.GetActiveModel()); CUndoOperObject undo(&Ta, true); try { if(pNode==NULL) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "The selected parts are illegal"; #else throw "选择非法构件"; #endif else return FALSE; } if(pNode->m_cPosCalType!=4) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "The selected node isn't cross node"; #else throw "选择节点不是交叉节点"; #endif else return FALSE; } if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pNode->dwPermission)) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of the node!"; #else throw "没有此节点的修改权限!"; #endif else return FALSE; } LINEPARTSET jgset; for(CLDSLinePart *pLinePart=Ta.Parts.GetFirstLinePart();pLinePart;pLinePart=Ta.Parts.GetNextLinePart()) { if(pLinePart->pStart==pNode||pLinePart->pEnd==pNode) jgset.append(pLinePart); } pLinePart1=(CLDSLinePart*)console.FromPartHandle(pNode->arrRelationPole[0],CLS_LINEPART); pLinePart2=(CLDSLinePart*)console.FromPartHandle(pNode->arrRelationPole[1],CLS_LINEPART); if(pLinePart1==NULL || pLinePart2==NULL) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "The selected node lack of attached part"; #else throw "选择节点缺少依附构件"; #endif else return FALSE; } //检查该交叉点是否已经存在交叉点螺栓 int i=0; CLsRef *pLsRef=NULL; int x_wing0_y_wing1; for(i=0;i<2;i++) { CLDSLinePart *pLineRod=NULL; if(i==0) pLineRod=pLinePart1; else if(i==1) pLineRod=pLinePart2; if(pLineRod==NULL) continue; for(pLsRef=pLineRod->GetFirstLsRef();pLsRef;pLsRef=pLineRod->GetNextLsRef()) { if((*pLsRef)->des_base_pos.datumPoint.datum_pos_style==3) //两角钢交叉点定位 { long hDatum1=(*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1; long hDatum2=(*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2; if( (hDatum1==pLinePart1->handle&&hDatum2==pLinePart2->handle)|| (hDatum2==pLinePart1->handle&&hDatum1==pLinePart2->handle)) { #ifdef AFX_TARG_ENU_ENGLISH logerr.LevelLog(CLogFile::WARNING_LEVEL3_UNIMPORTANT, "Intersection bolt 0x%X already exists and does not allow the repeat design!",(*pLsRef)->handle); #else logerr.LevelLog(CLogFile::WARNING_LEVEL3_UNIMPORTANT,"已存在0x%X交叉点螺栓,不能重复设计!",(*pLsRef)->handle); #endif return FALSE; } } } } //1.设定螺栓法线设计参数 double offsetDist; if(pLinePart1->IsAngle()) { //螺栓基准构件为角钢 pAngle1=(CLDSLineAngle*)pLinePart1; offsetDist=pAngle1->GetThick(); if(pLinePart2->IsAngle()) { CLDSLineAngle *pAngle=(CLDSLineAngle*)pLinePart2; GetWorkNorm(pAngle1,pAngle,&ls_norm); } else if(pLinePart2->GetClassTypeId()==CLS_LINEFLAT) { CLDSLineFlat *pLineFlat=(CLDSLineFlat*)pLinePart2; ls_norm=pLineFlat->WorkPlaneNorm(); } //螺栓法线位于角钢的某肢法线上 IsInsideJg(pAngle1,ls_norm,&x_wing0_y_wing1); if(x_wing0_y_wing1==0) ls_norm=pAngle1->get_norm_x_wing(); else ls_norm=pAngle1->get_norm_y_wing(); } else if(pLinePart1->GetClassTypeId()==CLS_LINEFLAT) { // 螺栓基准构件为扁铁,螺栓法线就是扁铁的法线 pLineFlat1=(CLDSLineFlat*)pLinePart1; offsetDist=0; ls_norm = pLineFlat1->WorkPlaneNorm(); } normalize(ls_norm); ls.set_norm(ls_norm); if(pAngle1) { ls.des_work_norm.norm_style=1; ls.des_work_norm.hVicePart=pAngle1->handle; ls.des_work_norm.norm_wing=x_wing0_y_wing1; ls.des_work_norm.direction=0; } else if(pLineFlat1) { ls.des_work_norm.norm_style=3; ls.des_work_norm.hVicePart=pLineFlat1->handle; ls.des_work_norm.nearVector=ls_norm; ls.des_work_norm.direction=0; } //2.确定螺栓规格(直径) int ls_d=pLinePart1->connectStart.d; for(CLDSLinePart *pLinePart=(CLDSLinePart*)jgset.GetFirst();pLinePart;pLinePart=(CLDSLinePart*)jgset.GetNext()) { if(pLinePart->pStart==pNode) ls_d = __min(ls_d,pLinePart->connectStart.d); else if(pLinePart->pEnd==pNode) ls_d = __min(ls_d,pLinePart->connectEnd.d); if(!pLinePart->IsAngle()) continue; CLDSLineAngle *pJg=(CLDSLineAngle*)pLinePart; if(pJg->pStart==pNode) //根据吊杆调整螺栓直径大小 { if(fabs(ls_norm*pJg->get_norm_x_wing())>fabs(ls_norm*pJg->get_norm_y_wing())) { pJg->desStartPos.wing_x_offset.gStyle=4; pJg->desStartPos.wing_x_offset.offsetDist=-offsetDist; pJg->desStartPos.wing_y_offset.gStyle=0; } else { pJg->desStartPos.wing_y_offset.gStyle=4; pJg->desStartPos.wing_y_offset.offsetDist=-offsetDist; pJg->desStartPos.wing_x_offset.gStyle=0; } } else if(pJg->pEnd==pNode) { if(fabs(ls_norm*pJg->get_norm_x_wing())>fabs(ls_norm*pJg->get_norm_y_wing())) { //调整交叉点处连接的角钢位置 未完成... pJg->desEndPos.wing_x_offset.gStyle=4; pJg->desEndPos.wing_x_offset.offsetDist=-offsetDist; pJg->desEndPos.wing_y_offset.gStyle=0; } else { pJg->desEndPos.wing_y_offset.gStyle=4; pJg->desEndPos.wing_y_offset.offsetDist=-offsetDist; pJg->desEndPos.wing_x_offset.gStyle=0; } } } ls.set_d(ls_d); if(!ls.CalGuigeAuto()) { char sError[200]=""; #ifdef AFX_TARG_ENU_ENGLISH sprintf(sError,"Can't find bolt specification M%dX%.f in specification library",ls.get_d(),ls.get_L0()); #else sprintf(sError,"在螺栓规格库中没有找到符合M%dX%.f的螺栓规格",ls.get_d(),ls.L0); #endif if(bThrowError) throw sError; else return FALSE; } //3.螺栓位置(法线偏移量)、垫板位置确定 f3dLine L1,L2; if(pAngle1) { getjgzj(jgzj1,pAngle1->GetWidth()); if(pAngle1->m_bEnableTeG) { if(x_wing0_y_wing1==0) jgzj1=pAngle1->xWingXZhunJu; else jgzj1=pAngle1->xWingYZhunJu; } if(fabs(pAngle1->get_norm_x_wing()*ls.get_norm())>fabs(pAngle1->get_norm_y_wing()*ls.get_norm())) wing_vec1=pAngle1->GetWingVecX(); else wing_vec1=pAngle1->GetWingVecY(); L1.startPt= pAngle1->Start()+wing_vec1*jgzj1.g; L1.endPt = pAngle1->End()+wing_vec1*jgzj1.g; } else if(pLineFlat1) { L1.startPt=pLineFlat1->Start(); L1.endPt=pLineFlat1->End(); } if(pLinePart2->IsAngle()) { pAngle2=(CLDSLineAngle*)pLinePart2; IsInsideJg(pAngle2,ls_norm,&x_wing0_y_wing1); getjgzj(jgzj2,pAngle2->GetWidth()); if(pAngle2->m_bEnableTeG) { if(x_wing0_y_wing1==0) jgzj2=pAngle2->xWingXZhunJu; else jgzj2=pAngle2->xWingYZhunJu; } if(fabs(pAngle2->get_norm_x_wing()*ls.get_norm())>fabs(pAngle2->get_norm_y_wing()*ls.get_norm())) wing_vec2=pAngle2->GetWingVecX(); else wing_vec2=pAngle2->GetWingVecY(); L2.startPt=pAngle2->Start()+wing_vec2*jgzj2.g; L2.endPt =pAngle2->End()+wing_vec2*jgzj2.g; } else if(pLinePart2->GetClassTypeId()==CLS_LINEFLAT) { pLineFlat2=(CLDSLineFlat*)pLinePart2; L2.startPt=pLineFlat2->Start(); L2.endPt=pLineFlat2->End(); } dist = DistOf3dll(L1,L2); project_point(L1.startPt,pLinePart1->Start(),ls.get_norm()); project_point(L1.endPt, pLinePart1->Start(),ls.get_norm()); project_point(L2.startPt,pLinePart1->Start(),ls.get_norm()); project_point(L2.endPt, pLinePart1->Start(),ls.get_norm()); if(Int3dll(L1,L2,ls_pos)<1) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "The calculation of intersection coord is error"; #else throw "交点坐标计算错误"; #endif else return FALSE; } if(pAngle1) { SnapPerp(&ls_pos,pAngle1->Start(),pAngle1->End(),ls_pos,NULL); ls_pos = ls_pos+jgzj1.g*wing_vec1; ls_pos = ls_pos-ls.get_norm()*pAngle1->GetThick(); ls.des_base_pos.norm_offset.AddThick(-pAngle1->handle,TRUE); ls.DianQuan.offset=pAngle1->GetThick(); //垫圈位置 if(pLineFlat2&&pLineFlat2->WorkPlaneNorm()*ls_norm<0) dist-=pLineFlat2->GetThick(); } else if(pLineFlat1) { SnapPerp(&ls_pos,pLineFlat1->Start(),pLineFlat1->End(),ls_pos,NULL); f3dPoint vec=pLinePart2->Start() - ls_pos; if(vec*ls_norm<0) { ls_norm*=-1; ls.set_norm(ls_norm); ls.des_work_norm.direction=1; ls_pos=ls_pos-ls_norm*pLineFlat1->GetThick(); ls.des_base_pos.norm_offset.AddThick(-pLinePart1->handle,TRUE); } ls.DianQuan.offset=pLineFlat1->GetThick(); //垫圈位置 if(pAngle2&&IsNormSameToPlank(pAngle2,ls.get_norm())==0) dist-=pLineFlat1->GetThick(); else if(pLineFlat2) { if(pLineFlat1->WorkPlaneNorm()*pLineFlat2->WorkPlaneNorm()>0&&ls_norm*pLineFlat1->WorkPlaneNorm()>0) dist-=pLineFlat1->GetThick(); else if(pLineFlat1->WorkPlaneNorm()*pLineFlat2->WorkPlaneNorm()>0&&ls_norm*pLineFlat1->WorkPlaneNorm()<0) dist-=pLineFlat2->GetThick(); else dist=dist-pLineFlat1->GetThick()-pLineFlat2->GetThick(); } } ls.ucs.origin=ls_pos; ls.EmptyL0DesignPara(); ls.AddL0Thick(pLinePart1->handle,TRUE); ls.AddL0Thick(pLinePart2->handle,TRUE); // CLDSBolt *pLs=(CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->CopyProperty(&ls); pLs->SetLayer(pNode->layer()); pLs->iSeg=pNode->iSeg; pLs->cfgword=pLinePart1->cfgword; //调整螺栓配材号与基准构件配材号一致 dist=ftoi(dist); //为减少前后不一致,统一将距离圆整为整数再判断垫圈 wjh-2019.9.2 int nType=pLs->CalPadPara(dist); //0.垫板 1.垫圈 int nMaxWasherThick=CLDSPart::library->GetBoltPadThick(pLs->d,1); double dfMinPromptSpaceByDianBan=nMaxWasherThick*2+1.2; if (nType==DIANQUAN_STRU::DIANBAN||dist>=dfMinPromptSpaceByDianBan|| (g_sysPara.b1BoltDesignPrompt&&dist>0)) //防止大间隙(如10)时在无提示情况下设计成3个垫圈 wjh-2019.7.24 DesignDianBan(pLs,bThrowError,pNode,dist,DIANQUAN_STRU::DIANBAN,pDlg); //保鸡段炜说>8一般垫板情况较多,故还是默认为垫板更好 wjh-2019.9.2 pLs->DianQuan.offset=pLinePart1->GetThick(); if(dist>0) { //带垫圈时不需要添加dist wht 11-07-08 if(!(pLs->DianQuan.N>0&&pLs->DianQuan.thick>0)) pLs->AddL0Thick(ftoi(dist),FALSE); } //螺栓位置设计信息填充 pLs->des_base_pos.datumPoint.datum_pos_style=3; //心线交点 pLs->des_base_pos.hPart=pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1 = pLinePart1->handle; pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2 = pLinePart2->handle; if(pAngle1) { pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=4; pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1=jgzj1.g; } if(pAngle2) { pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2=4; //自定义 pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist2=jgzj2.g; } pLs->des_base_pos.norm_offset=ls.des_base_pos.norm_offset; pLs->des_work_norm=ls.des_work_norm; UnifyAngleBoltParamG(pLs->des_base_pos); pLs->correct_worknorm(); pLs->correct_pos(); pLs->CalGuigeAuto(); if(UI::blEnableIntermediateUpdateUI) { pLs->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pLs->GetSolidPartObject()); } pLinePart1->AppendMidLsRef(pLs->GetLsRef()); pLinePart2->AppendMidLsRef(pLs->GetLsRef()); LSSPACE_STRU LsSpace; GetLsSpace(LsSpace,ls.get_d()); for(CLDSLinePart* pLinePart=(CLDSLinePart*)jgset.GetFirst();pLinePart;pLinePart=(CLDSLinePart*)jgset.GetNext()) { if(!pLinePart->IsAngle()) continue; CLDSLineAngle *pJg=(CLDSLineAngle*)pLinePart; if(pJg->pStart==pNode) { pJg->SetStartOdd(LsSpace.EndSpace); pJg->AppendStartLsRef(pLs->GetLsRef()); } else { pJg->SetEndOdd(LsSpace.EndSpace); pJg->AppendEndLsRef(pLs->GetLsRef()); } pJg->SetModified(); } } catch (CString sError) { AfxMessageBox(sError); return FALSE; } catch (char *sError) { AfxMessageBox(sError); return FALSE; } return TRUE; } BOOL DesignIntersNode2Ls(CLDSNode *pNode, BOOL bThrowError) { CLogErrorLife logErrLife; CUndoOperObject undo(&Ta, true); if (pNode == NULL || pNode->m_cPosCalType != 4) { if (bThrowError) logerr.LevelLog(1, "选择节点不是交叉节点"); return FALSE; } if (theApp.m_bCooperativeWork && !theApp.IsHasModifyPerm(pNode->dwPermission)) { if (bThrowError) logerr.LevelLog(1, "没有此节点(0X%X)的修改权限!",pNode->handle); return FALSE; } CLDSLineAngle* pCrossJg1 = (CLDSLineAngle*)console.FromPartHandle(pNode->arrRelationPole[0], CLS_LINEANGLE); CLDSLineAngle* pCrossJg2 = (CLDSLineAngle*)console.FromPartHandle(pNode->arrRelationPole[1], CLS_LINEANGLE); if (pCrossJg1 == NULL || pCrossJg2 == NULL) { if (bThrowError) logerr.LevelLog(1, "选择节点(0X%X)缺少依附构件!", pNode->handle); return FALSE; } //检查该交叉点是否已经存在交叉点螺栓 for (int i = 0; i < 2; i++) { CLDSLineAngle* pJg = (i == 0) ? pCrossJg1 : pCrossJg2; if (pJg == NULL) continue; for (CLsRef *pLsRef = pJg->GetFirstLsRef(); pLsRef; pLsRef = pJg->GetNextLsRef()) { if ((*pLsRef)->des_base_pos.datumPoint.datum_pos_style == 3) { //两角钢交叉点定位 long hDatum1 = (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1; long hDatum2 = (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2; if ((hDatum1 == pCrossJg1->handle&&hDatum2 == pCrossJg2->handle) || (hDatum2 == pCrossJg1->handle&&hDatum1 == pCrossJg2->handle)) { if(bThrowError) logerr.LevelLog(3, "已存在0x%X交叉点螺栓,不能重复设计!", (*pLsRef)->handle); return FALSE; } } } } //根据交叉杆件及吊杆确定螺栓规格(直径) LINEPARTSET jgset; int ls_d = pCrossJg1->connectStart.d; for (CLDSLinePart *pLinePart = Ta.EnumRodFirst(); pLinePart; pLinePart = Ta.EnumRodNext()) { if (pLinePart->pStart == pNode || pLinePart->pEnd == pNode) { if (pLinePart->pStart == pNode) ls_d = __min(ls_d, pLinePart->connectStart.d); else if (pLinePart->pEnd == pNode) ls_d = __min(ls_d, pLinePart->connectEnd.d); jgset.append(pLinePart); } } //设定螺栓位置(法线偏移量) f3dLine jg1_axis_g1, jg1_axis_g2, jg2_axis_g1, jg2_axis_g2; BYTE ciWorkWing1 = 0, ciWorkWing2 = 0; JGZJ jgzj1,jgzj2; f3dPoint work_norm; GetWorkNorm(pCrossJg1, pCrossJg2, &work_norm); IsInsideJg(pCrossJg1, work_norm, &ciWorkWing1); getjgzj(jgzj1, pCrossJg1->GetWidth()); if (pCrossJg1->m_bEnableTeG) jgzj1 = (ciWorkWing1 == 0) ? pCrossJg1->xWingXZhunJu:pCrossJg1->xWingYZhunJu; if (jgzj1.g1 == 0 || jgzj1.g2 == 0) { if (bThrowError) logerr.LevelLog(1, "交叉节点的依赖角钢(0X%X)不满足布置双螺栓!", pCrossJg1->handle); return FALSE; } f3dPoint wing_vec1 = (ciWorkWing1 == 0) ? pCrossJg1->GetWingVecX() : pCrossJg1->GetWingVecY(); jg1_axis_g1.startPt = pCrossJg1->Start() + wing_vec1 * jgzj1.g1; jg1_axis_g1.endPt = pCrossJg1->End() + wing_vec1 * jgzj1.g1; jg1_axis_g2.startPt = pCrossJg1->Start() + wing_vec1 * jgzj1.g2; jg1_axis_g2.endPt = pCrossJg1->End() + wing_vec1 * jgzj1.g2; // getjgzj(jgzj2, pCrossJg2->GetWidth()); IsInsideJg(pCrossJg2, work_norm, &ciWorkWing2); if (pCrossJg2->m_bEnableTeG) jgzj2 = (ciWorkWing2 == 0) ? pCrossJg2->xWingXZhunJu : pCrossJg2->xWingYZhunJu; if (jgzj2.g1 == 0 || jgzj2.g2 == 0) { if (bThrowError) logerr.LevelLog(1, "交叉节点的依赖角钢(0X%X)不满足布置双螺栓!", pCrossJg2->handle); return FALSE; } f3dPoint wing_vec2 = (ciWorkWing2 == 0) ? pCrossJg2->GetWingVecX() : pCrossJg2->GetWingVecY(); jg2_axis_g1.startPt = pCrossJg2->Start() + wing_vec2 * jgzj2.g1; jg2_axis_g1.endPt = pCrossJg2->End() + wing_vec2 * jgzj2.g1; jg2_axis_g2.startPt = pCrossJg2->Start() + wing_vec2 * jgzj2.g2; jg2_axis_g2.endPt = pCrossJg2->End() + wing_vec2 * jgzj2.g2; double dist = DistOf3dll(jg1_axis_g1, jg2_axis_g1); f3dPoint pickPt = pCrossJg1->Start(), intersPt1, intersPt2; project_point(jg1_axis_g1.startPt, pickPt, work_norm); project_point(jg1_axis_g1.endPt, pickPt, work_norm); project_point(jg1_axis_g2.startPt, pickPt, work_norm); project_point(jg1_axis_g2.endPt, pickPt, work_norm); project_point(jg2_axis_g1.startPt, pickPt, work_norm); project_point(jg2_axis_g1.endPt, pickPt, work_norm); project_point(jg2_axis_g2.startPt, pickPt, work_norm); project_point(jg2_axis_g2.endPt, pickPt, work_norm); if (Int3dll(jg1_axis_g1, jg2_axis_g2, intersPt1) < 1 || Int3dll(jg1_axis_g2, jg2_axis_g1,intersPt2) < 1) { if (bThrowError) logerr.LevelLog(1, "交点坐标计算错误"); return FALSE; } //添加螺栓 BOLTSET boltSet; for (int i = 0; i < 2; i++) { CLDSBolt *pLs = (CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->SetLayer(pNode->layer()); pLs->iSeg = pNode->iSeg; pLs->cfgword = pCrossJg1->cfgword; //调整螺栓配材号与基准构件配材号一致 pLs->set_d(ls_d); pLs->AddL0Thick(pCrossJg1->handle, TRUE); pLs->AddL0Thick(pCrossJg2->handle, TRUE); //螺栓位置设计信息填充 pLs->des_base_pos.hPart = pCrossJg1->handle; pLs->des_base_pos.datumPoint.datum_pos_style = 3; //心线交点 pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1 = pCrossJg1->handle; pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2 = pCrossJg2->handle; if (i == 0) { pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1 = 4; pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = jgzj1.g1; pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2 = 4; pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist2 = jgzj2.g2; } else { pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1 = 4; pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = jgzj1.g2; pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2 = 4; pLs->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist2 = jgzj2.g1; } pLs->des_base_pos.norm_offset.AddThick(-pCrossJg1->handle, TRUE); pLs->des_work_norm.norm_style = 1; pLs->des_work_norm.hVicePart = pCrossJg1->handle; pLs->des_work_norm.norm_wing = ciWorkWing1; pLs->des_work_norm.direction = 0; UnifyAngleBoltParamG(pLs->des_base_pos); pLs->correct_worknorm(); pLs->correct_pos(); pLs->CalGuigeAuto(); if (UI::blEnableIntermediateUpdateUI) { pLs->Create3dSolidModel(g_sysPara.bDisplayAllHole, g_pSolidOper->GetScaleUserToScreen(), g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pLs->GetSolidPartObject()); } // pCrossJg1->AppendMidLsRef(pLs->GetLsRef()); pCrossJg2->AppendMidLsRef(pLs->GetLsRef()); boltSet.append(pLs); } //添加连接板 if (jgset.GetNodeNum() <= 0 && ftoi(dist) > 6) { //无吊杆时设计垫板 CLDSView* pView = ((CMainFrame*)AfxGetMainWnd())->GetLDSView(); pView->DesignBoltPad(pCrossJg1, NULL, boltSet, ftoi(dist), 0); } else if (jgset.GetNodeNum() > 0 && ftoi(dist) > 6) { //有吊杆时设计内部交叉板 CLDSPlate* pPlate = (CLDSPlate*)console.AppendPart(CLS_PLATE); pPlate->cfgword = pNode->cfgword; pPlate->jdb_style = 0; pPlate->face_N = 1; pPlate->Thick = ftol(dist); pPlate->designInfo.iProfileStyle0123 = 1; pPlate->designInfo.iFaceType = 1; pPlate->designInfo.m_bEnableFlexibleDesign = TRUE; pPlate->designInfo.m_hBaseNode = pNode->handle; pPlate->designInfo.m_hBasePart = pCrossJg1->handle; pPlate->designInfo.norm.norm_style = 1; pPlate->designInfo.norm.hVicePart = pCrossJg1->handle; pPlate->designInfo.norm.norm_wing = ciWorkWing1; pPlate->designInfo.norm.direction = 0; pPlate->designInfo.origin.datum_pos_style = 3; pPlate->designInfo.origin.des_para.AXIS_INTERS.hDatum1 = pCrossJg1->handle; pPlate->designInfo.origin.des_para.AXIS_INTERS.hDatum2 = pCrossJg2->handle; //计算钢板坐标系 pNode->GetIntersZhun(&pPlate->ucs.origin); pPlate->ucs.axis_z = (ciWorkWing1 == 0) ? pCrossJg1->vxWingNorm : pCrossJg1->vyWingNorm; f3dPoint perp; SnapPerp(&perp, pCrossJg1->Start(), pCrossJg1->End(), pPlate->ucs.origin, NULL); project_point(pPlate->ucs.origin, perp, pPlate->ucs.axis_z); pPlate->ucs.axis_y = (pCrossJg1->End() - pCrossJg1->Start()).normalized(); pPlate->ucs.axis_x = pPlate->ucs.axis_y^pPlate->ucs.axis_z; pPlate->ucs.axis_y = pPlate->ucs.axis_z^pPlate->ucs.axis_x; normalize(pPlate->ucs.axis_x); normalize(pPlate->ucs.axis_y); normalize(pPlate->ucs.axis_z); //添加连接杆件设计参数 CDesignLjPartPara* pLinePartPara = NULL; for (int i = 0; i < 2; i++) { CLDSLineAngle* pJg = (i == 0) ? pCrossJg1 : pCrossJg2; BYTE ciWorkWing = (i == 0) ? ciWorkWing1 : ciWorkWing2; pLinePartPara = pPlate->designInfo.partList.Add(pJg->handle); //交叉角钢1 pLinePartPara->hPart = pJg->handle; pLinePartPara->m_nClassTypeId = CLS_LINEANGLE; pLinePartPara->iFaceNo = 1; pLinePartPara->start0_end1 = 2; pLinePartPara->angle.bEndLjJg = FALSE; pLinePartPara->angle.cur_wing_x0_y1 = ciWorkWing; pLinePartPara->angle.bTwoEdge = TRUE; pLinePartPara->angle.cbSpaceFlag.SetBerSpaceStyle(ANGLE_SPACE_FLAG::SPACE_TOEDGE); pLinePartPara->angle.cbSpaceFlag.SetWingSpaceStyle(ANGLE_SPACE_FLAG::SPACE_TOEDGE); pLinePartPara->angle.cbSpaceFlag.SetEndSpaceStyle(ANGLE_SPACE_FLAG::SPACE_BOLTEND); } for (CLDSLinePart *pRod = jgset.GetFirst(); pRod; pRod = jgset.GetNext()) { if (!pRod->IsAngle()) continue; //计算正负头 CLDSLineAngle *pJg = (CLDSLineAngle*)pRod; BYTE ciS0_E1 = (pRod->pStart == pNode) ? 0 : 1; DESIGNODDMENT* pOddDes = (pRod->pStart == pNode) ? &pJg->desStartOdd : &pJg->desEndOdd; pOddDes->m_fCollideDist = g_sysPara.VertexDist; pOddDes->m_iOddCalStyle = 0; pOddDes->m_hRefPart1 = pCrossJg1->handle; pOddDes->m_hRefPart2 = pCrossJg2->handle; pJg->CalStartOddment(); pJg->CalEndOddment(); //布置螺栓 LSSPACE_STRU LsSpace; GetLsSpace(LsSpace, ls_d); BYTE ciWorkWing = 0; IsInsideJg(pJg, work_norm, &ciWorkWing); CLDSBolt *pLs = (CLDSBolt*)console.AppendPart(CLS_BOLT); pLs->SetLayer(pNode->layer()); pLs->iSeg = pNode->iSeg; pLs->cfgword = pCrossJg1->cfgword; pLs->set_d(ls_d); pLs->des_base_pos.hPart = pJg->handle; pLs->des_base_pos.offset_wing = ciWorkWing; pLs->des_base_pos.m_biWingOffsetStyle = 0; pLs->des_base_pos.len_offset_dist = LsSpace.EndSpace; pLs->des_base_pos.direction = ciS0_E1; //螺栓位置设计信息填充 pLs->des_base_pos.datumPoint.datum_pos_style = 1; //角钢楞点 pLs->des_base_pos.datumPoint.des_para.RODEND.hRod = pJg->handle; pLs->des_base_pos.datumPoint.des_para.RODEND.direction = ciS0_E1; pLs->des_base_pos.datumPoint.des_para.RODEND.offset_wing = ciWorkWing; pLs->des_base_pos.datumPoint.des_para.RODEND.wing_offset_style = 4; pLs->des_base_pos.datumPoint.des_para.RODEND.wing_offset_dist = 0; pLs->des_base_pos.datumPoint.des_para.RODEND.bIncOddEffect = true; pLs->des_work_norm.norm_style = 1; pLs->des_work_norm.hVicePart = pJg->handle; pLs->des_work_norm.norm_wing = ciWorkWing; pLs->des_work_norm.direction = 0; pLs->AddL0Thick(pJg->handle, TRUE); if (ciS0_E1 == 0) pJg->AppendStartLsRef(pLs->GetLsRef()); else pJg->AppendEndLsRef(pLs->GetLsRef()); boltSet.append(pLs); //加入钢板连接杆件参数中 pLinePartPara = pPlate->designInfo.partList.Add(pJg->handle); pLinePartPara->hPart = pJg->handle; pLinePartPara->m_nClassTypeId = CLS_LINEANGLE; pLinePartPara->iFaceNo = 1; pLinePartPara->start0_end1 = ciS0_E1; pLinePartPara->angle.bEndLjJg = FALSE; pLinePartPara->angle.cur_wing_x0_y1 = ciWorkWing; pLinePartPara->angle.bTwoEdge = FALSE; pLinePartPara->angle.cbSpaceFlag.SetBerSpaceStyle(ANGLE_SPACE_FLAG::SPACE_TOEDGE); pLinePartPara->angle.cbSpaceFlag.SetWingSpaceStyle(ANGLE_SPACE_FLAG::SPACE_TOEDGE); pLinePartPara->angle.cbSpaceFlag.SetEndSpaceStyle(ANGLE_SPACE_FLAG::SPACE_BOLTEND); } //初始化钢板螺栓信息 for (CLDSBolt* pBolt = boltSet.GetFirst(); pBolt; pBolt=boltSet.GetNext()) { pBolt->AddL0Thick(pPlate->handle); pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->CalGuigeAuto(); if (UI::blEnableIntermediateUpdateUI) { pBolt->Create3dSolidModel(g_sysPara.bDisplayAllHole, g_pSolidOper->GetScaleUserToScreen(), g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); } // pPlate->AppendLsRef(pBolt->GetLsRef()); } //设计钢板 pPlate->DesignPlate(); if (UI::blEnableIntermediateUpdateUI) { pPlate->Create3dSolidModel(g_sysPara.bDisplayAllHole, g_pSolidOper->GetScaleUserToScreen(), g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pPlate->GetSolidPartObject()); } } return TRUE; } BOOL ValidateOneBoltConnect(CLDSNode *pNode,CLDSLinePart *pLineRod1,CLDSLinePart *pLineRod2) { int n1=1,n2=1; if(pLineRod1) { if(pLineRod1->pStart==pNode) n1=pLineRod1->connectStart.wnConnBoltN; else if(pLineRod1->pEnd==pNode) n1=pLineRod1->connectEnd.wnConnBoltN; } else return FALSE; if(pLineRod2) { if(pLineRod2->pStart==pNode) n2=pLineRod2->connectStart.wnConnBoltN; else if(pLineRod2->pEnd==pNode) n2=pLineRod2->connectEnd.wnConnBoltN; } #ifdef AFX_TARG_ENU_ENGLISH if((n1!=1||n2!=1)&&AfxMessageBox("The number of ray part's end bolts is not 1,if continue?",MB_YESNO)!=IDYES) #else if((n1!=1||n2!=1)&&AfxMessageBox("射线材端头螺栓数不为1,是否继续?",MB_YESNO)!=IDYES) #endif return FALSE; else return TRUE; } //2.设计单螺栓端连接 //设计仅有螺栓的连接(无板) BOOL DesignBoltOnlyConnect(CLDSNode *pNode,CLDSLinePart *pXieRod,CLDSLinePart *pXieRod2,CLDSLinePart *pXieRod3, BOOL bThrowError,BOOL bCanUndo/*=TRUE*/) { //交叉点单螺栓连接设计 CLDSLineAngle *pXieJg=NULL,*pXieJg2=NULL; CLDSLineFlat *pXieFlat=NULL,*pXieFlat2=NULL; CLDSLineSlot* pXieSlot=NULL,*pXieSlot2=NULL; if(pXieRod&&pXieRod->IsAngle()) pXieJg=(CLDSLineAngle*)pXieRod; else if(pXieRod&&pXieRod->GetClassTypeId()==CLS_LINEFLAT) pXieFlat=(CLDSLineFlat*)pXieRod; else if(pXieRod&&pXieRod->GetClassTypeId()==CLS_LINESLOT) pXieSlot=(CLDSLineSlot*)pXieRod; else //暂不支持该种类型的构件单螺栓连接设计 return FALSE; if(pXieRod==NULL&&pXieRod2==NULL) return DesignIntersNode(pNode,bThrowError); CLDSLineAngle* arrRayAngles[3]={NULL}; int index=0; if(pXieRod&&pXieRod->IsAngle()) arrRayAngles[index++]=(CLDSLineAngle*)pXieRod; if(pXieRod2&&pXieRod2->IsAngle()) arrRayAngles[index++]=(CLDSLineAngle*)pXieRod2; if(pXieRod3&&pXieRod3->IsAngle()) arrRayAngles[index++]=(CLDSLineAngle*)pXieRod3; if(arrRayAngles[2]!=NULL) { //三根射线角钢如果存在里外铁角钢交于同一点时要保证前两根角钢为交于同一点的里外铁角钢 wjh-2017.3.2 typedef CMultiOffsetPos* CMultiOffsetPosPtr; CMultiOffsetPosPtr desPosArr[3]={ arrRayAngles[0]->pStart->handle==pNode->handle?&arrRayAngles[0]->desStartPos:&arrRayAngles[0]->desEndPos, arrRayAngles[1]->pStart->handle==pNode->handle?&arrRayAngles[1]->desStartPos:&arrRayAngles[1]->desEndPos, arrRayAngles[2]->pStart->handle==pNode->handle?&arrRayAngles[2]->desStartPos:&arrRayAngles[2]->desEndPos}; if(fabs(desPosArr[1]->len_offset_dist-desPosArr[2]->len_offset_dist)<EPS) { //第二根与第三根交于同一点 CLDSLineAngle* pTempAngle=arrRayAngles[0]; memmove(arrRayAngles,&arrRayAngles[1],sizeof(CLDSLineAngle*)*2); arrRayAngles[2]=pTempAngle; } else if(fabs(desPosArr[0]->len_offset_dist-desPosArr[2]->len_offset_dist)<EPS) { //第一根与第三根交于同一点 CLDSLineAngle* pTempAngle=arrRayAngles[1]; arrRayAngles[1]=arrRayAngles[2]; arrRayAngles[2]=pTempAngle; } pXieRod =arrRayAngles[0]; pXieRod2=arrRayAngles[1]; pXieRod3=arrRayAngles[2]; } if( pXieRod&&( (pXieRod->pStart==pNode&&pXieRod->GetLocalLsCount(1,100)>0)|| (pXieRod->pEnd==pNode&&pXieRod->GetLocalLsCount(2,100)>0))) { logerr.LevelLog(CLogFile::WARNING_LEVEL3_UNIMPORTANT,"0x%X杆件已进行端头螺栓连接设计,跳过单螺栓设计!",pXieRod->handle); return false; } if( pXieRod2&&( (pXieRod2->pStart==pNode&&pXieRod2->GetLocalLsCount(1,100)>0)|| (pXieRod2->pEnd==pNode&&pXieRod2->GetLocalLsCount(2,100)>0))) { logerr.LevelLog(CLogFile::WARNING_LEVEL3_UNIMPORTANT,"0x%X杆件已进行端头螺栓连接设计,跳过单螺栓设计!",pXieRod2->handle); return false; } if( pXieRod3&&( (pXieRod3->pStart==pNode&&pXieRod2->GetLocalLsCount(1,100)>0)|| (pXieRod3->pEnd==pNode&&pXieRod2->GetLocalLsCount(2,100)>0))) { logerr.LevelLog(CLogFile::WARNING_LEVEL3_UNIMPORTANT,"0x%X杆件已进行端头螺栓连接设计,跳过单螺栓设计!",pXieRod3->handle); return false; } SmartPartPtr pFatherRod; JGZJ jgzj; CLDSBolt ls(console.GetActiveModel()),*pBolt; f3dPoint norm,direct,ls_pos; BOOL bInsideJg1,bInsideJg2; double len_offset1=0,len_offset2=0; int x_wing0_y_wing1; LSSPACE_STRU LsSpace; if(pNode==NULL||pXieRod==NULL) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "The select part is illegal"; #else throw "选择非法构件错误"; #endif else return FALSE; } if(pXieRod->pStart==NULL||pXieRod->pEnd==NULL) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "The selected part is short angle(start or end node is 0X0)!"; #else throw "所选杆件为短角钢(始端或终端节点为0X0)!"; #endif else return FALSE; } if(theApp.m_bCooperativeWork&&!theApp.IsHasModifyPerm(pNode->dwPermission)) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "Without modify permission of the node!"; #else throw "没有此节点的修改权限!"; #endif else return FALSE; } if(theApp.m_bCooperativeWork&&pNode==pXieRod->pStart&&!theApp.IsHasModifyPerm(pXieRod->dwStartPermission)) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "Don't have modify permission of rod's start!"; #else throw "没有此杆件始端的修改权限!"; #endif else return FALSE; } else if(theApp.m_bCooperativeWork&&pNode==pXieRod->pEnd&&!theApp.IsHasModifyPerm(pXieRod->dwEndPermission)) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "Don't have modify permission of rod's end!"; #else throw "没有此杆件终端的修改权限!"; #endif else return FALSE; } CLDSLineAngle* pXieAngle=NULL; if(pXieRod&&pXieRod->GetClassTypeId()==CLS_LINEANGLE) pXieAngle=(CLDSLineAngle*)pXieRod; //增加对手动指定端节点依附基准角钢的情况下端螺栓布置 wjh-2015.1.25 if(pXieAngle&&pXieAngle->pStart==pNode&&pXieAngle->desStartPos.datum_jg_h>0x20) pFatherRod = console.FromPartHandle(pXieAngle->desStartPos.datum_jg_h,CLS_LINEANGLE,CLS_GROUPLINEANGLE); else if(pXieAngle&&pXieAngle->pEnd==pNode&&pXieAngle->desEndPos.datum_jg_h>0x20) pFatherRod = console.FromPartHandle(pXieAngle->desEndPos.datum_jg_h,CLS_LINEANGLE,CLS_GROUPLINEANGLE); else pFatherRod = console.FromPartHandle(pNode->hFatherPart); CLsRef* pLsRef; if(pFatherRod.IsHasPtr()&&pXieRod) { if(!pXieRod->cfgword.And(pFatherRod->cfgword)) { #ifdef AFX_TARG_ENU_ENGLISH logerr.Log("0X%X and its end node dependent rod0X%X doesn't live in any model,bolt-only design failed!",pXieRod->handle,pFatherRod->handle); #else logerr.Log("0X%X与其设计端节点父杆件0X%X不共存于任何一个呼高模型中,单螺栓设计失败!",pXieRod->handle,pFatherRod->handle); #endif return FALSE; } for(pLsRef=pXieRod->GetFirstLsRef();pLsRef;pLsRef=pXieRod->GetNextLsRef()) { if((*pLsRef)->des_base_pos.datumPoint.datum_pos_style==3) //两角钢交叉点定位 { long hDatum1=(*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1; long hDatum2=(*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2; long hRod2=pXieRod2!=NULL?pXieRod2->handle:0; if( (hDatum1==pXieRod->handle&&hDatum2==pFatherRod->handle)|| (hDatum2==pXieRod->handle&&hDatum1==pFatherRod->handle)|| (hDatum1==hRod2&&hDatum2==pFatherRod->handle)||(hDatum2==hRod2&&hDatum1==pFatherRod->handle)) { #ifdef AFX_TARG_ENU_ENGLISH logerr.Log("End bolt 0x%X already exists and does not allow the repeat design!",(*pLsRef)->handle); #else logerr.Log("已存在0x%X端点单螺栓,不能重复设计!",(*pLsRef)->handle); #endif return FALSE; } } } } if(pFatherRod.IsNULL()) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "The selected node is isolated(not datum angle's node)"; #else throw "选择了一个孤立的节点(没有基准角钢的节点)"; #endif else return FALSE; } CLDSGroupLineAngle *pGroupJg=NULL; //节点父角钢 if(pFatherRod->GetClassTypeId()==CLS_GROUPLINEANGLE) { //节点父杆件为组合角钢时自动选择合适的子角钢为单螺栓连接基准角钢 wht 10-11-23 pGroupJg=pFatherRod.pGroupAngle; if(pGroupJg->group_style!=0) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "Currently only support single-bolt-connection on combined angle's child angle!"; #else throw "目前仅支持在对角组合角钢的子角钢上进行单螺栓连接!"; #endif else return FALSE; } f3dPoint ray_vec=pXieRod->Start()-pXieRod->End(); if(pXieRod->pStart->handle==pNode->handle) ray_vec*=-1.0; normalize(ray_vec); CLDSLineAngle *pSonJg=NULL; if(pXieJg) GetWorkNorm(pGroupJg,pXieJg,&norm); //工作面法线 else norm=(pXieFlat!=NULL ? pXieFlat->WorkPlaneNorm() : pXieSlot->WorkPlaneNorm()); for(int i=0;i<4;i++) { if(pGroupJg->group_style<2&&i>=2) continue; //个别四角钢转换为双拼角钢时,会把第三、四根子角钢转换为虚角钢存在 wht 11-08-05 if(pGroupJg->son_jg_h[i]<0x20) continue; CLDSLineAngle *pJg=(CLDSLineAngle*)console.FromPartHandle(pGroupJg->son_jg_h[i],CLS_LINEANGLE); if(pJg==NULL) continue; f3dPoint wing_vec; if(fabs(pJg->get_norm_x_wing()*norm)>fabs(pJg->get_norm_y_wing()*norm)) wing_vec=pJg->GetWingVecX(); else wing_vec=pJg->GetWingVecY(); if(wing_vec*ray_vec>0) { pSonJg=pJg; break; } } if(pSonJg) pFatherRod=pSonJg; else { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "Datum parent rod doesn't support the connection!"; #else throw "基点父杆件不支持该连接!"; #endif else return FALSE; } } g_pSolidDraw->SetEntSnapStatus(pNode->handle); g_pSolidDraw->SetEntSnapStatus(pXieRod->handle); if(bCanUndo) //支持撤销操作 Ta.BeginUndoListen(); //开始监听 if(pXieRod->IsAngle()) { pXieJg=(CLDSLineAngle*)pXieRod; GetWorkNorm(pFatherRod.pAngle,pXieJg,&norm); bInsideJg1 = IsInsideJg(pXieJg,norm,&x_wing0_y_wing1); if(x_wing0_y_wing1==0) direct = pXieJg->get_norm_y_wing(); else direct = pXieJg->get_norm_x_wing(); ls.set_norm(norm); getjgzj(jgzj,pXieJg->GetWidth()); if(pXieJg->m_bEnableTeG) { if(x_wing0_y_wing1==0) jgzj = pXieJg->xWingXZhunJu; else jgzj = pXieJg->xWingYZhunJu; } if(pXieJg->pStart == pNode) { len_offset1=pXieJg->desStartPos.len_offset_dist; ls_pos=pXieJg->GetStartDatumPos(); GetLsSpace(LsSpace,pXieJg->connectStart.d); pXieJg->SetStartOdd(LsSpace.EndSpace); pXieJg->desStartOdd.m_iOddCalStyle=2; if(pXieJg->desStartPos.jgber_cal_style==2) //简单定位时,为避免后续自动判断改变基点定位类型,改为人工指定模式 wjh-2016.3.24 pXieJg->desStartPos.bUdfDatumPointMode=TRUE; if(bInsideJg1) { if(x_wing0_y_wing1==0) { pXieJg->desStartPos.wing_x_offset.gStyle=4; pXieJg->desStartPos.wing_x_offset.offsetDist=-pFatherRod->GetThick(); if(pGroupJg) //节点父角钢为组合角钢 调整斜材偏移量时考虑组合角钢间隙值 wht 10-11-23 pXieJg->desStartPos.wing_x_offset.offsetDist-=(pGroupJg->jg_space*0.5); } else { pXieJg->desStartPos.wing_y_offset.gStyle=4; pXieJg->desStartPos.wing_y_offset.offsetDist=-pFatherRod->GetThick(); if(pGroupJg) //节点父角钢为组合角钢 调整斜材偏移量时考虑组合角钢间隙值 wht 10-11-23 pXieJg->desStartPos.wing_y_offset.offsetDist-=(pGroupJg->jg_space*0.5); } pXieJg->ClearFlag(); pXieJg->CalPosition(); Sub_Pnt(ls_pos,ls_pos,ls.get_norm()* (pFatherRod->GetThick()+pXieJg->GetThick())); sprintf(ls.des_base_pos.norm_offset.key_str,"-0X%X,-0X%X",pFatherRod->handle,pXieJg->handle); } else { if(pGroupJg) { //节点父角钢为组合角钢 调整斜材偏移量时考虑组合角钢间隙值 wht 10-11-23 if(x_wing0_y_wing1==0) { pXieJg->desStartPos.wing_x_offset.gStyle=4; pXieJg->desStartPos.wing_x_offset.offsetDist=pGroupJg->jg_space*0.5; } else { pXieJg->desStartPos.wing_y_offset.gStyle=4; pXieJg->desStartPos.wing_y_offset.offsetDist=pGroupJg->jg_space*0.5; } pXieJg->ClearFlag(); pXieJg->CalPosition(); } Sub_Pnt(ls_pos,ls_pos,ls.get_norm()*pFatherRod->GetThick()); ls.des_base_pos.norm_offset.AddThick(-pFatherRod->handle,TRUE); } ls.set_d(pXieJg->connectStart.d); //上移添加螺栓通厚的位置 wht 10-11-04 ls.AddL0Thick(pFatherRod->handle,TRUE); ls.AddL0Thick(pXieJg->handle,TRUE); if(!ls.CalGuigeAuto()) { char sError[200]=""; #ifdef AFX_TARG_ENU_ENGLISH sprintf(sError,"Can't find bolt specification M%dX%.f in specification library",pXieJg->connectStart.d,ls.get_L0()); #else sprintf(sError,"在螺栓规格库中没有找到符合M%dX%.f的螺栓规格",pXieJg->connectStart.d,ls.L0); #endif if(bThrowError) throw sError; else return FALSE; } ls.ucs.origin=ls_pos; ls.set_d(pXieJg->connectStart.d); pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->CopyProperty(&ls); pBolt->CopyModuleInstanceInfo(pNode); pBolt->iSeg=pXieJg->iSeg; pBolt->layer(2)=pXieJg->layer(2); //调整螺栓图层名 pBolt->cfgword=pFatherRod->UnifiedCfgword()&pXieJg->UnifiedCfgword(); //调整螺栓配材号与基准构件配材号一致 //螺栓位置设计\工作法线设计信息填充 pBolt->des_base_pos.datumPoint.datum_pos_style=3; //心线交点 pBolt->des_base_pos.hPart=pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1 = pFatherRod->handle; pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2 = pXieJg->handle; pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=4; pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2=0; pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist2 = jgzj.g; if(pXieJg->desStartPos.IsInDatumJgWingX()) //搭于父角钢X肢 { pBolt->des_work_norm.norm_wing=0; pBolt->des_work_norm.direction=0; pBolt->des_base_pos.len_offset_dist=0; pBolt->des_base_pos.wing_offset_dist = 0; if(pNode->hFatherPart==pFatherRod->handle) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=(short)pNode->xFatherAngleZhunJu.offset_X_dist_style; else pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=0; if(pFatherRod->IsAngle()) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod.pAngle->GetNodeWingXG(pNode)); else if(pFatherRod->GetClassTypeId()==CLS_LINESLOT||pFatherRod->GetClassTypeId()==CLS_ARCSLOT) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetHeight()/2); else// pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetWidth()/2); } else //搭于父角钢Y肢 { pBolt->des_work_norm.norm_wing=1; pBolt->des_work_norm.direction=0; pBolt->des_base_pos.offset_wing=1; pBolt->des_base_pos.len_offset_dist=0; pBolt->des_base_pos.wing_offset_dist = 0; if(pNode->hFatherPart==pFatherRod->handle) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=(short)pNode->xFatherAngleZhunJu.offset_Y_dist_style; else pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=0; if(pFatherRod->IsAngle()) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod.pAngle->GetNodeWingYG(pNode)); else if(pFatherRod->GetClassTypeId()==CLS_LINESLOT||pFatherRod->GetClassTypeId()==CLS_ARCSLOT) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetHeight()/2); else// pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetWidth()/2); } if(pFatherRod->IsArcPart()) { pBolt->des_work_norm.norm_style=1; pBolt->des_work_norm.hVicePart=pXieJg->handle; pBolt->des_work_norm.norm_wing=x_wing0_y_wing1; } else //if(pFatherRod->IsAngle()) { pBolt->des_work_norm.norm_style=1; //指定角钢肢法线方向 pBolt->des_work_norm.hVicePart = pFatherRod->handle; } //pBolt->des_base_pos.hNode = pNode->handle; pBolt->des_base_pos.norm_offset=ls.des_base_pos.norm_offset; if(!pFatherRod->IsLinePart()) pFatherRod->AppendLsRef(pBolt->GetLsRef()); else if(pFatherRod.pRod->pStart==pNode) pFatherRod.pRod->AppendStartLsRef(pBolt->GetLsRef()); else if(pFatherRod.pRod->pEnd==pNode) pFatherRod.pRod->AppendEndLsRef(pBolt->GetLsRef()); else pFatherRod.pRod->AppendMidLsRef(pBolt->GetLsRef()); pXieJg->AppendStartLsRef(pBolt->GetLsRef()); if(pFatherRod->IsAngle()) pXieJg->CalCutAngleInfo(pFatherRod.pAngle,NULL,true,NULL); pXieJg->SetModified(); } else if(pXieJg->pEnd == pNode) { len_offset1=pXieJg->desStartPos.len_offset_dist; GetLsSpace(LsSpace,pXieJg->connectEnd.d); pXieJg->SetEndOdd(LsSpace.EndSpace); pXieJg->desEndOdd.m_iOddCalStyle=2; if(pXieJg->desEndPos.jgber_cal_style==2) //简单定位时,为避免后续自动判断改变基点定位类型,改为人工指定模式 wjh-2016.3.24 pXieJg->desEndPos.bUdfDatumPointMode=TRUE; ls_pos=pXieJg->GetEndDatumPos(); if(bInsideJg1) { if(x_wing0_y_wing1==0) { pXieJg->desEndPos.wing_x_offset.gStyle=4; pXieJg->desEndPos.wing_x_offset.offsetDist=-pFatherRod->GetThick(); if(pGroupJg) //节点父角钢为组合角钢 调整斜材偏移量时考虑组合角钢间隙值 wht 10-11-23 pXieJg->desEndPos.wing_x_offset.offsetDist-=(pGroupJg->jg_space*0.5); } else { pXieJg->desEndPos.wing_y_offset.gStyle=4; pXieJg->desEndPos.wing_y_offset.offsetDist=-pFatherRod->GetThick(); if(pGroupJg) //节点父角钢为组合角钢 调整斜材偏移量时考虑组合角钢间隙值 wht 10-11-23 pXieJg->desEndPos.wing_y_offset.offsetDist-=(pGroupJg->jg_space*0.5); } pXieJg->ClearFlag(); pXieJg->CalPosition(); Sub_Pnt(ls_pos,ls_pos,ls.get_norm()* (pFatherRod->GetThick()+pXieJg->GetThick())); sprintf(ls.des_base_pos.norm_offset.key_str,"-0X%X,-0X%X",pFatherRod->handle,pXieJg->handle); } else { if(pGroupJg) { //节点父角钢为组合角钢 调整斜材偏移量时考虑组合角钢间隙值 wht 10-11-23 if(x_wing0_y_wing1==0) { pXieJg->desEndPos.wing_x_offset.gStyle=4; pXieJg->desEndPos.wing_x_offset.offsetDist=pGroupJg->jg_space*0.5; } else { pXieJg->desEndPos.wing_y_offset.gStyle=4; pXieJg->desEndPos.wing_y_offset.offsetDist=pGroupJg->jg_space*0.5; } pXieJg->ClearFlag(); pXieJg->CalPosition(); } Sub_Pnt(ls_pos,ls_pos,ls.get_norm()*pFatherRod->GetThick()); ls.des_base_pos.norm_offset.AddThick(-pFatherRod->handle,TRUE); } //添加螺栓通厚设计参数 ls.EmptyL0DesignPara(); //清空螺栓通厚设计参数 ls.AddL0Thick(pFatherRod->handle,TRUE); ls.AddL0Thick(pXieJg->handle,TRUE); ls.set_d(pXieJg->connectEnd.d); if(!ls.CalGuigeAuto()) { char sError[200]=""; #ifdef AFX_TARG_ENU_ENGLISH sprintf(sError,"Can't find bolt specification M%dX%.f in specification library",pXieJg->connectEnd.d,ls.get_L0()); #else sprintf(sError,"在螺栓规格库中没有找到符合M%dX%.f的螺栓规格",pXieJg->connectEnd.d,ls.L0); #endif if(bThrowError) throw sError; else return FALSE; } ls.ucs.origin=ls_pos; ls.set_d(pXieJg->connectEnd.d); pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->CopyProperty(&ls); pBolt->CopyModuleInstanceInfo(pNode); pBolt->iSeg=pXieJg->iSeg; pBolt->layer(2)=pXieJg->layer(2); //调整螺栓图层名 pBolt->cfgword=pFatherRod->UnifiedCfgword()&pXieJg->UnifiedCfgword(); //调整螺栓配材号与基准构件配材号一致 //螺栓位置设计\工作法线设计信息填充 pBolt->des_base_pos.datumPoint.datum_pos_style=3; //心线交点 pBolt->des_base_pos.hPart=pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1 = pFatherRod->handle; pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2 = pXieJg->handle; pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=4; pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2=0; pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist2 = jgzj.g; if(pXieJg->desEndPos.IsInDatumJgWingX()) //搭于父角钢X肢 { pBolt->des_work_norm.norm_wing=0; pBolt->des_work_norm.direction=0; pBolt->des_base_pos.len_offset_dist=0; pBolt->des_base_pos.wing_offset_dist = 0; if(pNode->hFatherPart==pFatherRod->handle) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=(short)pNode->xFatherAngleZhunJu.offset_X_dist_style; else pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=0; if(pFatherRod->IsAngle()) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod.pAngle->GetNodeWingXG(pNode)); else if(pFatherRod->GetClassTypeId()==CLS_LINESLOT||pFatherRod->GetClassTypeId()==CLS_ARCSLOT) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetHeight()/2); else// pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetWidth()/2); } else //搭于父角钢Y肢 { pBolt->des_work_norm.norm_wing=1; pBolt->des_work_norm.direction=0; pBolt->des_base_pos.offset_wing=1; pBolt->des_base_pos.len_offset_dist=0; pBolt->des_base_pos.wing_offset_dist = 0; if(pNode->hFatherPart==pFatherRod->handle) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=(short)pNode->xFatherAngleZhunJu.offset_Y_dist_style; else pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=0; if(pFatherRod->IsAngle()) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod.pAngle->GetNodeWingYG(pNode)); else if(pFatherRod->GetClassTypeId()==CLS_LINESLOT||pFatherRod->GetClassTypeId()==CLS_ARCSLOT) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetHeight()/2); else// pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetWidth()/2); } if(pFatherRod->IsArcPart()) { pBolt->des_work_norm.norm_style=1; pBolt->des_work_norm.hVicePart=pXieJg->handle; pBolt->des_work_norm.norm_wing=x_wing0_y_wing1; } else //if(pFatherRod->IsAngle()) { pBolt->des_work_norm.norm_style=1; //指定角钢肢法线方向 pBolt->des_work_norm.hVicePart = pFatherRod->handle; } //pBolt->des_base_pos.hNode = pNode->handle; pBolt->des_base_pos.norm_offset=ls.des_base_pos.norm_offset; if(!pFatherRod->IsLinePart()) pFatherRod->AppendLsRef(pBolt->GetLsRef()); else if(pFatherRod.pRod->pStart==pNode) pFatherRod.pRod->AppendStartLsRef(pBolt->GetLsRef()); else if(pFatherRod.pRod->pEnd==pNode) pFatherRod.pRod->AppendEndLsRef(pBolt->GetLsRef()); else pFatherRod.pRod->AppendMidLsRef(pBolt->GetLsRef()); pXieJg->AppendEndLsRef(pBolt->GetLsRef()); if(pFatherRod->IsAngle()) pXieJg->CalCutAngleInfo(pFatherRod.pAngle,NULL,false,NULL); pXieJg->SetModified(); } else { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "The selected ray part doesn't through current node"; #else throw "所选射线材,不通过当前节点"; #endif else return FALSE; } pXieJg->SetModified(); pXieJg->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pXieJg->GetSolidPartObject()); } else if(pXieRod->GetClassTypeId()==CLS_LINESLOT||pXieRod->GetClassTypeId()==CLS_LINEFLAT) { norm=(pXieFlat!=NULL ? pXieFlat->WorkPlaneNorm() : pXieSlot->WorkPlaneNorm()); ls.set_norm(norm); if(pXieRod->pStart==pNode) { GetLsSpace(LsSpace,pXieRod->connectStart.d); pXieRod->SetStartOdd(LsSpace.EndSpace); pXieRod->desStartOdd.m_iOddCalStyle=2; pXieRod->ClearFlag(); pXieRod->CalPosition(); ls_pos=pXieRod->Start(); Sub_Pnt(ls_pos,ls_pos,ls.get_norm()*pFatherRod->GetThick()); sprintf(ls.des_base_pos.norm_offset.key_str,"-0X%X",pFatherRod->handle); ls.set_d(pXieRod->connectStart.d); ls.AddL0Thick(pFatherRod->handle,TRUE); ls.AddL0Thick(pXieRod->handle,TRUE); ls.ucs.origin=ls_pos; if(!ls.CalGuigeAuto()) { char sError[200]=""; #ifdef AFX_TARG_ENU_ENGLISH sprintf(sError,"Can't find bolt specification M%dX%.f in specification library",pXieRod->connectStart.d,ls.get_L0()); #else sprintf(sError,"在螺栓规格库中没有找到符合M%dX%.f的螺栓规格",pXieRod->connectStart.d,ls.L0); #endif if(bThrowError) throw sError; else return FALSE; } pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->CopyProperty(&ls); pBolt->iSeg=pXieRod->iSeg; //pBolt->layer(2)=pXieRod->layer(2); //调整螺栓图层名 pBolt->CopyModuleInstanceInfo(pNode); pBolt->cfgword=pFatherRod->UnifiedCfgword()&pXieRod->UnifiedCfgword(); //调整螺栓配材号与基准构件配材号一致 //螺栓位置设计\工作法线设计信息填充 pBolt->des_base_pos.datumPoint.datum_pos_style=3; //心线交点 pBolt->des_base_pos.hPart=pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1 = pFatherRod->handle; pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=4; //指定构件是扁铁时,不需要肢方向偏移类型和偏移量 pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2 = pXieRod->handle; CTubeEndPosPara* pCurrPos=(pXieSlot!=NULL ? &pXieSlot->desStartPos : &pXieFlat->desStartPos); if(pCurrPos->IsInDatumJgWingX()) //搭于父角钢X肢 { pBolt->des_work_norm.norm_wing=0; pBolt->des_work_norm.direction=0; pBolt->des_base_pos.len_offset_dist=0; pBolt->des_base_pos.wing_offset_dist = 0; if(pFatherRod->IsAngle()) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod.pAngle->GetNodeWingXG(pNode)); else if(pFatherRod->GetClassTypeId()==CLS_LINESLOT||pFatherRod->GetClassTypeId()==CLS_ARCSLOT) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetHeight()/2); else// pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetWidth()/2); } else //搭于父角钢Y肢 { pBolt->des_work_norm.norm_wing=1; pBolt->des_work_norm.direction=0; pBolt->des_base_pos.offset_wing=1; pBolt->des_base_pos.len_offset_dist=0; pBolt->des_base_pos.wing_offset_dist = 0; if(pFatherRod->IsAngle()) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod.pAngle->GetNodeWingYG(pNode)); else if(pFatherRod->GetClassTypeId()==CLS_LINESLOT||pFatherRod->GetClassTypeId()==CLS_ARCSLOT) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetHeight()/2); else// pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetWidth()/2); } if(pFatherRod->IsArcPart()||pFatherRod.IsEqualPtr(pXieRod)) { pBolt->des_work_norm.norm_style=5; pBolt->des_work_norm.hVicePart = pXieRod->handle; if(pXieFlat) //扁铁法线+ pBolt->des_work_norm.direction=2; else if(pXieSlot) //槽钢侧向法线+ pBolt->des_work_norm.direction=4; } else if(pFatherRod->GetClassTypeId()==CLS_LINESLOT||pFatherRod->GetClassTypeId()==CLS_LINEFLAT) { pBolt->des_work_norm.norm_style=5; //指定角钢肢法线方向 pBolt->des_work_norm.hVicePart = pFatherRod->handle; if(pFatherRod->GetClassTypeId()==CLS_LINEFLAT) pBolt->des_work_norm.direction=2; //扁铁法线+ else pBolt->des_work_norm.direction=4; //槽钢侧向法线+ } else //if(pFatherRod->IsAngle()) { pBolt->des_work_norm.norm_style=1; //指定角钢肢法线方向 pBolt->des_work_norm.hVicePart = pFatherRod->handle; } if(!pFatherRod->IsLinePart()) pFatherRod->AppendLsRef(pBolt->GetLsRef()); else if(pFatherRod.pRod->pStart==pNode) pFatherRod.pRod->AppendStartLsRef(pBolt->GetLsRef()); else if(pFatherRod.pRod->pEnd==pNode) pFatherRod.pRod->AppendEndLsRef(pBolt->GetLsRef()); else pFatherRod.pRod->AppendMidLsRef(pBolt->GetLsRef()); pXieRod->AppendStartLsRef(pBolt->GetLsRef()); pXieRod->SetModified(); } else if(pXieRod->pEnd==pNode) { GetLsSpace(LsSpace,pXieRod->connectEnd.d); pXieRod->SetEndOdd(LsSpace.EndSpace); pXieRod->desEndOdd.m_iOddCalStyle=2; ls_pos=pXieRod->End(); pXieRod->ClearFlag(); pXieRod->CalPosition(); Sub_Pnt(ls_pos,ls_pos,ls.get_norm()*pFatherRod->GetThick()); ls.des_base_pos.norm_offset.AddThick(-pFatherRod->handle,TRUE); ls.EmptyL0DesignPara(); //清空螺栓通厚设计参数 ls.AddL0Thick(pFatherRod->handle,TRUE); ls.AddL0Thick(pXieRod->handle,TRUE); ls.ucs.origin=ls_pos; ls.set_d(pXieRod->connectEnd.d); if(!ls.CalGuigeAuto()) { char sError[200]=""; #ifdef AFX_TARG_ENU_ENGLISH sprintf(sError,"Can't find bolt specification M%dX%.f in specification library",pXieRod->connectEnd.d,ls.get_L0()); #else sprintf(sError,"在螺栓规格库中没有找到符合M%dX%.f的螺栓规格",pXieRod->connectEnd.d,ls.L0); #endif if(bThrowError) throw sError; else return FALSE; } pBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt->CopyProperty(&ls); pBolt->iSeg=pXieRod->iSeg; //pBolt->layer(2)=pXieRod->layer(2); //调整螺栓图层名 pBolt->CopyModuleInstanceInfo(pNode); pBolt->cfgword=pFatherRod->UnifiedCfgword()&pXieRod->UnifiedCfgword(); //调整螺栓配材号与基准构件配材号一致 //螺栓位置设计\工作法线设计信息填充 pBolt->des_base_pos.datumPoint.datum_pos_style=3; //心线交点 pBolt->des_base_pos.hPart=pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1 = pFatherRod->handle; pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=4; //指定构件是扁铁时,不需要肢方向偏移类型和偏移量 pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2 = pXieRod->handle; CTubeEndPosPara* pCurrPos=(pXieSlot!=NULL ? &pXieSlot->desEndPos : &pXieFlat->desEndPos); if(pCurrPos->IsInDatumJgWingX()) //搭于父角钢X肢 { pBolt->des_work_norm.norm_wing=0; pBolt->des_work_norm.direction=0; pBolt->des_base_pos.len_offset_dist=0; pBolt->des_base_pos.wing_offset_dist = 0; if(pFatherRod->IsAngle()) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod.pAngle->GetNodeWingXG(pNode)); else if(pFatherRod->GetClassTypeId()==CLS_LINESLOT||pFatherRod->GetClassTypeId()==CLS_ARCSLOT) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetHeight()/2); else// pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetWidth()/2); } else //搭于父角钢Y肢 { pBolt->des_work_norm.norm_wing=1; pBolt->des_work_norm.direction=0; pBolt->des_base_pos.offset_wing=1; pBolt->des_base_pos.len_offset_dist=0; pBolt->des_base_pos.wing_offset_dist = 0; if(pFatherRod->IsAngle()) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod.pAngle->GetNodeWingYG(pNode)); else if(pFatherRod->GetClassTypeId()==CLS_LINESLOT||pFatherRod->GetClassTypeId()==CLS_ARCSLOT) pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetHeight()/2); else// pBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 = ftoi(pFatherRod->GetWidth()/2); } if(pFatherRod->IsArcPart()||pFatherRod.IsEqualPtr(pXieRod)) { pBolt->des_work_norm.norm_style=5; pBolt->des_work_norm.hVicePart = pXieRod->handle; if(pXieFlat) //扁铁法线+ pBolt->des_work_norm.direction=2; else if(pXieSlot) //槽钢侧向法线+ pBolt->des_work_norm.direction=4; } else if(pFatherRod->GetClassTypeId()==CLS_LINESLOT||pFatherRod->GetClassTypeId()==CLS_LINEFLAT) { pBolt->des_work_norm.norm_style=5; //指定角钢肢法线方向 pBolt->des_work_norm.hVicePart = pFatherRod->handle; if(pFatherRod->GetClassTypeId()==CLS_LINEFLAT) pBolt->des_work_norm.direction=2; //扁铁法线+ else pBolt->des_work_norm.direction=4; //槽钢侧向法线+ } else //if(pFatherRod->IsAngle()) { pBolt->des_work_norm.norm_style=1; //指定角钢肢法线方向 pBolt->des_work_norm.hVicePart = pFatherRod->handle; } if(!pFatherRod->IsLinePart()) pFatherRod->AppendLsRef(pBolt->GetLsRef()); else if(pFatherRod.pRod->pStart==pNode) pFatherRod.pRod->AppendStartLsRef(pBolt->GetLsRef()); else if(pFatherRod.pRod->pEnd==pNode) pFatherRod.pRod->AppendEndLsRef(pBolt->GetLsRef()); else pFatherRod.pRod->AppendMidLsRef(pBolt->GetLsRef()); pXieRod->AppendEndLsRef(pBolt->GetLsRef()); pXieRod->SetModified(); } else { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "The selected ray part doesn't through current node"; #else throw "所选射线材,不通过当前节点"; #endif else return FALSE; } pXieRod->SetModified(); pXieRod->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pXieRod->GetSolidPartObject()); } for(index=1;index<3;index++) { //引入螺栓 调整角钢正负头以及角钢摆放位置 if(arrRayAngles[index]) pXieRod2=arrRayAngles[index]; else if(index==2) break; if(pXieRod2==NULL) continue; if(pXieRod2->IsAngle()) pXieJg2=(CLDSLineAngle*)pXieRod2; else if(pXieRod2->GetClassTypeId()==CLS_LINEFLAT) pXieFlat2=(CLDSLineFlat*)pXieRod2; else if(pXieRod2->GetClassTypeId()==CLS_LINESLOT) pXieSlot2=(CLDSLineSlot*)pXieRod2; if(pXieFlat || pXieFlat2 ||pXieSlot2) { if(bThrowError) #ifdef AFX_TARG_ENU_ENGLISH throw "Curent only support angle's single-bolt-connection of three rod.!"; #else throw "三根杆件的单螺栓连接,目前只支持角钢的设计!"; #endif else return FALSE; } if(norm.IsZero()) GetWorkNorm(pFatherRod.pAngle,pXieJg2,&norm); bInsideJg2 = IsInsideJg(pXieJg2,norm,&x_wing0_y_wing1); CConnectInfo* pCurrConnBoltInfo=NULL; if(pXieRod2->pStart==pNode) pCurrConnBoltInfo=&pXieRod2->connectStart; else if(pXieRod2->pEnd==pNode) pCurrConnBoltInfo=&pXieRod2->connectEnd; if(pXieJg2->pStart == pNode) { len_offset2=pXieJg2->desStartPos.len_offset_dist; GetLsSpace(LsSpace,pXieJg2->connectStart.d); pXieJg2->SetStartOdd(LsSpace.EndSpace); pXieJg2->desStartOdd.m_iOddCalStyle=2; if(bInsideJg2) { if(x_wing0_y_wing1==0) { pXieJg2->desStartPos.wing_x_offset.gStyle=4; pXieJg2->desStartPos.wing_x_offset.offsetDist=-pFatherRod->GetThick(); if(pGroupJg) //节点父角钢为组合角钢 调整斜材偏移量时考虑组合角钢间隙值 wht 10-11-23 pXieJg2->desStartPos.wing_x_offset.offsetDist-=(pGroupJg->jg_space*0.5); } else { pXieJg2->desStartPos.wing_y_offset.gStyle=4; pXieJg2->desStartPos.wing_y_offset.offsetDist=-pFatherRod->GetThick(); if(pGroupJg) //节点父角钢为组合角钢 调整斜材偏移量时考虑组合角钢间隙值 wht 10-11-23 pXieJg2->desStartPos.wing_y_offset.offsetDist-=(pGroupJg->jg_space*0.5); } pXieJg2->ClearFlag(); pXieJg2->CalPosition(); } else if(pGroupJg) { //节点父角钢为组合角钢 调整斜材偏移量时考虑组合角钢间隙值 wht 10-11-23 if(x_wing0_y_wing1==0) { pXieJg2->desStartPos.wing_x_offset.gStyle=4; pXieJg2->desStartPos.wing_x_offset.offsetDist=pGroupJg->jg_space*0.5; } else { pXieJg2->desStartPos.wing_y_offset.gStyle=4; pXieJg2->desStartPos.wing_y_offset.offsetDist=pGroupJg->jg_space*0.5; } pXieJg2->ClearFlag(); pXieJg2->CalPosition(); } if(pFatherRod->IsAngle()) pXieJg2->CalCutAngleInfo(pFatherRod.pAngle,NULL,true,NULL); } else if(pXieJg2->pEnd == pNode) { len_offset2=pXieJg2->desEndPos.len_offset_dist; GetLsSpace(LsSpace,pXieJg2->connectEnd.d); pXieJg2->SetEndOdd(LsSpace.EndSpace); pXieJg2->desEndOdd.m_iOddCalStyle=2; if(bInsideJg2) { if(x_wing0_y_wing1==0) { pXieJg2->desEndPos.wing_x_offset.gStyle=4; pXieJg2->desEndPos.wing_x_offset.offsetDist=-pFatherRod->GetThick(); if(pGroupJg) //节点父角钢为组合角钢 调整斜材偏移量时考虑组合角钢间隙值 wht 10-11-23 pXieJg2->desEndPos.wing_x_offset.offsetDist-=(pGroupJg->jg_space*0.5); } else { pXieJg2->desEndPos.wing_y_offset.gStyle=4; pXieJg2->desEndPos.wing_y_offset.offsetDist=-pFatherRod->GetThick(); if(pGroupJg) //节点父角钢为组合角钢 调整斜材偏移量时考虑组合角钢间隙值 wht 10-11-23 pXieJg2->desEndPos.wing_y_offset.offsetDist-=(pGroupJg->jg_space*0.5); } pXieJg2->ClearFlag(); pXieJg2->CalPosition(); } else if(pGroupJg) { //节点父角钢为组合角钢 调整斜材偏移量时考虑组合角钢间隙值 wht 10-11-23 if(x_wing0_y_wing1==0) { pXieJg2->desEndPos.wing_x_offset.gStyle=4; pXieJg2->desEndPos.wing_x_offset.offsetDist=pGroupJg->jg_space*0.5; } else { pXieJg2->desEndPos.wing_y_offset.gStyle=4; pXieJg2->desEndPos.wing_y_offset.offsetDist=pGroupJg->jg_space*0.5; } pXieJg2->ClearFlag(); pXieJg2->CalPosition(); } if(pFatherRod->IsAngle()) pXieJg2->CalCutAngleInfo(pFatherRod.pAngle,NULL,false,NULL); } if(bInsideJg1!=bInsideJg2&&fabs(len_offset1-len_offset2)<EPS) { //两角钢一里一外,而且共用一颗螺栓情况 //更新螺栓通厚 pBolt->AddL0Thick(pXieJg2->handle,TRUE,TRUE); pBolt->CalGuigeAuto(); pBolt->SetModified(); pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); if(pXieJg2->pStart==pNode) pXieJg2->AppendStartLsRef(pBolt->GetLsRef()); else if(pXieJg2->pEnd==pNode) pXieJg2->AppendEndLsRef(pBolt->GetLsRef()); } else { //两角钢无共用螺栓情况 CLDSBolt *pBolt2=(CLDSBolt*)console.AppendPart(CLS_BOLT); pBolt2->CopyProperty(pBolt); pBolt2->d=pCurrConnBoltInfo->d; pBolt2->iSeg=pXieJg2->iSeg; //pBolt2->layer(2)=pXieJg2->layer(2); //调整螺栓图层名 pBolt2->CopyModuleInstanceInfo(pNode); pBolt2->cfgword=pFatherRod->UnifiedCfgword(); //调整螺栓配材号与基准构件配材号一致 pBolt2->cfgword&=pXieJg2->UnifiedCfgword(); pBolt2->des_base_pos=pBolt->des_base_pos; pBolt2->des_work_norm=pBolt->des_work_norm; pBolt2->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2 = pXieJg2->handle; pBolt2->EmptyL0DesignPara(); pBolt2->AddL0Thick(pFatherRod->handle,TRUE,TRUE); pBolt2->AddL0Thick(pXieJg2->handle,TRUE,TRUE); pBolt2->CalGuigeAuto(); pBolt2->correct_worknorm(); pBolt2->correct_pos(); pBolt2->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt2->GetSolidPartObject()); if(pXieJg2->pStart==pNode) pXieJg2->AppendStartLsRef(pBolt2->GetLsRef()); else if(pXieJg2->pEnd==pNode) pXieJg2->AppendEndLsRef(pBolt2->GetLsRef()); if(!pFatherRod->IsLinePart()) pFatherRod->AppendLsRef(pBolt->GetLsRef()); else if(pFatherRod.pRod->pStart==pNode) pFatherRod.pRod->AppendStartLsRef(pBolt2->GetLsRef()); else if(pFatherRod.pRod->pEnd==pNode) pFatherRod.pRod->AppendEndLsRef(pBolt2->GetLsRef()); else pFatherRod.pRod->AppendMidLsRef(pBolt2->GetLsRef()); } pXieRod2->SetModified(); pXieRod2->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength()); g_pSolidDraw->NewSolidPart(pXieRod2->GetSolidPartObject()); } if(pBolt) { pBolt->CalGuigeAuto(); pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); } theApp.GetLDSDoc()->SetModifiedFlag(); // 修改数据后应调用此函数置修改标志. if(bCanUndo) //支持撤销操作 Ta.EndUndoListen(); //结束监听 return TRUE; } BOOL DesignBoltOnlyConnect(CLDSNode *pNode,CLDSLinePart *pXieRod,CLDSLinePart *pXieRod2, BOOL bThrowError,BOOL bCanUndo/*=TRUE*/) { return DesignBoltOnlyConnect(pNode,pXieRod,pXieRod2,NULL,bThrowError,bCanUndo); } //设计单螺栓连接 int CLDSView::DesignOneBolt() { CLDSNode *pNode=NULL; CLDSLinePart *pLinePart=NULL,*pSecLinePart=NULL; CCmdLineDlg *pCmdLine = ((CMainFrame*)AfxGetMainWnd())->GetCmdLinePage(); int retcode=0; DWORD dwhObj=0,dwExportFlag=0; CSnapTypeVerify verifier(OBJPROVIDER::LINESPACE,SNAP_POINT); try { CLogErrorLife loglife; #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("1Bolt Please select node of single-bolt-connection which will be designed:",""); #else pCmdLine->FillCmdLine("1Bolt 请选择要设计单螺栓连接的节点:",""); #endif //切换到单线显示状态 CDisplayNodeAtFrontLife showPoint; showPoint.DisplayNodeAtFront(); while(1) { if((retcode=g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verifier))<0) { pCmdLine->CancelCmdLine(); return 0; } else if(retcode>0) { SELOBJ obj(dwhObj,dwExportFlag); if(pNode=console.FromNodeHandle(obj.hRelaObj)) { g_pSolidDraw->SetEntSnapStatus(obj.hRelaObj); break; } } } pCmdLine->FinishCmdLine(CXhChar16("0x%X",pNode->handle)); BOOL bRet=FALSE; CDianBanParaDlg dlg; if(pNode->m_cPosCalType==4) bRet=DesignIntersNode(pNode,TRUE,&dlg);//设计交叉单螺栓 else //if(pNode->m_cPosCalType!=4) { //非交叉节点, #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Please select one ray rod of single-bolt-connection which will be designed:",""); #else pCmdLine->FillCmdLine("选择当前要设计单螺栓连接的任一根射线杆件:",""); #endif verifier.SetVerifyFlag(OBJPROVIDER::LINESPACE,SNAP_LINE|SNAP_ARC); verifier.AddVerifyFlag(OBJPROVIDER::SOLIDSPACE,SELECT_LINEPART); while(1) { f3dLine line; if((retcode=g_pSolidSnap->SnapObject(&dwhObj,&dwExportFlag,&verifier))<0) { pCmdLine->CancelCmdLine(); return 0; } if(retcode==0) continue; //未选中 SELOBJ obj(dwhObj,dwExportFlag); dwhObj=obj.hRelaObj; if(pLinePart=(CLDSLinePart*)console.FromPartHandle(dwhObj,CLS_LINEPART)) { g_pSolidDraw->SetEntSnapStatus(dwhObj); break; } } pCmdLine->FinishCmdLine(CXhChar16("0x%X",pLinePart->handle)); SmartPartPtr pFatherPart=console.FromPartHandle(pNode->hFatherPart); if(pFatherPart.IsNULL()) { AfxMessageBox("当前连接节点缺少依附连接杆件"); return FALSE; } //基准角钢与基准节点的父角钢可确定一个平面 PARTSET partset; GEPOINT father_line_vec,temp_vec,work_norm; //CLDSLineAngle *pFatherAngle=pFatherPart->IsAngle()?pFatherPart.LineAnglePointer():NULL; if(pLinePart&&pLinePart->handle!=pNode->hFatherPart&&pFatherPart->IsLinePart()&& pLinePart->pStart&&pLinePart->pEnd&&pFatherPart.pRod->pStart&&pFatherPart.pRod->pEnd) { //基准节点的父角钢非基准角钢时,才可以执行下面的代码 //wht 09-08-07 father_line_vec=pFatherPart.pRod->pEnd->Position(false)-pFatherPart.pRod->pStart->Position(false); } else if(pLinePart&&pLinePart->handle!=pNode->hFatherPart&&pFatherPart->IsArcPart()) { father_line_vec=pFatherPart.pArcRod->GetArcTangentVec(pNode->Position()); } if(!father_line_vec.IsZero()) { normalize(father_line_vec); temp_vec=pLinePart->pEnd->Position(false)-pLinePart->pStart->Position(false); normalize(temp_vec); work_norm=temp_vec^father_line_vec; normalize(work_norm); for(CLDSLinePart *pLineRod=Ta.Parts.GetFirstLinePart();pLineRod;pLineRod=Ta.Parts.GetNextLinePart()) { if(pLineRod==pLinePart||pLineRod==pFatherPart) continue; //跳过基准角钢 if(pLineRod->pStart!=pNode&&pLineRod->pEnd!=pNode) continue; if(pLineRod->pStart==NULL||pLineRod->pEnd==NULL) continue; temp_vec=pLineRod->pEnd->Position(false)-pLineRod->pStart->Position(false); normalize(temp_vec); if(fabs(temp_vec*work_norm)<EPS2&&fabs(temp_vec*father_line_vec)<EPS_COS) partset.append(pLineRod); //需防止射线杆件与基准杆件平行(原为下面注释代码,5.14日改错) wjh-2015.8.29 //f3dPoint norm=temp_vec^father_line_vec; //normalize(norm); //if(fabs(work_norm*norm)>EPS_COS) // partset.append(pLineRod); } } #ifdef AFX_TARG_ENU_ENGLISH if(partset.GetNodeNum()>=1&&AfxMessageBox("Whether to design no plate's single-bolt-connection?",MB_YESNO)==IDYES) #else if(partset.GetNodeNum()>=1&&AfxMessageBox("是否进行无板单螺栓连接?",MB_YESNO)==IDYES) #endif pSecLinePart=(CLDSLinePart*)partset.GetFirst(); CLDSLinePart* pThirdRod=partset.GetNodeNum()<2?NULL:(CLDSLinePart*)partset.GetNext(); if(ValidateOneBoltConnect(pNode,pLinePart,pSecLinePart)) bRet=DesignBoltOnlyConnect(pNode,pLinePart,pSecLinePart,pThirdRod,TRUE,TRUE); else bRet=FALSE; } BOOL bIgnoreLsNum=FALSE; if(pLinePart&&bRet) bIgnoreLsNum=TRUE; //生成第一个螺栓时选择了忽略螺栓个数必须为1的限制,对称时也采取相应设置 //对称生成单螺栓连接 if(bRet) { if(pNode->m_cPosCalType==4) { //检查对称可用性 dlg.m_bMirCreate=TRUE; //对称生成交叉点螺栓 wht 11-01-11 } g_pSolidDraw->Draw(); static CMirMsgDlg mir_dlg; //根据节点对称方式初始化螺栓对称方式 wht 16-10-09 //根据宝鸡反馈单螺栓设计经常需要旋转对称,而如果按海涛所改(利波提的建议),就失去了旋转对称,不习惯 wjh-2016.12-17 if (mir_dlg.mirmsg.axis_flag==0) { //综合考虑如果第一次执行,应该根据当前节点的关联对称类型进行对称信息的初始化 wjh-2019.9.2 for (RELATIVE_OBJECT *pObj=pNode->relativeObjs.GetFirst();pObj;pObj=pNode->relativeObjs.GetNext()) mir_dlg.mirmsg.axis_flag|=pObj->mirInfo.axis_flag; } if(mir_dlg.DoModal()==IDOK) { MIRMSG mirmsg=mir_dlg.mirmsg; CLDSNode *src_mirnode[4]={NULL}; CLDSLinePart *src_mirpart[4]={NULL}; CLDSLinePart *src_mirsecpart[4]={NULL}; src_mirnode[0]=pNode; src_mirpart[0]=pLinePart; src_mirsecpart[0]=pSecLinePart; if(mir_dlg.mirmsg.axis_flag&1) { //X轴对称 src_mirnode[1]=pNode->GetMirNode(mir_dlg.mirmsg.GetSubMirItem(1)); if(pLinePart) src_mirpart[1]=(CLDSLinePart*)pLinePart->GetMirPart(mir_dlg.mirmsg.GetSubMirItem(1)); if(pSecLinePart) src_mirsecpart[1]=(CLDSLinePart*)pSecLinePart->GetMirPart(mir_dlg.mirmsg.GetSubMirItem(1)); if(pNode->m_cPosCalType==4) //交叉节点 DesignIntersNode(src_mirnode[1],TRUE,&dlg); //区分单角钢端连接对称和无板单螺栓对称 else if((pSecLinePart&&src_mirsecpart[1])||(pSecLinePart==NULL&&src_mirsecpart[1]==NULL)) { if(bIgnoreLsNum||ValidateOneBoltConnect(src_mirnode[1],src_mirpart[1],src_mirsecpart[1])) DesignBoltOnlyConnect(src_mirnode[1],src_mirpart[1],src_mirsecpart[1],TRUE,TRUE); } } if(mir_dlg.mirmsg.axis_flag&2) { //Y轴对称 src_mirnode[2]=pNode->GetMirNode(mir_dlg.mirmsg.GetSubMirItem(2)); if(pLinePart) src_mirpart[2]=(CLDSLinePart*)pLinePart->GetMirPart(mir_dlg.mirmsg.GetSubMirItem(2)); if(pSecLinePart) src_mirsecpart[2]=(CLDSLinePart*)pSecLinePart->GetMirPart(mir_dlg.mirmsg.GetSubMirItem(2)); if(pNode->m_cPosCalType==4) //交叉节点 DesignIntersNode(src_mirnode[2],TRUE,&dlg); //区分单角钢端连接对称和无板单螺栓对称 else if((pSecLinePart&&src_mirsecpart[2])||(pSecLinePart==NULL&&src_mirsecpart[2]==NULL)) { if(bIgnoreLsNum||ValidateOneBoltConnect(src_mirnode[2],src_mirpart[2],src_mirsecpart[2])) DesignBoltOnlyConnect(src_mirnode[2],src_mirpart[2],src_mirsecpart[2],TRUE,TRUE); } } if(mir_dlg.mirmsg.axis_flag&4) { //Z轴对称 src_mirnode[3]=pNode->GetMirNode(mir_dlg.mirmsg.GetSubMirItem(3)); if(pLinePart) src_mirpart[3]=(CLDSLinePart*)pLinePart->GetMirPart(mir_dlg.mirmsg.GetSubMirItem(3)); if(pSecLinePart) src_mirsecpart[3]=(CLDSLinePart*)pSecLinePart->GetMirPart(mir_dlg.mirmsg.GetSubMirItem(3)); if(pNode->m_cPosCalType==4) //交叉节点 DesignIntersNode(src_mirnode[3],TRUE,&dlg); //区分单角钢端连接对称和无板单螺栓对称 else if((pSecLinePart&&src_mirsecpart[3])||(pSecLinePart==NULL&&src_mirsecpart[3]==NULL)) { if(bIgnoreLsNum||ValidateOneBoltConnect(src_mirnode[3],src_mirpart[3],src_mirsecpart[3])) DesignBoltOnlyConnect(src_mirnode[3],src_mirpart[3],src_mirsecpart[3],TRUE,TRUE); } } if(mirmsg.axis_flag&8) { //旋转对称 mirmsg.axis_flag=8; for(int i=0;i<4;i++) { if(src_mirnode[i]==NULL) continue; CLDSNode *pMirNode=NULL; CLDSLinePart *pMirLinePart=NULL, *pMirSecLinePart=NULL; for(int j=0;j<mirmsg.array_num;j++) { if(pNode->m_cPosCalType!=4&&src_mirpart[i]==NULL) continue; //非交叉点螺栓 if(j==0) { pMirNode=src_mirnode[i]->GetMirNode(mirmsg); if(src_mirpart[i]) pMirLinePart=(CLDSLinePart*)src_mirpart[i]->GetMirPart(mirmsg); if(src_mirsecpart[i]) pMirSecLinePart=(CLDSLinePart*)src_mirsecpart[i]->GetMirPart(mirmsg); } else { pMirNode=pMirNode->GetMirNode(mirmsg); if(pMirLinePart) pMirLinePart=(CLDSLinePart*)pMirLinePart->GetMirPart(mirmsg); if(pMirSecLinePart) pMirSecLinePart=(CLDSLinePart*)pMirSecLinePart->GetMirPart(mirmsg); } if(pNode->m_cPosCalType==4&&pMirNode) //交叉点螺栓 DesignIntersNode(pMirNode,TRUE,&dlg); //区分单角钢端连接对称和无板单螺栓对称 else if(pMirNode&&pMirLinePart&&((pSecLinePart&&pMirSecLinePart)||(pSecLinePart==NULL||pMirSecLinePart==NULL))) { if(bIgnoreLsNum||ValidateOneBoltConnect(pMirNode,pMirLinePart,pMirSecLinePart)) DesignBoltOnlyConnect(pMirNode,pMirLinePart,pMirSecLinePart,TRUE,TRUE); } else break; } } } } } } catch(char *sError) { AfxMessageBox(sError); g_pSolidDraw->ReleaseSnapStatus(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Command:",""); #else pCmdLine->FillCmdLine("命令:",""); #endif return 0; } g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->Draw(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Command:",""); #else pCmdLine->FillCmdLine("命令:",""); #endif DesignOneBolt(); return 0; } //批量设计单螺栓连接 int CLDSView::DesignSpecNodeOneBolt() { CLDSNode *pNode; CLDSLineAngle *pAngle1=NULL,*pAngle2=NULL,*pAngle3=NULL; long *id_arr=NULL; long n=g_pSolidSnap->GetLastSelectEnts(id_arr); static CDesignOneBoltDlg one_bolt_dlg; if(one_bolt_dlg.DoModal()!=IDOK) return 0; CProcBarDlg *pProcDlg = new CProcBarDlg(this); pProcDlg->Create(); #ifdef AFX_TARG_ENU_ENGLISH pProcDlg->SetWindowText("Design process"); #else pProcDlg->SetWindowText("设计进度"); #endif BOOL bIgnoreError=FALSE; if(!one_bolt_dlg.m_bCheckUpLsNum) bIgnoreError=TRUE; //Ta.BeginUndoListen(); //批量设计时暂时不支持撤销操作 需保存的操作可能过多导致内存不足 wht 09-10-10 CUndoOperObject undo(&Ta,true); //换成成组undo应该可以避免undo存储信息过多的问题 for(int i=0;i<n;i++) { pNode=console.FromNodeHandle(id_arr[i]); pProcDlg->Refresh((i*100)/n); if(pNode==NULL) continue; try { if(pNode->m_cPosCalType==4&&one_bolt_dlg.m_bInterNodeBolt) //交叉节点 DesignIntersNode(pNode,FALSE,FALSE); else { PARTSET jgset; //连接在基准节点上的角钢集合 PARTSET partset[2]; //partset[0]搭接在X肢上的角钢集合,partset[1]搭接在Y肢上的角钢集合 Ta.Node.push_stack(); for(CLDSPart *pPart=Ta.Parts.GetFirst(CLS_LINEANGLE);pPart;pPart=Ta.Parts.GetNext(CLS_LINEANGLE)) { CLDSLinePart *pLinePart=(CLDSLinePart*)pPart; if(pLinePart->pStart==pNode||pLinePart->pEnd==pNode) jgset.append(pLinePart); } Ta.Node.pop_stack(); //将连接在基准节点上的角钢按搭接肢分类 CLDSLineAngle *pLineAngle=NULL,*pFatherLineAngle=NULL; pFatherLineAngle=(CLDSLineAngle*)console.FromPartHandle(pNode->hFatherPart,CLS_LINEANGLE); if(pFatherLineAngle) { f3dPoint norm_x,norm_y,father_line_vec; norm_x=pFatherLineAngle->get_norm_x_wing(); norm_y=pFatherLineAngle->get_norm_y_wing(); father_line_vec=pFatherLineAngle->End()-pFatherLineAngle->Start(); normalize(father_line_vec); for(pLineAngle=(CLDSLineAngle*)jgset.GetFirst();pLineAngle;pLineAngle=(CLDSLineAngle*)jgset.GetNext()) { if(pLineAngle==pFatherLineAngle) continue; f3dPoint line_vec=pLineAngle->End()-pLineAngle->Start(); normalize(line_vec); f3dPoint norm=line_vec^father_line_vec; normalize(norm); //cos(30°)=0.866 if(fabs(norm*norm_x)>0.866) //搭接在X肢上的射线角钢 partset[0].append(pLineAngle); else if(fabs(norm*norm_y)>0.866) //搭接在Y肢上的射线角钢 partset[1].append(pLineAngle); } } int i=0; //Ta.BeginUndoListen(); //支持逐步撤销 for(i=0;i<2;i++) { if(partset[i].GetNodeNum()==1&&one_bolt_dlg.m_bSingleAngleEndBolt) { pAngle1 = (CLDSLineAngle*)partset[i][0]; Ta.Node.push_stack(); if(pAngle1->pStart->handle==pNode->handle) { //始端螺栓设计个数为1,且未布置螺栓 if(pAngle1->connectStart.wnConnBoltN!=1&&!bIgnoreError) { #ifdef AFX_TARG_ENU_ENGLISH if(AfxMessageBox("Whether to ignore the error that all ray angle's number isnt't 1?",MB_YESNO)==IDYES) #else if(AfxMessageBox("是否忽略所有射线角钢端螺栓数不为1的错误?",MB_YESNO)==IDYES) #endif bIgnoreError=TRUE; } if((bIgnoreError||!bIgnoreError&&pAngle1->connectStart.wnConnBoltN==1)&&pAngle1->GetLocalLsCount(1,100)==0) DesignBoltOnlyConnect(pNode,pAngle1,NULL,FALSE,FALSE); } else if(pAngle1->pEnd->handle==pNode->handle) { //终端螺栓设计个数为1,且未布置螺栓 if(pAngle1->connectEnd.wnConnBoltN!=1&&!bIgnoreError) { #ifdef AFX_TARG_ENU_ENGLISH if(AfxMessageBox("Whether to ignore the error that all ray angle's number isnt't 1?",MB_YESNO)==IDYES) #else if(AfxMessageBox("是否忽略所有射线角钢端螺栓数不为1的错误?",MB_YESNO)==IDYES) #endif bIgnoreError=TRUE; } if((bIgnoreError||!bIgnoreError&&pAngle1->connectEnd.wnConnBoltN==1)&&pAngle1->GetLocalLsCount(2,100)==0) DesignBoltOnlyConnect(pNode,pAngle1,NULL,FALSE,FALSE); } Ta.Node.pop_stack(); } else if(partset[i].GetNodeNum()==2&&one_bolt_dlg.m_bSingleBoltNoPlate) { pAngle1 = (CLDSLineAngle*)partset[i][0]; pAngle2 = (CLDSLineAngle*)partset[i][1]; Ta.Node.push_stack(); //保证两根连接材在同一平面上 if(pAngle1->layer(2)!=pAngle2->layer(2)) continue; if(pAngle1->pStart->handle==pNode->handle) { //始端螺栓设计个数为1,且未布置螺栓 if(pAngle1->connectStart.wnConnBoltN!=1&&!bIgnoreError) { #ifdef AFX_TARG_ENU_ENGLISH if(AfxMessageBox("Whether to ignore the error that all ray angle's number isnt't 1?",MB_YESNO)==IDYES) #else if(AfxMessageBox("是否忽略所有射线角钢端螺栓数不为1的错误?",MB_YESNO)==IDYES) #endif bIgnoreError=TRUE; } if((bIgnoreError||!bIgnoreError&&pAngle1->connectStart.wnConnBoltN==1)&&pAngle1->GetLocalLsCount(1,100)==0) DesignBoltOnlyConnect(pNode,pAngle1,pAngle2,FALSE,FALSE); } else if(pAngle1->pEnd->handle==pNode->handle) { //终端螺栓设计个数为1,且未布置螺栓 if(pAngle1->connectEnd.wnConnBoltN!=1&&!bIgnoreError) { #ifdef AFX_TARG_ENU_ENGLISH if(AfxMessageBox("Whether to ignore the error that all ray angle's number isnt't 1?",MB_YESNO)==IDYES) #else if(AfxMessageBox("是否忽略所有射线角钢端螺栓数不为1的错误?",MB_YESNO)==IDYES) #endif bIgnoreError=TRUE; } if((bIgnoreError||!bIgnoreError&&pAngle1->connectEnd.wnConnBoltN==1)&&pAngle1->GetLocalLsCount(2,100)==0) DesignBoltOnlyConnect(pNode,pAngle1,pAngle2,FALSE,FALSE); } /* if(pAngle2->pStart->handle==pNode->handle) { //始端螺栓设计个数为1,且未布置螺栓 if(pAngle2->connectStart.wnConnBoltN==1&&pAngle2->GetLocalLsCount(1)==0) DesignBoltOnlyConnect(pNode,pAngle2,FALSE,FALSE); } else if(pAngle2->pEnd->handle==pNode->handle) { //终端螺栓设计个数为1,且未布置螺栓 if(pAngle2->connectEnd.wnConnBoltN==1&&pAngle2->GetLocalLsCount(2)==0) DesignBoltOnlyConnect(pNode,pAngle2,FALSE,FALSE); }*/ Ta.Node.pop_stack(); } else if(partset[i].GetNodeNum()==3&&one_bolt_dlg.m_bSingleBoltNoPlate) { pAngle1 = (CLDSLineAngle*)partset[i][0]; pAngle2 = (CLDSLineAngle*)partset[i][1]; pAngle3 = (CLDSLineAngle*)partset[i][2]; //f3dPoint norm1,norm2,norm3; //int x_wing0_y_wing1,x_wing0_y_wing2,x_wing0_y_wing3; //GetWorkNorm(pFatherLineAngle,pAngle1,&norm1); //GetWorkNorm(pFatherLineAngle,pAngle2,&norm2); //GetWorkNorm(pFatherLineAngle,pAngle3,&norm3); if(!(pAngle1->layer(2)==pAngle2->layer(2)&&pAngle2->layer(2)==pAngle3->layer(2))) continue; DesignBoltOnlyConnect(pNode,pAngle1,pAngle2,pAngle3,FALSE,FALSE); /* if(!(IsInsideJg(pAngle1,norm1,&x_wing0_y_wing1)==IsInsideJg(pAngle2,norm2,&x_wing0_y_wing2)&& IsInsideJg(pAngle2,norm2,&x_wing0_y_wing2)==IsInsideJg(pAngle3,norm3,&x_wing0_y_wing3))) continue; typedef CMultiOffsetPos* CMultiOffsetPosPtr; CMultiOffsetPosPtr desPosArr[3]={pAngle1->pStart->handle==pNode->handle?&pAngle1->desStartPos:&pAngle1->desEndPos, pAngle2->pStart->handle==pNode->handle?&pAngle2->desStartPos:&pAngle2->desEndPos, pAngle3->pStart->handle==pNode->handle?&pAngle3->desStartPos:&pAngle3->desEndPos}; if( (desPosArr[0]->len_offset_dist==0&&desPosArr[1]->len_offset_dist==0)|| (desPosArr[1]->len_offset_dist==0&&desPosArr[2]->len_offset_dist==0)|| (desPosArr[0]->len_offset_dist==0&&desPosArr[2]->len_offset_dist==0)) continue; Ta.Node.push_stack(); for(int j=0;j<=2;++j) { CLDSLineAngle *pAngle=(CLDSLineAngle*)partset[i][j]; if(pAngle->pStart->handle==pNode->handle) { //始端螺栓设计个数为1,且未布置螺栓 if(pAngle->connectStart.wnConnBoltN!=1&&!bIgnoreError) { #ifdef AFX_TARG_ENU_ENGLISH if(AfxMessageBox("Whether to ignore the error that all ray angle's number isnt't 1?",MB_YESNO)==IDYES) #else if(AfxMessageBox("是否忽略所有射线角钢端螺栓数不为1的错误?",MB_YESNO)==IDYES) #endif bIgnoreError=TRUE; } if((bIgnoreError||!bIgnoreError&&pAngle->connectStart.wnConnBoltN==1)&&pAngle->GetLocalLsCount(1)==0) DesignBoltOnlyConnect(pNode,pAngle,NULL,FALSE,FALSE); } else if(pAngle->pEnd->handle==pNode->handle) { //终端螺栓设计个数为1,且未布置螺栓 if(pAngle->connectEnd.wnConnBoltN!=1&&!bIgnoreError) { #ifdef AFX_TARG_ENU_ENGLISH if(AfxMessageBox("Whether to ignore the error that all ray angle's number isnt't 1?",MB_YESNO)==IDYES) #else if(AfxMessageBox("是否忽略所有射线角钢端螺栓数不为1的错误?",MB_YESNO)==IDYES) #endif bIgnoreError=TRUE; } if((bIgnoreError||!bIgnoreError&&pAngle->connectEnd.wnConnBoltN==1)&&pAngle->GetLocalLsCount(2)==0) DesignBoltOnlyConnect(pNode,pAngle,NULL,FALSE,FALSE); } } Ta.Node.pop_stack(); */ } } //Ta.EndUndoListen(); //支持逐步撤销 } } catch(char *sError) { AfxMessageBox(sError); g_pSolidDraw->SetEntSnapStatus(pNode->handle,FALSE); //Ta.EndUndoListen(); } } //Ta.EndUndoListen(); pProcDlg->DestroyWindow(); delete pProcDlg; return 0; } //根据外孔间隙调整螺栓纵向偏移量 //使用该函数之前应保证螺栓的位置以及法线参数已赋值 wht 10-07-22 int CalEndLjFirstBoltOffsetDist(CLDSBolt *pFirstBolt,CLDSLineAngle *pDatumLineAngle,CLDSLineAngle *pCrossAngle,int nFirstLsJgSpace=0) { if(pFirstBolt==NULL||pDatumLineAngle==NULL) return 0; if(nFirstLsJgSpace==0) { //根据螺栓直径得到外孔间隙 if(pFirstBolt->get_d()<=12) nFirstLsJgSpace = 15; else if(pFirstBolt->get_d()<=16) nFirstLsJgSpace = 20; else if(pFirstBolt->get_d()<=20) nFirstLsJgSpace = 25; else nFirstLsJgSpace = 30; } pFirstBolt->correct_worknorm(); // pFirstBolt->des_base_pos.datumPoint.UpdatePos(pFirstBolt->BelongModel()); f3dPoint line_vec,wing_vec,cross_wing_vec,cross_line_vec,cross_wing_norm; cross_line_vec= pCrossAngle->End()-pCrossAngle->Start(); normalize(cross_line_vec); int datum_wing_x0_y1=0,cross_wing_x0_y1=1; if(fabs(pFirstBolt->get_norm()*pDatumLineAngle->get_norm_x_wing())> fabs(pFirstBolt->get_norm()*pDatumLineAngle->get_norm_y_wing())) { datum_wing_x0_y1=0; wing_vec=pDatumLineAngle->GetWingVecX(); } else { datum_wing_x0_y1=1; wing_vec=pDatumLineAngle->GetWingVecY(); } if((fabs(pFirstBolt->get_norm()*pCrossAngle->get_norm_x_wing())> fabs(pFirstBolt->get_norm()*pCrossAngle->get_norm_y_wing()))) { cross_wing_x0_y1=0; cross_wing_norm=pCrossAngle->get_norm_x_wing(); cross_wing_vec=pCrossAngle->GetWingVecX(); } else { cross_wing_x0_y1=1; cross_wing_norm=pCrossAngle->get_norm_y_wing(); cross_wing_vec=pCrossAngle->GetWingVecY(); } if(pFirstBolt->des_base_pos.direction==1) line_vec=pDatumLineAngle->Start()-pDatumLineAngle->End(); else line_vec=pDatumLineAngle->End()-pDatumLineAngle->Start(); normalize(wing_vec); normalize(line_vec); f3dPoint pos=pFirstBolt->des_base_pos.datumPoint.Position()+ line_vec*pFirstBolt->des_base_pos.len_offset_dist+ wing_vec*pFirstBolt->des_base_pos.wing_offset_dist; f3dPoint verfiy_vec=pos-pFirstBolt->des_base_pos.datumPoint.Position(); normalize(verfiy_vec); if(verfiy_vec*line_vec<0) line_vec*=-1.0; UCS_STRU ucs; ucs.origin=pCrossAngle->Start(); ucs.axis_x=cross_line_vec; ucs.axis_y=cross_wing_vec; ucs.axis_z=ucs.axis_x^ucs.axis_y; normalize(ucs.axis_z); coord_trans(pos,ucs,FALSE); double cosa=line_vec*cross_wing_vec; double dd=0; if(cosa>0) //螺栓位于肢翼侧 dd=pos.y-pCrossAngle->GetWidth(); else //螺栓位于楞线侧 dd=-pos.y; double len_offset=0; if(dd<nFirstLsJgSpace) //目前间隙小于外孔间隙 { double add_offset=(nFirstLsJgSpace-dd)/fabs(cosa); double round_offset=fto_halfi(add_offset/10)*10; //圆整后的增加值 if(pFirstBolt->des_base_pos.len_offset_dist>0) { if(round_offset<add_offset) len_offset=pFirstBolt->des_base_pos.len_offset_dist+ftoi(round_offset)+5; else len_offset=pFirstBolt->des_base_pos.len_offset_dist+ftoi(round_offset); } else { if(round_offset<add_offset) len_offset=pFirstBolt->des_base_pos.len_offset_dist-ftoi(round_offset)-5; else len_offset=pFirstBolt->des_base_pos.len_offset_dist-ftoi(round_offset); } } else len_offset=pFirstBolt->des_base_pos.len_offset_dist; return abs((int)len_offset); //返回第一个外孔螺栓与角钢心线交点之间的距离 } /* 该项功能代码目前已完全被复制螺栓及偏移螺栓命令取代,待使用过程中进一步确认后删除 wjh-2015.3.8 //偏移生成螺栓 void CLDSView::OnDefOffsetLs() { m_nPrevCommandID=ID_DEF_OFFSET_LS; m_sPrevCommandName="重复定义偏移螺栓"; Command("OffsetBolt"); } int CLDSView::DefOffsetLs() { CXhChar100 sText;//[100]=""; int len_offset=0; CString cmdStr; //选中的射线角钢 CLDSLineAngle *pSelectLineAngle=NULL; //临时使用的变量 CLsRef *pLsRef=NULL; CCmdLineDlg *pCmdLine = ((CMainFrame*)AfxGetMainWnd())->GetCmdLinePage(); CLDSBolt *pDatumBolt=NULL; CLDSBolt *pNewBolt=NULL; GET_SCR_PART_PARA scr_part_para(GetSingleWord(SELECTINDEX_BOLT),CLS_BOLT); scr_part_para.disp_type=DISP_SOLID; scr_part_para.cmdStr="DefOffsetLs 请选择偏移基准螺栓:"; scr_part_para.cmdErrorFeedbackStr="没有选中合适的构件,请重新选择基准螺栓:"; if(!GetPartsFromScr(scr_part_para)) return 0; CLDSDbObject *pObj=scr_part_para.pResultObjsArr[0]; if(pObj&&pObj->GetClassTypeId()==CLS_BOLT) pDatumBolt=(CLDSBolt*)pObj; if(pDatumBolt==NULL) return 0; //选中螺栓所在的角钢 g_pSolidDraw->SetEntSnapStatus(pDatumBolt->des_base_pos.hPart,TRUE); g_pSolidDraw->Draw(); CLDSPlate *pDatumPlate=NULL; CLDSLineAngle *pDatumLineAngle = (CLDSLineAngle*)console.FromPartHandle(pDatumBolt->des_base_pos.hPart,CLS_LINEANGLE); for(pDatumPlate=(CLDSPlate*)Ta.Parts.GetFirst(CLS_PLATE);pDatumPlate;pDatumPlate=(CLDSPlate*)Ta.Parts.GetNext(CLS_PLATE)) { if(pDatumPlate->FindLsByHandle(pDatumBolt->handle)) break; } //选中螺栓所在的基准钢板 if(pDatumPlate) g_pSolidDraw->SetEntSnapStatus(pDatumPlate->handle,TRUE); LSSPACE_STRU LsSpace; GetLsSpace(LsSpace,pDatumBolt->get_d()); //生成偏移螺栓 Ta.BeginUndoListen(); pNewBolt=(CLDSBolt*)console.AppendPart(CLS_BOLT,TRUE); pDatumBolt->CloneTo(*pNewBolt); //基准螺栓定位方式为杆件节点定位 若选择射线角钢则需要生成心线交点螺栓 if((pDatumBolt->des_base_pos.datumPoint.datum_pos_style==2||pDatumBolt->des_base_pos.datumPoint.datum_pos_style==3) &&pDatumBolt->des_base_pos.len_offset_dist==0&&pDatumBolt->des_base_pos.wing_offset_dist==0) { //选择了在基准位置的螺栓,可以生成心线交点螺栓 Sleep(500);//高亮显示半秒钟,不然用户不知道是否选中了此构件显示状态就被冲掉了 pCmdLine->FillCmdLine("请选择需要添加螺栓的射线角钢<可不选,默认在基准角钢上布置螺栓>:",""); g_pSolidDraw->ReleaseSnapStatus(); g_pSolidSnap->SetSelectPartsType(GetSingleWord(SELECTINDEX_PLATE)); while(1) { if(pCmdLine->GetStrFromCmdLine(cmdStr)) { long *id_arr; if(g_pSolidSnap->GetLastSelectEnts(id_arr)==1) { CLDSPart *pPart=console.FromPartHandle(id_arr[0]); if(pPart) { if(pPart->GetClassTypeId()==CLS_LINEANGLE) { //所选射线杆件不在基准钢板连接构件列表中 if(pDatumPlate) { if(pDatumPlate->designInfo.FromHandle(pPart->handle)) pSelectLineAngle=(CLDSLineAngle*)pPart; else { pCmdLine->FillCmdLine("所选射线角钢未连接在基准钢板上,请重新选择<可不选,默认在基准角钢上布置螺栓>:",""); g_pSolidDraw->ReleaseSnapStatus(); continue; } } else { pSelectLineAngle=(CLDSLineAngle*)pPart; if(!pSelectLineAngle->FindLsByHandle(pDatumBolt->handle)) { pCmdLine->FillCmdLine("基准螺栓不在所选射线角钢上,请重新选择<可不选,默认在基准角钢上布置螺栓>:",""); g_pSolidDraw->ReleaseSnapStatus(); continue; } } } else { pCmdLine->FillCmdLine("没有选中合适的射线角钢,请重新选择<可不选,默认在基准角钢上布置螺栓>:",""); g_pSolidDraw->ReleaseSnapStatus(); continue; } break; } } //未选择射线角钢,默认在基准角钢上布置螺栓 if(pSelectLineAngle==NULL) break; } else { g_pSolidSnap->SetSelectPartsType(g_sysPara.m_dwSelectPartsType); Ta.EndUndoListen(); return 0; } } if(pSelectLineAngle==NULL) { //选中螺栓所在的角钢 g_pSolidDraw->SetEntSnapStatus(pDatumBolt->des_base_pos.hPart,TRUE); //选中螺栓所在的基准钢板 if(pDatumPlate) g_pSolidDraw->SetEntSnapStatus(pDatumPlate->handle,TRUE); } else if(pSelectLineAngle&&pDatumLineAngle&&pDatumPlate) { //选择了射线角钢可生成心线交点螺栓 g_pSolidDraw->Draw(); pCmdLine->FillCmdLine(cmdStr,""); pNewBolt->des_base_pos.datumPoint.datum_pos_style=3;//角钢心线交点 pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1=pDatumLineAngle->handle; pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2=pSelectLineAngle->handle; pNewBolt->des_base_pos.hPart=pSelectLineAngle->handle; //判断射线杆件为始端连接还是终端连接 f3dLine datum_line; datum_line.startPt=pDatumLineAngle->pStart->Position(true); datum_line.endPt=pDatumLineAngle->pEnd->Position(true); int start0_end1=0; //始端连接 始端==>终端 if(datum_line.PtInLine(pSelectLineAngle->pEnd->Position(true))>0) start0_end1=1; //终端连接 终端==>始端 pNewBolt->des_base_pos.direction=start0_end1; int nOffsetStyle=0; //g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->SetEntSnapStatus(pSelectLineAngle->handle,TRUE); cmdStr.Format("请输入射线角钢肢向偏移距离[0为g,1为g1,2为g2,3为g3,或直接输入距离]<%d>",0); pCmdLine->FillCmdLine(cmdStr,""); while(1) { if(!pCmdLine->GetStrFromCmdLine(cmdStr)) { Ta.EndUndoListen(); return 0; } if(cmdStr.GetLength()>0) { sText.Printf("%s",cmdStr); //sprintf(sText,"%s",cmdStr); nOffsetStyle = atoi(sText); } break; } if(nOffsetStyle>3) { pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2=4;//自定义偏移距离 pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist2=nOffsetStyle; } else pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2=nOffsetStyle; g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->SetEntSnapStatus(pDatumLineAngle->handle,TRUE); cmdStr.Format("请输入基准角钢肢向偏移距离[0为g,1为g1,2为g2,3为g3,或直接输入距离]<%d>:",0); pCmdLine->FillCmdLine(cmdStr,""); while(1) { if(!pCmdLine->GetStrFromCmdLine(cmdStr)) { Ta.EndUndoListen(); return 0; } if(cmdStr.GetLength()>0) { sText.Printf("%s",cmdStr); //sprintf(sText,"%s",cmdStr); nOffsetStyle = atoi(sText); } break; } if(nOffsetStyle>3) { pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=4;//自定义偏移距离 pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1=nOffsetStyle; } else pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1=nOffsetStyle; BOOL bEndLj=TRUE; cmdStr.Format("该射线角钢是否[Y/N]需要端连接<Y>:"); pCmdLine->FillCmdLine(cmdStr,""); while(1) { if(!pCmdLine->GetStrFromCmdLine(cmdStr)) { Ta.EndUndoListen(); return 0; } if(cmdStr.GetLength()>0) { if(cmdStr.CompareNoCase("N")==0) bEndLj=FALSE; else if(cmdStr.CompareNoCase("Y")==0) bEndLj=TRUE; else { pCmdLine->FinishCmdLine(); cmdStr.Format("输入错误请重新选择,该射线角钢是否[Y/N]需要端连接<Y>:"); continue; } } break; } if(bEndLj&&pDatumPlate) { //所选射线杆件需要端连接 CDesignLjPartPara *pLjPartPara=pDatumPlate->designInfo.FromHandle(pSelectLineAngle->handle); if(pLjPartPara) { if(pLjPartPara->start0_end1==0) { pSelectLineAngle->desStartOdd.m_iOddCalStyle=1;//按螺栓计算正负头 pSelectLineAngle->CalStartOddment(); pSelectLineAngle->AppendStartLsRef(pDatumBolt->GetLsRef()); } else if(pLjPartPara->start0_end1==1) { pSelectLineAngle->desEndOdd.m_iOddCalStyle=1; //按螺栓计算正负头 pSelectLineAngle->CalEndOddment(); pSelectLineAngle->AppendEndLsRef(pDatumBolt->GetLsRef()); } else pSelectLineAngle->AppendMidLsRef(pDatumBolt->GetLsRef()); f3dPoint ray_wing_norm,datum_wing_norm; if(pDatumBolt->des_base_pos.offset_wing==0) datum_wing_norm=pDatumLineAngle->get_norm_x_wing(); else datum_wing_norm=pDatumLineAngle->get_norm_y_wing(); if(pLjPartPara->angle.cur_wing_x0_y1==0) ray_wing_norm=pSelectLineAngle->get_norm_x_wing(); else ray_wing_norm=pSelectLineAngle->get_norm_y_wing(); if(ray_wing_norm*datum_wing_norm>0) //里铁 { //需要调整端连接射线角钢偏移距离 添加螺栓垫板 调整螺栓法向偏移量 计算切角信息 pDatumBolt->des_base_pos.norm_offset.AddThick(-pSelectLineAngle->handle,TRUE,TRUE); pNewBolt->des_base_pos.norm_offset.AddThick(-pSelectLineAngle->handle,TRUE,TRUE); CMultiOffsetPos *pDesPosPara=NULL; if(pLjPartPara->start0_end1==0) pDesPosPara=&pSelectLineAngle->desStartPos; else if(pLjPartPara->start0_end1==1) pDesPosPara=&pSelectLineAngle->desEndPos; if(pDesPosPara&&pDatumLineAngle) { //调整端连接射线角钢偏移方向 if(pLjPartPara->angle.cur_wing_x0_y1==0) { //当前连接肢为X肢 pDesPosPara->wing_x_offset.gStyle=4; pDesPosPara->wing_x_offset.offsetDist=-pDatumLineAngle->GetThick(); } else { //当前连接肢为Y肢 pDesPosPara->wing_y_offset.gStyle=4; pDesPosPara->wing_y_offset.offsetDist=-pDatumLineAngle->GetThick(); } } } else //外铁 pNewBolt->des_base_pos.norm_offset.EmptyThick(); pDatumBolt->AddL0Thick(pSelectLineAngle->handle,TRUE,TRUE); pDatumBolt->CalGuigeAuto(); pDatumBolt->correct_worknorm(); pDatumBolt->correct_pos(); pDatumBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pDatumBolt->GetSolidPartObject()); pLjPartPara->angle.bEndLjJg=TRUE; pSelectLineAngle->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pSelectLineAngle->GetSolidPartObject()); //存在端连接射线杆件时应调整基准杆件上的螺栓基点定位方式为角钢心线交点 for(pLsRef=pDatumLineAngle->GetFirstLsRef();pLsRef;pLsRef=pDatumLineAngle->GetNextLsRef()) { if(!pDatumPlate->FindLsByHandle((*pLsRef)->handle)) continue; (*pLsRef)->des_base_pos.datumPoint.datum_pos_style=3;//角钢心线交点 (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1=pDatumLineAngle->handle; (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2=pSelectLineAngle->handle; (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1 =pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1; (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 =pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1; (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2 =pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2; (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist2 =pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist2; (*pLsRef)->correct_worknorm(); (*pLsRef)->correct_pos(); (*pLsRef)->CalGuigeAuto(); (*pLsRef)->SetModified(); (*pLsRef)->Create3dSolidModel(); g_pSolidDraw->NewSolidPart((*pLsRef)->GetSolidPartObject()); } len_offset=(int)CalEndLjFirstBoltOffsetDist(pNewBolt,pSelectLineAngle,pDatumLineAngle); //根据默认的最小外孔间隙调整主材以及端连接射线角钢螺栓位置 int adjust_len_offset=0; if(pDatumPlate) { BOLTSET boltSet[2]; //boltSet[0]存放偏移值为正的螺栓 boltSet[1]存放偏移值为负的螺栓 CLDSBolt *pBolt=NULL; for(pLsRef=pDatumLineAngle->GetFirstLsRef();pLsRef;pLsRef=pDatumLineAngle->GetNextLsRef()) { if(!pDatumPlate->FindLsByHandle((*pLsRef)->handle)) continue; //不处理不在当前钢板上的螺栓 if((*pLsRef)->des_base_pos.datumPoint.datum_pos_style!=3) continue; //螺栓基点定位方式非角钢心线交点的螺栓不用调整位置 //将端连接射线角钢上定位方式为角钢心线交点的螺栓按螺栓纵向偏移量从小到大排序 if((*pLsRef)->des_base_pos.len_offset_dist>0) { for(pBolt=boltSet[0].GetFirst();pBolt;pBolt=boltSet[0].GetNext()) { if((*pLsRef)->des_base_pos.len_offset_dist<pBolt->des_base_pos.len_offset_dist) { boltSet[0].insert(pLsRef->GetLsPtr()); break; } } if(pBolt==NULL) boltSet[0].append(pLsRef->GetLsPtr()); } else if((*pLsRef)->des_base_pos.len_offset_dist<0) { for(pBolt=boltSet[1].GetFirst();pBolt;pBolt=boltSet[1].GetNext()) { if((*pLsRef)->des_base_pos.len_offset_dist>pBolt->des_base_pos.len_offset_dist) { boltSet[1].insert(pLsRef->GetLsPtr()); break; } } if(pBolt==NULL) boltSet[1].append(pLsRef->GetLsPtr()); } } int i=0,nFlag=1; for(i=0;i<2;i++) { if(i==1)//boltSet[0]存放偏移值为正的螺栓 boltSet[1]存放偏移值为负的螺栓 nFlag=-1; CLDSBolt *pFirstBolt=boltSet[i].GetFirst(); if(pFirstBolt==NULL) continue; adjust_len_offset=(int)CalEndLjFirstBoltOffsetDist(pFirstBolt,pDatumLineAngle,pSelectLineAngle); if(adjust_len_offset>abs((int)pFirstBolt->des_base_pos.len_offset_dist)) { int tmp_len_offset=abs((int)adjust_len_offset)-abs((int)pFirstBolt->des_base_pos.len_offset_dist); for(pBolt=boltSet[i].GetFirst();pBolt;pBolt=boltSet[i].GetNext()) { pBolt->des_base_pos.len_offset_dist+=tmp_len_offset*nFlag; pBolt->CalGuigeAuto(); pBolt->correct_worknorm(); pBolt->correct_pos(); pBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pBolt->GetSolidPartObject()); } } } } } } } } cmdStr.Format("请输入螺栓的横向偏移值<%d>:",0); pCmdLine->FillCmdLine(cmdStr,""); int nBoltSpace=0; while(1) { if(!pCmdLine->GetStrFromCmdLine(cmdStr)) { Ta.EndUndoListen(); return 0; } if(cmdStr.GetLength()>0) { sText.Printf("%s",cmdStr); //sprintf(sText,"%s",cmdStr); nBoltSpace = atoi(sText); } break; } pNewBolt->des_base_pos.wing_offset_dist+=nBoltSpace; if(len_offset!=0&&len_offset>LsSpace.SingleRowSpace) { cmdStr.Format("请输入螺栓的纵向偏移值<%d>:",len_offset); nBoltSpace=len_offset; } else { if(pDatumBolt->des_base_pos.len_offset_dist>0) { cmdStr.Format("请输入螺栓的纵向偏移值<%d>:",LsSpace.SingleRowSpace); nBoltSpace=LsSpace.SingleRowSpace; } else { cmdStr.Format("请输入螺栓的纵向偏移值<%d>:",-LsSpace.SingleRowSpace); nBoltSpace=-LsSpace.SingleRowSpace; } } pCmdLine->FillCmdLine(cmdStr,""); while(1) { if(!pCmdLine->GetStrFromCmdLine(cmdStr)) { Ta.EndUndoListen(); return 0; } if(cmdStr.GetLength()>0) { sText.Printf("%s",cmdStr); //sprintf(sText,"%s",cmdStr); nBoltSpace = atoi(sText); } break; } //端连接射线角钢上螺栓使用从基准点开始偏移最小偏移距离,其余螺栓从所选螺栓位置开始偏移 if(pSelectLineAngle&&pNewBolt->des_base_pos.datumPoint.datum_pos_style==3) pNewBolt->des_base_pos.len_offset_dist=nBoltSpace; else pNewBolt->des_base_pos.len_offset_dist+=nBoltSpace; if(pSelectLineAngle&&pNewBolt->des_base_pos.hPart==pDatumLineAngle->handle) { //更新螺栓定位方式 wht 10-09-18 pNewBolt->des_base_pos.hPart=pSelectLineAngle->handle; pNewBolt->des_base_pos.datumPoint.datum_pos_style=3; //角钢心线交点 pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1=pSelectLineAngle->handle; pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2=pDatumLineAngle->handle; pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1 =pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2; pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 =pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist2; pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2 =pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1; pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist2 =pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1; pNewBolt->des_base_pos.len_offset_dist=nBoltSpace; } pNewBolt->CalGuigeAuto(); pNewBolt->correct_worknorm(); pNewBolt->correct_pos(); pNewBolt->SetModified(); pNewBolt->Create3dSolidModel(); g_pSolidDraw->NewSolidPart(pNewBolt->GetSolidPartObject()); //将螺栓引入到基准角钢 if(pSelectLineAngle) { if(pDatumPlate) { //其他的螺栓也要修改定位方式 double nPrevLsSpace=pNewBolt->des_base_pos.len_offset_dist; LSSPACE_STRU LsSpace; for(pLsRef=pSelectLineAngle->GetFirstLsRef();pLsRef;pLsRef=pSelectLineAngle->GetNextLsRef()) { if(!pDatumPlate->FindLsByHandle((*pLsRef)->handle)) continue; if((*pLsRef)->handle == pDatumBolt->handle) continue; (*pLsRef)->des_base_pos.datumPoint.datum_pos_style=3;//角钢心线交点 (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum1=pSelectLineAngle->handle; (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.hDatum2=pDatumLineAngle->handle; (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1 =pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2; (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1 =pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist2; (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style2 =pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_style1; (*pLsRef)->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist2 =pNewBolt->des_base_pos.datumPoint.des_para.AXIS_INTERS.wing_offset_dist1; GetLsSpace(LsSpace,(*pLsRef)->get_d()); nPrevLsSpace+=LsSpace.SingleRowSpace; (*pLsRef)->des_base_pos.len_offset_dist=nPrevLsSpace; (*pLsRef)->correct_worknorm(); (*pLsRef)->correct_pos(); (*pLsRef)->CalGuigeAuto(); (*pLsRef)->SetModified(); (*pLsRef)->Create3dSolidModel(); g_pSolidDraw->NewSolidPart((*pLsRef)->GetSolidPartObject()); } //角钢心线交点定位 if(pNewBolt->des_base_pos.direction==0) pSelectLineAngle->AppendStartLsRef(pNewBolt->GetLsRef()); else if(pNewBolt->des_base_pos.direction==1) pSelectLineAngle->AppendEndLsRef(pNewBolt->GetLsRef()); else pSelectLineAngle->AppendMidLsRef(pNewBolt->GetLsRef()); } else pSelectLineAngle->AppendMidLsRef(pNewBolt->GetLsRef()); } else if(pDatumLineAngle) { if(pDatumBolt->des_base_pos.datumPoint.datum_pos_style==1) { //角钢楞点定位 if(pNewBolt->des_base_pos.direction==0) pDatumLineAngle->AppendStartLsRef(pNewBolt->GetLsRef()); else if(pNewBolt->des_base_pos.direction==1) pDatumLineAngle->AppendEndLsRef(pNewBolt->GetLsRef()); } else //杆件上的节点定位或角钢心线交点定位 pDatumLineAngle->AppendMidLsRef(pNewBolt->GetLsRef()); } //将螺栓引入到基准螺栓所在钢板并重新设计钢板外形 if(pDatumPlate) { pDatumPlate->AppendLsRef(pNewBolt->GetLsRef()); pDatumPlate->DesignPlate(); pDatumPlate->SetModified(); pDatumPlate->Create3dSolidModel(g_sysPara.bDisplayAllHole,g_pSolidOper->GetScaleUserToScreen(),g_pSolidSet->GetArcSamplingLength(),g_sysPara.display.nSmoothness); g_pSolidDraw->NewSolidPart(pDatumPlate->GetSolidPartObject()); } g_pSolidDraw->Draw(); Ta.EndUndoListen(); pCmdLine->FinishCmdLine(); pCmdLine->FillCmdLine("命令",""); DefOffsetLs(); return 0; } */ //--------------VVV---OldCommand----VVV----------------- void CLDSView::OnSingleXieNodeDesign() { Command("1BoltEndAngle"); } //设计所选中的交叉点螺栓 void CLDSView::OnXieIntersPtDesign() { int i,N; long n, *id_arr=NULL; CLDSNode *pNode; NODESET nodeset; CString cmdStr=""; CCmdLineDlg *pCmdLine = ((CMainFrame*)AfxGetMainWnd())->GetCmdLinePage(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Please select cross node of designed bolts:",""); #else pCmdLine->FillCmdLine("选择要设计螺栓的交叉节点:",""); #endif g_pSolidSnap->SetSnapType(SNAP_POINT); if(pCmdLine->GetStrFromCmdLine(cmdStr)) { n=g_pSolidSnap->GetLastSelectEnts(id_arr); for(i=0;i<n;i++) { pNode=console.FromNodeHandle(id_arr[i]); if(pNode) nodeset.append(pNode); } } else { pCmdLine->CancelCmdLine(); return; } //防止用户误操作 #ifdef AFX_TARG_ENU_ENGLISH if(n>0&&MessageBox( "Are you sure to design selected cross bolts?",NULL,MB_YESNO)!=IDYES) #else if(n>0&&MessageBox( "真的要设计所选中的交叉点螺栓吗?",NULL,MB_YESNO)!=IDYES) #endif return; CProcBarDlg *pProcDlg = new CProcBarDlg(this); pProcDlg->Create(); //创建进度条 #ifdef AFX_TARG_ENU_ENGLISH pProcDlg->SetWindowText("Design process"); #else pProcDlg->SetWindowText("设计进度"); #endif BeginWaitCursor(); N=nodeset.GetNodeNum(); for(pNode=nodeset.GetFirst(),i=0;pNode;pNode=nodeset.GetNext(),i++) { g_pSolidDraw->SetEntSnapStatus(pNode->handle); DesignIntersNode(pNode,FALSE,FALSE); g_pSolidDraw->SetEntSnapStatus(pNode->handle,FALSE); pProcDlg->Refresh((i*100+1)/N); //更新进度条 } pProcDlg->DestroyWindow(); //销毁进度条 EndWaitCursor(); #ifdef AFX_TARG_ENU_ENGLISH MessageBox("The design of cross bolts is completed!"); #else MessageBox("选中的交叉点螺栓设计完毕!"); #endif m_pDoc->SetModifiedFlag(); // 修改数据后应调用此函数置修改标志. } //设计单螺栓连接 int CLDSView::DesignOneBoltEndAngle() { CLDSNode *pNode; CLDSLineAngle *pAngle; CCmdLineDlg *pCmdLine = ((CMainFrame*)AfxGetMainWnd())->GetCmdLinePage(); try { #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("1BoltEndAngle Please select single-bolt-connection's angle:",""); #else pCmdLine->FillCmdLine("1BoltEndAngle 选择当前要设计单螺栓端连接的角钢:",""); #endif //切换到单线显示状态 g_pSolidSet->SetDisplayType(DISP_LINE); Invalidate(FALSE); while(1) { f3dLine line; int ret = g_pSolidSnap->SnapLine(line); if(ret<0) { pCmdLine->CancelCmdLine(); return 0; } else if(ret>0) { pAngle=(CLDSLineAngle*)console.FromPartHandle(line.ID,CLS_LINEANGLE); if(pAngle) { g_pSolidDraw->SetEntSnapStatus(line.ID); break; } } } pCmdLine->FinishCmdLine(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Please select end nodes of angle:",""); #else pCmdLine->FillCmdLine("请选择角钢当前设计端的端节点:",""); #endif while(1) { f3dPoint* point; int ret = g_pSolidSnap->SnapPoint(point); if(ret<0) { pCmdLine->CancelCmdLine(); return 0; } else if(ret>0) { pNode=console.FromNodeHandle(point->ID); if(pNode) { g_pSolidDraw->SetEntSnapStatus(point->ID); break; } } } pCmdLine->FinishCmdLine(); PARTSET partset; //基准角钢与基准节点的父角钢可确定一个平面 CLDSLineAngle *pFatherAngle=NULL; if(pNode==pAngle->pStart&&pAngle->desStartPos.datum_jg_h>0x20) pFatherAngle=(CLDSLineAngle*)console.FromPartHandle(pAngle->desStartPos.datum_jg_h,CLS_LINEANGLE); else if(pNode==pAngle->pEnd&&pAngle->desEndPos.datum_jg_h>0x20) pFatherAngle=(CLDSLineAngle*)console.FromPartHandle(pAngle->desEndPos.datum_jg_h,CLS_LINEANGLE); else pFatherAngle=(CLDSLineAngle*)console.FromPartHandle(pNode->hFatherPart,CLS_LINEANGLE); if(pAngle->handle!=pNode->hFatherPart&&pFatherAngle&& pAngle->pStart&&pAngle->pEnd&&pFatherAngle->pStart&&pFatherAngle->pEnd) { //基准节点的父角钢非基准角钢时,才可以执行下面的代码 //wht 09-08-07 f3dPoint father_line_vec,temp_vec,work_norm; father_line_vec=pFatherAngle->pEnd->Position(true)-pFatherAngle->pStart->Position(true); normalize(father_line_vec); temp_vec=pAngle->pEnd->Position(true)-pAngle->pStart->Position(true); normalize(temp_vec); work_norm=temp_vec^father_line_vec; normalize(work_norm); for(CLDSLineAngle *pLineAngle=(CLDSLineAngle*)Ta.Parts.GetFirst(CLS_LINEANGLE); pLineAngle;pLineAngle=(CLDSLineAngle*)Ta.Parts.GetNext(CLS_LINEANGLE)) { if(pLineAngle==pAngle) continue; //跳过基准角钢 if(pLineAngle->pStart!=pNode&&pLineAngle->pEnd!=pNode) continue; if(pLineAngle->pStart==NULL||pLineAngle->pEnd==NULL) continue; temp_vec=pLineAngle->pEnd->Position(true)-pLineAngle->pStart->Position(true); normalize(temp_vec); f3dPoint norm=temp_vec^father_line_vec; normalize(norm); if(fabs(work_norm*norm)>EPS_COS) partset.append(pLineAngle); } } CLDSLineAngle *pSecLineAngle=NULL; #ifdef AFX_TARG_ENU_ENGLISH if(partset.GetNodeNum()==1&&AfxMessageBox("Whether to design no plate's single-bolt-connection?",MB_YESNO)==IDYES) #else if(partset.GetNodeNum()==1&&AfxMessageBox("是否进行无板单螺栓连接?",MB_YESNO)==IDYES) #endif pSecLineAngle=(CLDSLineAngle*)partset.GetFirst(); if(ValidateOneBoltConnect(pNode,pAngle,pSecLineAngle)) DesignBoltOnlyConnect(pNode,pAngle,pSecLineAngle,TRUE,TRUE); } catch(char *sError) { AfxMessageBox(sError); g_pSolidDraw->ReleaseSnapStatus(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Command:",""); #else pCmdLine->FillCmdLine("命令:",""); #endif return 0; } g_pSolidDraw->ReleaseSnapStatus(); g_pSolidDraw->Draw(); #ifdef AFX_TARG_ENU_ENGLISH pCmdLine->FillCmdLine("Command:",""); #else pCmdLine->FillCmdLine("命令:",""); #endif Command("1BoltEndAngle"); return 0; } //设计所有的塔材端点单螺栓连接 void CLDSView::OnAllSingleXieNodeDesign() { CLDSNode *pNode; CLDSLineAngle *pAngle1=NULL,*pAngle2=NULL; long *id_arr=NULL; long n=g_pSolidSnap->GetLastSelectEnts(id_arr); #ifdef AFX_TARG_ENU_ENGLISH if(MessageBox("Are you sure to design selected single-bolt-connection?",NULL,MB_YESNO)!=IDYES) #else if(MessageBox("你真的要设计所选中角钢的单螺栓端连接吗?",NULL,MB_YESNO)!=IDYES) #endif return; CProcBarDlg *pProcDlg = new CProcBarDlg(this); pProcDlg->Create(); #ifdef AFX_TARG_ENU_ENGLISH pProcDlg->SetWindowText("Design process"); #else pProcDlg->SetWindowText("设计进度"); #endif BOOL bIgnoreError=FALSE; for(int i=0;i<n;i++) { pNode=console.FromNodeHandle(id_arr[i]); pProcDlg->Refresh((i*100)/n); if(pNode==NULL) continue; try{ PARTSET jgset; //连接在基准节点上的角钢集合 PARTSET partset[2]; //partset[0]搭接在X肢上的角钢集合,partset[1]搭接在Y肢上的角钢集合 Ta.Node.push_stack(); for(CLDSPart *pPart=Ta.Parts.GetFirst(CLS_LINEANGLE);pPart;pPart=Ta.Parts.GetNext(CLS_LINEANGLE)) { CLDSLinePart *pLinePart=(CLDSLinePart*)pPart; if(pLinePart->pStart==pNode||pLinePart->pEnd==pNode) jgset.append(pLinePart); } Ta.Node.pop_stack(); //将连接在基准节点上的角钢按搭接肢分类 CLDSLineAngle *pLineAngle=NULL,*pFatherLineAngle=NULL; pFatherLineAngle=(CLDSLineAngle*)console.FromPartHandle(pNode->hFatherPart,CLS_LINEANGLE); if(pFatherLineAngle) { f3dPoint norm_x,norm_y,father_line_vec; norm_x=pFatherLineAngle->get_norm_x_wing(); norm_y=pFatherLineAngle->get_norm_y_wing(); father_line_vec=pFatherLineAngle->End()-pFatherLineAngle->Start(); normalize(father_line_vec); for(pLineAngle=(CLDSLineAngle*)jgset.GetFirst();pLineAngle;pLineAngle=(CLDSLineAngle*)jgset.GetNext()) { if(pLineAngle==pFatherLineAngle) continue; f3dPoint line_vec=pLineAngle->End()-pLineAngle->Start(); normalize(line_vec); f3dPoint norm=line_vec^father_line_vec; normalize(norm); //cos(30°)=0.866 double a=norm*norm_x; double b=norm*norm_y; double c=norm_x*norm_y; if(fabs(norm*norm_x)>0.866) //搭接在X肢上的射线角钢 partset[0].append(pLineAngle); else if(fabs(norm*norm_y)>0.866) //搭接在Y肢上的射线角钢 partset[1].append(pLineAngle); } } int i=0; for(i=0;i<2;i++) { if(partset[i].GetNodeNum()==1) { pAngle1 = (CLDSLineAngle*)partset[i][0]; Ta.Node.push_stack(); if(pAngle1->pStart->handle==pNode->handle) { //始端螺栓设计个数为1,且未布置螺栓 if(pAngle1->connectStart.wnConnBoltN!=1&&!bIgnoreError) { #ifdef AFX_TARG_ENU_ENGLISH if(AfxMessageBox("Whether to ignore the error that all ray angle's number isnt't 1?",MB_YESNO)==IDYES) #else if(AfxMessageBox("是否忽略所有射线角钢端螺栓数不为1的错误?",MB_YESNO)==IDYES) #endif bIgnoreError=TRUE; } if((bIgnoreError||!bIgnoreError&&pAngle1->connectStart.wnConnBoltN==1)&&pAngle1->GetLocalLsCount(1,100)==0) DesignBoltOnlyConnect(pNode,pAngle1,NULL,FALSE,FALSE); } else if(pAngle1->pEnd->handle==pNode->handle) { //终端螺栓设计个数为1,且未布置螺栓 if(pAngle1->connectEnd.wnConnBoltN!=1&&!bIgnoreError) { #ifdef AFX_TARG_ENU_ENGLISH if(AfxMessageBox("Whether to ignore the error that all ray angle's number isnt't 1?",MB_YESNO)==IDYES) #else if(AfxMessageBox("是否忽略所有射线角钢端螺栓数不为1的错误?",MB_YESNO)==IDYES) #endif bIgnoreError=TRUE; } if((bIgnoreError||!bIgnoreError&&pAngle1->connectEnd.wnConnBoltN==1)&&pAngle1->GetLocalLsCount(2,100)==0) DesignBoltOnlyConnect(pNode,pAngle1,NULL,FALSE,FALSE); } Ta.Node.pop_stack(); } else if(partset[i].GetNodeNum()==2) { pAngle1 = (CLDSLineAngle*)partset[i][0]; pAngle2 = (CLDSLineAngle*)partset[i][1]; Ta.Node.push_stack(); //保证两根连接材在同一平面上 if(pAngle1->layer(2)!=pAngle2->layer(2)) continue; if(pAngle1->pStart->handle==pNode->handle) { //始端螺栓设计个数为1,且未布置螺栓 if(pAngle1->connectStart.wnConnBoltN!=1&&!bIgnoreError) { #ifdef AFX_TARG_ENU_ENGLISH if(AfxMessageBox("Whether to ignore the error that all ray angle's number isnt't 1?",MB_YESNO)==IDYES) #else if(AfxMessageBox("是否忽略所有射线角钢端螺栓数不为1的错误?",MB_YESNO)==IDYES) #endif bIgnoreError=TRUE; } if((bIgnoreError||!bIgnoreError&&pAngle1->connectStart.wnConnBoltN==1)&&pAngle1->GetLocalLsCount(1,100)==0) DesignBoltOnlyConnect(pNode,pAngle1,pAngle2,FALSE,FALSE); } else if(pAngle1->pEnd->handle==pNode->handle) { //终端螺栓设计个数为1,且未布置螺栓 if(pAngle1->connectEnd.wnConnBoltN!=1&&!bIgnoreError) { #ifdef AFX_TARG_ENU_ENGLISH if(AfxMessageBox("Whether to ignore the error that all ray angle's number isnt't 1?",MB_YESNO)==IDYES) #else if(AfxMessageBox("是否忽略所有射线角钢端螺栓数不为1的错误?",MB_YESNO)==IDYES) #endif bIgnoreError=TRUE; } if((bIgnoreError||!bIgnoreError&&pAngle1->connectEnd.wnConnBoltN==1)&&pAngle1->GetLocalLsCount(2,100)==0) DesignBoltOnlyConnect(pNode,pAngle1,pAngle2,FALSE,FALSE); } /* if(pAngle2->pStart->handle==pNode->handle) { //始端螺栓设计个数为1,且未布置螺栓 if(pAngle2->connectStart.wnConnBoltN==1&&pAngle2->GetLocalLsCount(1)==0) DesignBoltOnlyConnect(pNode,pAngle2,FALSE,FALSE); } else if(pAngle2->pEnd->handle==pNode->handle) { //终端螺栓设计个数为1,且未布置螺栓 if(pAngle2->connectEnd.wnConnBoltN==1&&pAngle2->GetLocalLsCount(2)==0) DesignBoltOnlyConnect(pNode,pAngle2,FALSE,FALSE); }*/ Ta.Node.pop_stack(); } } } catch(char *sError) { AfxMessageBox(sError); g_pSolidDraw->SetEntSnapStatus(pNode->handle,FALSE); } } pProcDlg->DestroyWindow(); delete pProcDlg; } /* 胡笑蓉还未完成,暂时不启用 wjh-2015.4.12 void CLDSView::OnMirCreateWBConnect() { //m_nPrevCommandID=ID_MIR_CREATE_WB_CONNECT; //m_sPrevCommandName="重复对称生成无板连接"; //Command("MirCreateWBConnect"); g_pSolidSet->SetOperType(OPER_OSNAP); g_pSolidSnap->SetSnapType(SNAP_POINT); m_nObjectSnapedCounts=0; m_setSnapObjects.Empty(); CString cmdStr=""; char sText[MAX_TEMP_CHAR_100+1]; CCmdLineDlg *pCmdLine = ((CMainFrame*)AfxGetMainWnd())->GetCmdLinePage(); //-----vvvvvvv-标识函数运行状态为真,即同一时刻只能有一个塔创建函数运行--------- if(!LockFunc()) return; CUndoOperObject undo(&Ta,true); try{ //1.切换到单线图状态便于选择节点 g_pSolidSet->SetDisplayType(DISP_LINE); g_pSolidDraw->Draw(); g_pSolidDraw->ReleaseSnapStatus(); pCmdLine->FillCmdLine("请选择要对称的无板连接的定位基准节点:",""); CLDSNode *pBaseNode=NULL; while(1) { f3dPoint* point; int ret = g_pSolidSnap->SnapPoint(point); if(ret<0) { pCmdLine->CancelCmdLine(); return;// 0; } else if(ret>0) { pBaseNode=console.FromNodeHandle(point->ID); if(pBaseNode) { g_pSolidDraw->SetEntSnapStatus(point->ID); break; } } } Invalidate(FALSE); pCmdLine->FinishCmdLine(); //虚拟板 CLDSPlate * pVirtualPlate; pVirtualPlate = (CLDSPlate*)console.AppendPart(CLS_PLATE); pVirtualPlate->cfgword=pBaseNode->cfgword; //调整钢板配材号与基准构件或基准节点配材号一致 pVirtualPlate->designInfo.m_hBaseNode = pBaseNode->handle; //基准杆件 CSuperSmartPtr<CLDSLinePart> pBasePart; if(pBaseNode->m_cPosCalType!=4) { //非交叉节点 pBasePart=(CLDSLinePart*)console.FromPartHandle(pBaseNode->hFatherPart,CLS_LINEPART); if(pBasePart.IsHasPtr()) pVirtualPlate->designInfo.m_hBasePart = pBasePart->handle; else throw "未找到合法的节点父杆件!"; } if(pBasePart) pVirtualPlate->designInfo.m_hBasePart = pBasePart->handle; //无板连接均为单面板 pVirtualPlate->face_N = 1; //designJdb.SetViewFlag(m_eViewFlag); if(pBaseNode->m_cPosCalType!=4) { //普通连接板 pVirtualPlate->jdb_style = 0; //if(!designJdb.DesignCommonPlank(pCurPlate)) //throw "设计失败"; } else //if(iPlateFaceType==4)//设计的是交叉板(需要特殊处理) { pVirtualPlate->jdb_style = 1; //if(!designJdb.DesignCrossPlate(pCurPlate)) //throw "设计失败"; } //2.框选连接角钢 CSuperSmartPtr<CLDSPart>pPart; CLDSLinePart* pSelLinePart; LINEPARTSET partset; CHashTable<CLDSLinePart*>partsetTable; partsetTable.CreateHashTable(100); g_pSolidSet->SetDisplayType(DISP_SOLID); pCmdLine->FillCmdLine("请选择该节点板基本面所连接的所有杆件:",""); g_pSolidSnap->SetSelectPartsType(GetSingleWord(SELECTINDEX_LINEANGLE)|GetSingleWord(SELECTINDEX_LINETUBE)|GetSingleWord(SELECTINDEX_LINEFLAT)); ((CMainFrame*)AfxGetMainWnd())->GetLDSView()->OpenWndSel(); if(pCmdLine->GetStrFromCmdLine(cmdStr)) { //根据句柄字符串添加构件 long *id_arr1=NULL,arr1_len=0;; if(cmdStr.GetLength()>0) { id_arr1=new long[cmdStr.GetLength()]; _snprintf(sText,MAX_TEMP_CHAR_100,"%s",cmdStr); for(char* key=strtok(sText,",");key;key=strtok(NULL,",")) { long h; sscanf(key,"%X",&h); pPart=console.FromPartHandle(h); id_arr1[arr1_len]=h; arr1_len++; } } long *id_arr; int n = g_pSolidSnap->GetLastSelectEnts(id_arr); for(int i=0;i<arr1_len+n;i++) { if(i<arr1_len) pPart=console.FromPartHandle(id_arr1[i]); else pPart=console.FromPartHandle(id_arr[i-arr1_len]); if(pPart.IsHasPtr()&&pPart->IsLinePart()&& pPart.LinePartPointer()->pStart!=NULL&&pPart.LinePartPointer()->pEnd!=NULL) { long hGroupFatherAngle=0; if(pPart.LinePartPointer()->IsAngle()) hGroupFatherAngle=pPart.LineAnglePointer()->group_father_jg_h; if(!partsetTable.GetValueAt(pPart->handle,pSelLinePart)&&(hGroupFatherAngle==0||!partsetTable.GetValueAt(hGroupFatherAngle,pSelLinePart))) { partsetTable.SetValueAt(pPart->handle,pPart.LinePartPointer()); partset.append(pPart.LinePartPointer()); } } } if(id_arr1) delete []id_arr1; g_pSolidDraw->ReleaseSnapStatus(); } else { pCmdLine->CancelCmdLine(); return; } if(partset.GetNodeNum()<2) { g_pSolidDraw->SetEntSnapStatus(pBaseNode->handle, FALSE); throw "至少应有两根杆件才算是连接设计"; } CDesignLjPartPara desLjPartPara; for(pPart=partset.GetFirst();pPart;pPart=partset.GetNext()) { desLjPartPara.hPart=pPart->handle; desLjPartPara.iFaceNo = 1; desLjPartPara.m_nClassTypeId = pPart->GetClassTypeId(); if(pPart.LinePartPointer()->pStart->handle==pVirtualPlate->designInfo.m_hBaseNode) desLjPartPara.start0_end1=0; else if(pPart.LinePartPointer()->pEnd->handle==pVirtualPlate->designInfo.m_hBaseNode) desLjPartPara.start0_end1=1; else desLjPartPara.start0_end1=2; if(pPart->GetClassTypeId()==CLS_LINEANGLE||pPart->GetClassTypeId()==CLS_GROUPLINEANGLE) { CLDSLineAngle* pLineAngle=pPart.LineAnglePointer(); double justify_x=pLineAngle->get_norm_x_wing()*pVirtualPlate->ucs.axis_z; double justify_y=pLineAngle->get_norm_y_wing()*pVirtualPlate->ucs.axis_z; if(fabs(justify_x)>fabs(justify_y))//&&justify_x>EPS_COS2) desLjPartPara.angle.cur_wing_x0_y1=0;//将来应考虑引入杆件在制弯面情况 wjh-2015.1.05 else //if(fabs(justify_x)<fabs(justify_y))//&&justify_y>EPS_COS2) desLjPartPara.angle.cur_wing_x0_y1=1; double max_d=0; for(CLsRef* pLsRef=pVirtualPlate->GetFirstLsRef();pLsRef;pLsRef=pVirtualPlate->GetNextLsRef()) { CLDSBolt* pBolt=pLsRef->GetLsPtr(); if(pLineAngle->FindLsByHandle(pBolt->handle)&&pBolt->get_d()>max_d) max_d=pBolt->get_d(); } LSSPACE_STRU LsSpace; if(!GetLsSpace(LsSpace,ftoi(max_d))) { //防止未引入螺栓先加入射线杆件的情况 if(pLineAngle->GetWidth()<63) LsSpace.EndSpace=25; else if(pLineAngle->GetWidth()<=110) LsSpace.EndSpace=30; else LsSpace.EndSpace=40; } desLjPartPara.ber_space=desLjPartPara.wing_space=desLjPartPara.end_space=LsSpace.EndSpace; desLjPartPara.angle.cbSpaceFlag.SetEndSpaceStyle(ANGLE_SPACE_FLAG::SPACE_BOLTEND); } pVirtualPlate->designInfo.partList.append(desLjPartPara); } pVirtualPlate->DesignPlate(); CMirMsgDlg dlg; if(dlg.DoModal()==IDOK) MirTaAtom(pVirtualPlate,dlg.mirmsg); if(pVirtualPlate->GetThick()<=0) { console.DispPartSet.DeleteNode(pVirtualPlate->handle); console.DeletePart(pVirtualPlate->handle); } pCmdLine->FillCmdLine("命令:",""); } catch(char *sError) { AfxMessageBox(sError); } g_pSolidDraw->ReleaseSnapStatus(); ReleaseFunc(); } */ #endif
[ "wxc_sxy@163.com" ]
wxc_sxy@163.com
e1ec9a89256b5758cb73ca323f68c79efb626b53
c90a56e7d7752b041fc5eb38257c5573cef346c6
/src-win/FSD.cpp
2f38cad6fbd10964e54fb1fd96387edd5711ebd8
[]
no_license
random-builder/design_cadquery_ocp
a4c572a72699bad52ca5f43f30bb7c15d89072ff
2af799a9f1b2d81fd39e519b2f73e12b34a14c0a
refs/heads/master
2021-05-21T23:10:23.833461
2020-03-29T15:34:46
2020-03-29T15:34:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
53,455
cpp
// std lib related includes #include <tuple> // pybind 11 related includes #include <pybind11/pybind11.h> #include <pybind11/stl.h> namespace py = pybind11; // Windows specific #define WIN32_LEAN_AND_MEAN #include <windows.h> // Standard Handle #include <Standard_Handle.hxx> // includes to resolve forward declarations #include <Storage_StreamFormatError.hxx> #include <Storage_StreamWriteError.hxx> #include <Storage_HeaderData.hxx> #include <Storage_StreamFormatError.hxx> #include <Storage_StreamWriteError.hxx> // module includes #include <FSD_Base64Decoder.hxx> #include <FSD_BinaryFile.hxx> #include <FSD_BStream.hxx> #include <FSD_CmpFile.hxx> #include <FSD_File.hxx> #include <FSD_FileHeader.hxx> #include <FSD_FStream.hxx> // template related includes // user-defined pre #include "OCP_specific.inc" // user-defined inclusion per module // Module definiiton void register_FSD(py::module &main_module) { py::module m = static_cast<py::module>(main_module.attr("FSD")); //Python trampoline classes // classes // default constructor register_default_constructor<FSD_Base64Decoder , shared_ptr<FSD_Base64Decoder>>(m,"FSD_Base64Decoder"); static_cast<py::class_<FSD_Base64Decoder , shared_ptr<FSD_Base64Decoder> >>(m.attr("FSD_Base64Decoder")) // constructors // custom constructors // methods // methods using call by reference i.s.o. return // static methods .def_static("Decode_s", (opencascade::handle<NCollection_Buffer> (*)( const Standard_Byte * , const Standard_Size ) ) static_cast<opencascade::handle<NCollection_Buffer> (*)( const Standard_Byte * , const Standard_Size ) >(&FSD_Base64Decoder::Decode), R"#(Function decoding base64 stream.)#" , py::arg("theStr"), py::arg("theLen")) // static methods using call by reference i.s.o. return // operators // additional methods and static methods ; static_cast<py::class_<FSD_BinaryFile , shared_ptr<FSD_BinaryFile> , Storage_BaseDriver>>(m.attr("FSD_BinaryFile")) // constructors .def(py::init< >() ) // custom constructors // methods .def("Open", (Storage_Error (FSD_BinaryFile::*)( const TCollection_AsciiString & , const Storage_OpenMode ) ) static_cast<Storage_Error (FSD_BinaryFile::*)( const TCollection_AsciiString & , const Storage_OpenMode ) >(&FSD_BinaryFile::Open), R"#(None)#" , py::arg("aName"), py::arg("aMode")) .def("IsEnd", (Standard_Boolean (FSD_BinaryFile::*)() ) static_cast<Standard_Boolean (FSD_BinaryFile::*)() >(&FSD_BinaryFile::IsEnd), R"#(None)#" ) .def("Tell", (Storage_Position (FSD_BinaryFile::*)() ) static_cast<Storage_Position (FSD_BinaryFile::*)() >(&FSD_BinaryFile::Tell), R"#(return position in the file. Return -1 upon error.)#" ) .def("BeginWriteInfoSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginWriteInfoSection), R"#(None)#" ) .def("WriteInfo", (void (FSD_BinaryFile::*)( const Standard_Integer , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_ExtendedString & , const TCollection_AsciiString & , const TCollection_ExtendedString & , const NCollection_Sequence<TCollection_AsciiString> & ) ) static_cast<void (FSD_BinaryFile::*)( const Standard_Integer , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_ExtendedString & , const TCollection_AsciiString & , const TCollection_ExtendedString & , const NCollection_Sequence<TCollection_AsciiString> & ) >(&FSD_BinaryFile::WriteInfo), R"#(None)#" , py::arg("nbObj"), py::arg("dbVersion"), py::arg("date"), py::arg("schemaName"), py::arg("schemaVersion"), py::arg("appName"), py::arg("appVersion"), py::arg("objectType"), py::arg("userInfo")) .def("EndWriteInfoSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndWriteInfoSection), R"#(None)#" ) .def("EndWriteInfoSection", (Storage_Error (FSD_BinaryFile::*)( std::ostream & ) ) static_cast<Storage_Error (FSD_BinaryFile::*)( std::ostream & ) >(&FSD_BinaryFile::EndWriteInfoSection), R"#(None)#" , py::arg("theOStream")) .def("BeginReadInfoSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginReadInfoSection), R"#(None)#" ) .def("ReadCompleteInfo", (void (FSD_BinaryFile::*)( std::istream & , opencascade::handle<Storage_Data> & ) ) static_cast<void (FSD_BinaryFile::*)( std::istream & , opencascade::handle<Storage_Data> & ) >(&FSD_BinaryFile::ReadCompleteInfo), R"#(None)#" , py::arg("theIStream"), py::arg("theData")) .def("EndReadInfoSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndReadInfoSection), R"#(None)#" ) .def("BeginWriteCommentSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginWriteCommentSection), R"#(None)#" ) .def("BeginWriteCommentSection", (Storage_Error (FSD_BinaryFile::*)( std::ostream & ) ) static_cast<Storage_Error (FSD_BinaryFile::*)( std::ostream & ) >(&FSD_BinaryFile::BeginWriteCommentSection), R"#(None)#" , py::arg("theOStream")) .def("WriteComment", (void (FSD_BinaryFile::*)( const NCollection_Sequence<TCollection_ExtendedString> & ) ) static_cast<void (FSD_BinaryFile::*)( const NCollection_Sequence<TCollection_ExtendedString> & ) >(&FSD_BinaryFile::WriteComment), R"#(None)#" , py::arg("userComments")) .def("EndWriteCommentSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndWriteCommentSection), R"#(None)#" ) .def("EndWriteCommentSection", (Storage_Error (FSD_BinaryFile::*)( std::ostream & ) ) static_cast<Storage_Error (FSD_BinaryFile::*)( std::ostream & ) >(&FSD_BinaryFile::EndWriteCommentSection), R"#(None)#" , py::arg("theOStream")) .def("BeginReadCommentSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginReadCommentSection), R"#(None)#" ) .def("ReadComment", (void (FSD_BinaryFile::*)( NCollection_Sequence<TCollection_ExtendedString> & ) ) static_cast<void (FSD_BinaryFile::*)( NCollection_Sequence<TCollection_ExtendedString> & ) >(&FSD_BinaryFile::ReadComment), R"#(None)#" , py::arg("userComments")) .def("EndReadCommentSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndReadCommentSection), R"#(None)#" ) .def("BeginWriteTypeSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginWriteTypeSection), R"#(None)#" ) .def("SetTypeSectionSize", (void (FSD_BinaryFile::*)( const Standard_Integer ) ) static_cast<void (FSD_BinaryFile::*)( const Standard_Integer ) >(&FSD_BinaryFile::SetTypeSectionSize), R"#(None)#" , py::arg("aSize")) .def("WriteTypeInformations", (void (FSD_BinaryFile::*)( const Standard_Integer , const TCollection_AsciiString & ) ) static_cast<void (FSD_BinaryFile::*)( const Standard_Integer , const TCollection_AsciiString & ) >(&FSD_BinaryFile::WriteTypeInformations), R"#(None)#" , py::arg("typeNum"), py::arg("typeName")) .def("EndWriteTypeSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndWriteTypeSection), R"#(None)#" ) .def("BeginReadTypeSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginReadTypeSection), R"#(None)#" ) .def("TypeSectionSize", (Standard_Integer (FSD_BinaryFile::*)() ) static_cast<Standard_Integer (FSD_BinaryFile::*)() >(&FSD_BinaryFile::TypeSectionSize), R"#(None)#" ) .def("EndReadTypeSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndReadTypeSection), R"#(None)#" ) .def("BeginWriteRootSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginWriteRootSection), R"#(None)#" ) .def("SetRootSectionSize", (void (FSD_BinaryFile::*)( const Standard_Integer ) ) static_cast<void (FSD_BinaryFile::*)( const Standard_Integer ) >(&FSD_BinaryFile::SetRootSectionSize), R"#(None)#" , py::arg("aSize")) .def("WriteRoot", (void (FSD_BinaryFile::*)( const TCollection_AsciiString & , const Standard_Integer , const TCollection_AsciiString & ) ) static_cast<void (FSD_BinaryFile::*)( const TCollection_AsciiString & , const Standard_Integer , const TCollection_AsciiString & ) >(&FSD_BinaryFile::WriteRoot), R"#(None)#" , py::arg("rootName"), py::arg("aRef"), py::arg("aType")) .def("EndWriteRootSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndWriteRootSection), R"#(None)#" ) .def("BeginReadRootSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginReadRootSection), R"#(None)#" ) .def("RootSectionSize", (Standard_Integer (FSD_BinaryFile::*)() ) static_cast<Standard_Integer (FSD_BinaryFile::*)() >(&FSD_BinaryFile::RootSectionSize), R"#(None)#" ) .def("EndReadRootSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndReadRootSection), R"#(None)#" ) .def("BeginWriteRefSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginWriteRefSection), R"#(None)#" ) .def("SetRefSectionSize", (void (FSD_BinaryFile::*)( const Standard_Integer ) ) static_cast<void (FSD_BinaryFile::*)( const Standard_Integer ) >(&FSD_BinaryFile::SetRefSectionSize), R"#(None)#" , py::arg("aSize")) .def("WriteReferenceType", (void (FSD_BinaryFile::*)( const Standard_Integer , const Standard_Integer ) ) static_cast<void (FSD_BinaryFile::*)( const Standard_Integer , const Standard_Integer ) >(&FSD_BinaryFile::WriteReferenceType), R"#(None)#" , py::arg("reference"), py::arg("typeNum")) .def("EndWriteRefSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndWriteRefSection), R"#(None)#" ) .def("BeginReadRefSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginReadRefSection), R"#(None)#" ) .def("RefSectionSize", (Standard_Integer (FSD_BinaryFile::*)() ) static_cast<Standard_Integer (FSD_BinaryFile::*)() >(&FSD_BinaryFile::RefSectionSize), R"#(None)#" ) .def("EndReadRefSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndReadRefSection), R"#(None)#" ) .def("BeginWriteDataSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginWriteDataSection), R"#(None)#" ) .def("WritePersistentObjectHeader", (void (FSD_BinaryFile::*)( const Standard_Integer , const Standard_Integer ) ) static_cast<void (FSD_BinaryFile::*)( const Standard_Integer , const Standard_Integer ) >(&FSD_BinaryFile::WritePersistentObjectHeader), R"#(None)#" , py::arg("aRef"), py::arg("aType")) .def("BeginWritePersistentObjectData", (void (FSD_BinaryFile::*)() ) static_cast<void (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginWritePersistentObjectData), R"#(None)#" ) .def("BeginWriteObjectData", (void (FSD_BinaryFile::*)() ) static_cast<void (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginWriteObjectData), R"#(None)#" ) .def("EndWriteObjectData", (void (FSD_BinaryFile::*)() ) static_cast<void (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndWriteObjectData), R"#(None)#" ) .def("EndWritePersistentObjectData", (void (FSD_BinaryFile::*)() ) static_cast<void (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndWritePersistentObjectData), R"#(None)#" ) .def("EndWriteDataSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndWriteDataSection), R"#(None)#" ) .def("BeginReadDataSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginReadDataSection), R"#(None)#" ) .def("BeginReadPersistentObjectData", (void (FSD_BinaryFile::*)() ) static_cast<void (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginReadPersistentObjectData), R"#(None)#" ) .def("BeginReadObjectData", (void (FSD_BinaryFile::*)() ) static_cast<void (FSD_BinaryFile::*)() >(&FSD_BinaryFile::BeginReadObjectData), R"#(None)#" ) .def("EndReadObjectData", (void (FSD_BinaryFile::*)() ) static_cast<void (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndReadObjectData), R"#(None)#" ) .def("EndReadPersistentObjectData", (void (FSD_BinaryFile::*)() ) static_cast<void (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndReadPersistentObjectData), R"#(None)#" ) .def("EndReadDataSection", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::EndReadDataSection), R"#(None)#" ) .def("SkipObject", (void (FSD_BinaryFile::*)() ) static_cast<void (FSD_BinaryFile::*)() >(&FSD_BinaryFile::SkipObject), R"#(None)#" ) .def("PutReference", (Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_Integer ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_Integer ) >(&FSD_BinaryFile::PutReference), R"#(None)#" , py::arg("aValue")) .def("PutCharacter", (Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_Character ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_Character ) >(&FSD_BinaryFile::PutCharacter), R"#(None)#" , py::arg("aValue")) .def("PutExtCharacter", (Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_ExtCharacter ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_ExtCharacter ) >(&FSD_BinaryFile::PutExtCharacter), R"#(None)#" , py::arg("aValue")) .def("PutInteger", (Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_Integer ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_Integer ) >(&FSD_BinaryFile::PutInteger), R"#(None)#" , py::arg("aValue")) .def("PutBoolean", (Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_Boolean ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_Boolean ) >(&FSD_BinaryFile::PutBoolean), R"#(None)#" , py::arg("aValue")) .def("PutReal", (Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_Real ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_Real ) >(&FSD_BinaryFile::PutReal), R"#(None)#" , py::arg("aValue")) .def("PutShortReal", (Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_ShortReal ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( const Standard_ShortReal ) >(&FSD_BinaryFile::PutShortReal), R"#(None)#" , py::arg("aValue")) .def("GetReference", (Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_Integer & ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_Integer & ) >(&FSD_BinaryFile::GetReference), R"#(None)#" , py::arg("aValue")) .def("GetCharacter", (Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_Character & ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_Character & ) >(&FSD_BinaryFile::GetCharacter), R"#(None)#" , py::arg("aValue")) .def("GetExtCharacter", (Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_ExtCharacter & ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_ExtCharacter & ) >(&FSD_BinaryFile::GetExtCharacter), R"#(None)#" , py::arg("aValue")) .def("GetInteger", (Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_Integer & ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_Integer & ) >(&FSD_BinaryFile::GetInteger), R"#(None)#" , py::arg("aValue")) .def("GetBoolean", (Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_Boolean & ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_Boolean & ) >(&FSD_BinaryFile::GetBoolean), R"#(None)#" , py::arg("aValue")) .def("GetReal", (Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_Real & ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_Real & ) >(&FSD_BinaryFile::GetReal), R"#(None)#" , py::arg("aValue")) .def("GetShortReal", (Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_ShortReal & ) ) static_cast<Storage_BaseDriver & (FSD_BinaryFile::*)( Standard_ShortReal & ) >(&FSD_BinaryFile::GetShortReal), R"#(None)#" , py::arg("aValue")) .def("Close", (Storage_Error (FSD_BinaryFile::*)() ) static_cast<Storage_Error (FSD_BinaryFile::*)() >(&FSD_BinaryFile::Close), R"#(None)#" ) .def("Destroy", (void (FSD_BinaryFile::*)() ) static_cast<void (FSD_BinaryFile::*)() >(&FSD_BinaryFile::Destroy), R"#(None)#" ) // methods using call by reference i.s.o. return .def("ReadInfo", []( FSD_BinaryFile &self , TCollection_AsciiString & dbVersion,TCollection_AsciiString & date,TCollection_AsciiString & schemaName,TCollection_AsciiString & schemaVersion,TCollection_ExtendedString & appName,TCollection_AsciiString & appVersion,TCollection_ExtendedString & objectType,NCollection_Sequence<TCollection_AsciiString> & userInfo ){ Standard_Integer nbObj; self.ReadInfo(nbObj,dbVersion,date,schemaName,schemaVersion,appName,appVersion,objectType,userInfo); return std::make_tuple(nbObj); }, R"#(None)#" , py::arg("dbVersion"), py::arg("date"), py::arg("schemaName"), py::arg("schemaVersion"), py::arg("appName"), py::arg("appVersion"), py::arg("objectType"), py::arg("userInfo")) .def("ReadTypeInformations", []( FSD_BinaryFile &self , TCollection_AsciiString & typeName ){ Standard_Integer typeNum; self.ReadTypeInformations(typeNum,typeName); return std::make_tuple(typeNum); }, R"#(None)#" , py::arg("typeName")) .def("ReadRoot", []( FSD_BinaryFile &self , TCollection_AsciiString & rootName,TCollection_AsciiString & aType ){ Standard_Integer aRef; self.ReadRoot(rootName,aRef,aType); return std::make_tuple(aRef); }, R"#(None)#" , py::arg("rootName"), py::arg("aType")) .def("ReadReferenceType", []( FSD_BinaryFile &self ){ Standard_Integer reference; Standard_Integer typeNum; self.ReadReferenceType(reference,typeNum); return std::make_tuple(reference,typeNum); }, R"#(None)#" ) .def("ReadPersistentObjectHeader", []( FSD_BinaryFile &self ){ Standard_Integer aRef; Standard_Integer aType; self.ReadPersistentObjectHeader(aRef,aType); return std::make_tuple(aRef,aType); }, R"#(None)#" ) // static methods .def_static("IsGoodFileType_s", (Storage_Error (*)( const TCollection_AsciiString & ) ) static_cast<Storage_Error (*)( const TCollection_AsciiString & ) >(&FSD_BinaryFile::IsGoodFileType), R"#(None)#" , py::arg("aName")) .def_static("WriteInfo_s", (Standard_Integer (*)( std::ostream & , const Standard_Integer , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_ExtendedString & , const TCollection_AsciiString & , const TCollection_ExtendedString & , const NCollection_Sequence<TCollection_AsciiString> & , const Standard_Boolean ) ) static_cast<Standard_Integer (*)( std::ostream & , const Standard_Integer , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_ExtendedString & , const TCollection_AsciiString & , const TCollection_ExtendedString & , const NCollection_Sequence<TCollection_AsciiString> & , const Standard_Boolean ) >(&FSD_BinaryFile::WriteInfo), R"#(None)#" , py::arg("theOStream"), py::arg("nbObj"), py::arg("dbVersion"), py::arg("date"), py::arg("schemaName"), py::arg("schemaVersion"), py::arg("appName"), py::arg("appVersion"), py::arg("objectType"), py::arg("userInfo"), py::arg("theOnlyCount")=static_cast<const Standard_Boolean>(Standard_False)) .def_static("WriteComment_s", (Standard_Integer (*)( std::ostream & , const NCollection_Sequence<TCollection_ExtendedString> & , const Standard_Boolean ) ) static_cast<Standard_Integer (*)( std::ostream & , const NCollection_Sequence<TCollection_ExtendedString> & , const Standard_Boolean ) >(&FSD_BinaryFile::WriteComment), R"#(None)#" , py::arg("theOStream"), py::arg("theComments"), py::arg("theOnlyCount")=static_cast<const Standard_Boolean>(Standard_False)) .def_static("ReadComment_s", (void (*)( std::istream & , NCollection_Sequence<TCollection_ExtendedString> & ) ) static_cast<void (*)( std::istream & , NCollection_Sequence<TCollection_ExtendedString> & ) >(&FSD_BinaryFile::ReadComment), R"#(None)#" , py::arg("theIStream"), py::arg("userComments")) .def_static("TypeSectionSize_s", (Standard_Integer (*)( std::istream & ) ) static_cast<Standard_Integer (*)( std::istream & ) >(&FSD_BinaryFile::TypeSectionSize), R"#(None)#" , py::arg("theIStream")) .def_static("RootSectionSize_s", (Standard_Integer (*)( std::istream & ) ) static_cast<Standard_Integer (*)( std::istream & ) >(&FSD_BinaryFile::RootSectionSize), R"#(None)#" , py::arg("theIStream")) .def_static("RefSectionSize_s", (Standard_Integer (*)( std::istream & ) ) static_cast<Standard_Integer (*)( std::istream & ) >(&FSD_BinaryFile::RefSectionSize), R"#(None)#" , py::arg("theIStream")) .def_static("PutInteger_s", (Standard_Integer (*)( std::ostream & , const Standard_Integer , const Standard_Boolean ) ) static_cast<Standard_Integer (*)( std::ostream & , const Standard_Integer , const Standard_Boolean ) >(&FSD_BinaryFile::PutInteger), R"#(None)#" , py::arg("theOStream"), py::arg("aValue"), py::arg("theOnlyCount")=static_cast<const Standard_Boolean>(Standard_False)) .def_static("InverseInt_s", (Standard_Integer (*)( const Standard_Integer ) ) static_cast<Standard_Integer (*)( const Standard_Integer ) >(&FSD_BinaryFile::InverseInt), R"#(Inverse bytes in integer value)#" , py::arg("theValue")) .def_static("InverseExtChar_s", (Standard_ExtCharacter (*)( const Standard_ExtCharacter ) ) static_cast<Standard_ExtCharacter (*)( const Standard_ExtCharacter ) >(&FSD_BinaryFile::InverseExtChar), R"#(Inverse bytes in extended character value)#" , py::arg("theValue")) .def_static("InverseReal_s", (Standard_Real (*)( const Standard_Real ) ) static_cast<Standard_Real (*)( const Standard_Real ) >(&FSD_BinaryFile::InverseReal), R"#(Inverse bytes in real value)#" , py::arg("theValue")) .def_static("InverseShortReal_s", (Standard_ShortReal (*)( const Standard_ShortReal ) ) static_cast<Standard_ShortReal (*)( const Standard_ShortReal ) >(&FSD_BinaryFile::InverseShortReal), R"#(Inverse bytes in short real value)#" , py::arg("theValue")) .def_static("InverseSize_s", (Standard_Size (*)( const Standard_Size ) ) static_cast<Standard_Size (*)( const Standard_Size ) >(&FSD_BinaryFile::InverseSize), R"#(Inverse bytes in size value)#" , py::arg("theValue")) .def_static("InverseUint64_s", (uint64_t (*)( const uint64_t ) ) static_cast<uint64_t (*)( const uint64_t ) >(&FSD_BinaryFile::InverseUint64), R"#(Inverse bytes in 64bit unsigned int value)#" , py::arg("theValue")) .def_static("ReadHeader_s", (void (*)( std::istream & , FSD_FileHeader & ) ) static_cast<void (*)( std::istream & , FSD_FileHeader & ) >(&FSD_BinaryFile::ReadHeader), R"#(None)#" , py::arg("theIStream"), py::arg("theFileHeader")) .def_static("ReadHeaderData_s", (void (*)( std::istream & , const opencascade::handle<Storage_HeaderData> & ) ) static_cast<void (*)( std::istream & , const opencascade::handle<Storage_HeaderData> & ) >(&FSD_BinaryFile::ReadHeaderData), R"#(None)#" , py::arg("theIStream"), py::arg("theHeaderData")) .def_static("ReadString_s", (void (*)( std::istream & , TCollection_AsciiString & ) ) static_cast<void (*)( std::istream & , TCollection_AsciiString & ) >(&FSD_BinaryFile::ReadString), R"#(None)#" , py::arg("theIStream"), py::arg("buffer")) .def_static("ReadExtendedString_s", (void (*)( std::istream & , TCollection_ExtendedString & ) ) static_cast<void (*)( std::istream & , TCollection_ExtendedString & ) >(&FSD_BinaryFile::ReadExtendedString), R"#(None)#" , py::arg("theIStream"), py::arg("buffer")) .def_static("WriteHeader_s", (Standard_Integer (*)( std::ostream & , const FSD_FileHeader & , const Standard_Boolean ) ) static_cast<Standard_Integer (*)( std::ostream & , const FSD_FileHeader & , const Standard_Boolean ) >(&FSD_BinaryFile::WriteHeader), R"#(None)#" , py::arg("theOStream"), py::arg("theHeader"), py::arg("theOnlyCount")=static_cast<const Standard_Boolean>(Standard_False)) .def_static("MagicNumber_s", (Standard_CString (*)() ) static_cast<Standard_CString (*)() >(&FSD_BinaryFile::MagicNumber), R"#(None)#" ) // static methods using call by reference i.s.o. return .def_static("ReadTypeInformations_s", []( std::istream & theIStream,TCollection_AsciiString & typeName ){ Standard_Integer typeNum; FSD_BinaryFile::ReadTypeInformations(theIStream,typeNum,typeName); return std::make_tuple(typeNum); }, R"#(None)#" , py::arg("theIStream"), py::arg("typeName")) .def_static("ReadRoot_s", []( std::istream & theIStream,TCollection_AsciiString & rootName,TCollection_AsciiString & aType ){ Standard_Integer aRef; FSD_BinaryFile::ReadRoot(theIStream,rootName,aRef,aType); return std::make_tuple(aRef); }, R"#(None)#" , py::arg("theIStream"), py::arg("rootName"), py::arg("aType")) .def_static("ReadReferenceType_s", []( std::istream & theIStream ){ Standard_Integer reference; Standard_Integer typeNum; FSD_BinaryFile::ReadReferenceType(theIStream,reference,typeNum); return std::make_tuple(reference,typeNum); }, R"#(None)#" , py::arg("theIStream")) .def_static("GetReference_s", []( std::istream & theIStream ){ Standard_Integer aValue; FSD_BinaryFile::GetReference(theIStream,aValue); return std::make_tuple(aValue); }, R"#(None)#" , py::arg("theIStream")) .def_static("GetInteger_s", []( std::istream & theIStream ){ Standard_Integer aValue; FSD_BinaryFile::GetInteger(theIStream,aValue); return std::make_tuple(aValue); }, R"#(None)#" , py::arg("theIStream")) // operators // additional methods and static methods ; static_cast<py::class_<FSD_File , shared_ptr<FSD_File> , Storage_BaseDriver>>(m.attr("FSD_File")) // constructors .def(py::init< >() ) // custom constructors // methods .def("Open", (Storage_Error (FSD_File::*)( const TCollection_AsciiString & , const Storage_OpenMode ) ) static_cast<Storage_Error (FSD_File::*)( const TCollection_AsciiString & , const Storage_OpenMode ) >(&FSD_File::Open), R"#(Assigns as aName the name of the file to be driven by this driver. aMode precises if the file is opened in read or write mode. The function returns Storage_VSOk if the file is opened correctly, or any other value of the Storage_Error enumeration which specifies the problem encountered.)#" , py::arg("aName"), py::arg("aMode")) .def("IsEnd", (Standard_Boolean (FSD_File::*)() ) static_cast<Standard_Boolean (FSD_File::*)() >(&FSD_File::IsEnd), R"#(None)#" ) .def("Tell", (Storage_Position (FSD_File::*)() ) static_cast<Storage_Position (FSD_File::*)() >(&FSD_File::Tell), R"#(return position in the file. Return -1 upon error.)#" ) .def("BeginWriteInfoSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::BeginWriteInfoSection), R"#(None)#" ) .def("WriteInfo", (void (FSD_File::*)( const Standard_Integer , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_ExtendedString & , const TCollection_AsciiString & , const TCollection_ExtendedString & , const NCollection_Sequence<TCollection_AsciiString> & ) ) static_cast<void (FSD_File::*)( const Standard_Integer , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_AsciiString & , const TCollection_ExtendedString & , const TCollection_AsciiString & , const TCollection_ExtendedString & , const NCollection_Sequence<TCollection_AsciiString> & ) >(&FSD_File::WriteInfo), R"#(None)#" , py::arg("nbObj"), py::arg("dbVersion"), py::arg("date"), py::arg("schemaName"), py::arg("schemaVersion"), py::arg("appName"), py::arg("appVersion"), py::arg("objectType"), py::arg("userInfo")) .def("EndWriteInfoSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::EndWriteInfoSection), R"#(None)#" ) .def("BeginReadInfoSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::BeginReadInfoSection), R"#(None)#" ) .def("ReadCompleteInfo", (void (FSD_File::*)( std::istream & , opencascade::handle<Storage_Data> & ) ) static_cast<void (FSD_File::*)( std::istream & , opencascade::handle<Storage_Data> & ) >(&FSD_File::ReadCompleteInfo), R"#(None)#" , py::arg("theIStream"), py::arg("theData")) .def("EndReadInfoSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::EndReadInfoSection), R"#(None)#" ) .def("BeginWriteCommentSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::BeginWriteCommentSection), R"#(None)#" ) .def("WriteComment", (void (FSD_File::*)( const NCollection_Sequence<TCollection_ExtendedString> & ) ) static_cast<void (FSD_File::*)( const NCollection_Sequence<TCollection_ExtendedString> & ) >(&FSD_File::WriteComment), R"#(None)#" , py::arg("userComments")) .def("EndWriteCommentSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::EndWriteCommentSection), R"#(None)#" ) .def("BeginReadCommentSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::BeginReadCommentSection), R"#(None)#" ) .def("ReadComment", (void (FSD_File::*)( NCollection_Sequence<TCollection_ExtendedString> & ) ) static_cast<void (FSD_File::*)( NCollection_Sequence<TCollection_ExtendedString> & ) >(&FSD_File::ReadComment), R"#(None)#" , py::arg("userComments")) .def("EndReadCommentSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::EndReadCommentSection), R"#(None)#" ) .def("BeginWriteTypeSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::BeginWriteTypeSection), R"#(None)#" ) .def("SetTypeSectionSize", (void (FSD_File::*)( const Standard_Integer ) ) static_cast<void (FSD_File::*)( const Standard_Integer ) >(&FSD_File::SetTypeSectionSize), R"#(None)#" , py::arg("aSize")) .def("WriteTypeInformations", (void (FSD_File::*)( const Standard_Integer , const TCollection_AsciiString & ) ) static_cast<void (FSD_File::*)( const Standard_Integer , const TCollection_AsciiString & ) >(&FSD_File::WriteTypeInformations), R"#(None)#" , py::arg("typeNum"), py::arg("typeName")) .def("EndWriteTypeSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::EndWriteTypeSection), R"#(None)#" ) .def("BeginReadTypeSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::BeginReadTypeSection), R"#(None)#" ) .def("TypeSectionSize", (Standard_Integer (FSD_File::*)() ) static_cast<Standard_Integer (FSD_File::*)() >(&FSD_File::TypeSectionSize), R"#(None)#" ) .def("EndReadTypeSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::EndReadTypeSection), R"#(None)#" ) .def("BeginWriteRootSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::BeginWriteRootSection), R"#(None)#" ) .def("SetRootSectionSize", (void (FSD_File::*)( const Standard_Integer ) ) static_cast<void (FSD_File::*)( const Standard_Integer ) >(&FSD_File::SetRootSectionSize), R"#(None)#" , py::arg("aSize")) .def("WriteRoot", (void (FSD_File::*)( const TCollection_AsciiString & , const Standard_Integer , const TCollection_AsciiString & ) ) static_cast<void (FSD_File::*)( const TCollection_AsciiString & , const Standard_Integer , const TCollection_AsciiString & ) >(&FSD_File::WriteRoot), R"#(None)#" , py::arg("rootName"), py::arg("aRef"), py::arg("aType")) .def("EndWriteRootSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::EndWriteRootSection), R"#(None)#" ) .def("BeginReadRootSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::BeginReadRootSection), R"#(None)#" ) .def("RootSectionSize", (Standard_Integer (FSD_File::*)() ) static_cast<Standard_Integer (FSD_File::*)() >(&FSD_File::RootSectionSize), R"#(None)#" ) .def("EndReadRootSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::EndReadRootSection), R"#(None)#" ) .def("BeginWriteRefSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::BeginWriteRefSection), R"#(None)#" ) .def("SetRefSectionSize", (void (FSD_File::*)( const Standard_Integer ) ) static_cast<void (FSD_File::*)( const Standard_Integer ) >(&FSD_File::SetRefSectionSize), R"#(None)#" , py::arg("aSize")) .def("WriteReferenceType", (void (FSD_File::*)( const Standard_Integer , const Standard_Integer ) ) static_cast<void (FSD_File::*)( const Standard_Integer , const Standard_Integer ) >(&FSD_File::WriteReferenceType), R"#(None)#" , py::arg("reference"), py::arg("typeNum")) .def("EndWriteRefSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::EndWriteRefSection), R"#(None)#" ) .def("BeginReadRefSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::BeginReadRefSection), R"#(None)#" ) .def("RefSectionSize", (Standard_Integer (FSD_File::*)() ) static_cast<Standard_Integer (FSD_File::*)() >(&FSD_File::RefSectionSize), R"#(None)#" ) .def("EndReadRefSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::EndReadRefSection), R"#(None)#" ) .def("BeginWriteDataSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::BeginWriteDataSection), R"#(None)#" ) .def("WritePersistentObjectHeader", (void (FSD_File::*)( const Standard_Integer , const Standard_Integer ) ) static_cast<void (FSD_File::*)( const Standard_Integer , const Standard_Integer ) >(&FSD_File::WritePersistentObjectHeader), R"#(None)#" , py::arg("aRef"), py::arg("aType")) .def("BeginWritePersistentObjectData", (void (FSD_File::*)() ) static_cast<void (FSD_File::*)() >(&FSD_File::BeginWritePersistentObjectData), R"#(None)#" ) .def("BeginWriteObjectData", (void (FSD_File::*)() ) static_cast<void (FSD_File::*)() >(&FSD_File::BeginWriteObjectData), R"#(None)#" ) .def("EndWriteObjectData", (void (FSD_File::*)() ) static_cast<void (FSD_File::*)() >(&FSD_File::EndWriteObjectData), R"#(None)#" ) .def("EndWritePersistentObjectData", (void (FSD_File::*)() ) static_cast<void (FSD_File::*)() >(&FSD_File::EndWritePersistentObjectData), R"#(None)#" ) .def("EndWriteDataSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::EndWriteDataSection), R"#(None)#" ) .def("BeginReadDataSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::BeginReadDataSection), R"#(None)#" ) .def("BeginReadPersistentObjectData", (void (FSD_File::*)() ) static_cast<void (FSD_File::*)() >(&FSD_File::BeginReadPersistentObjectData), R"#(None)#" ) .def("BeginReadObjectData", (void (FSD_File::*)() ) static_cast<void (FSD_File::*)() >(&FSD_File::BeginReadObjectData), R"#(None)#" ) .def("EndReadObjectData", (void (FSD_File::*)() ) static_cast<void (FSD_File::*)() >(&FSD_File::EndReadObjectData), R"#(None)#" ) .def("EndReadPersistentObjectData", (void (FSD_File::*)() ) static_cast<void (FSD_File::*)() >(&FSD_File::EndReadPersistentObjectData), R"#(None)#" ) .def("EndReadDataSection", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::EndReadDataSection), R"#(None)#" ) .def("SkipObject", (void (FSD_File::*)() ) static_cast<void (FSD_File::*)() >(&FSD_File::SkipObject), R"#(None)#" ) .def("PutReference", (Storage_BaseDriver & (FSD_File::*)( const Standard_Integer ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( const Standard_Integer ) >(&FSD_File::PutReference), R"#(None)#" , py::arg("aValue")) .def("PutCharacter", (Storage_BaseDriver & (FSD_File::*)( const Standard_Character ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( const Standard_Character ) >(&FSD_File::PutCharacter), R"#(None)#" , py::arg("aValue")) .def("PutExtCharacter", (Storage_BaseDriver & (FSD_File::*)( const Standard_ExtCharacter ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( const Standard_ExtCharacter ) >(&FSD_File::PutExtCharacter), R"#(None)#" , py::arg("aValue")) .def("PutInteger", (Storage_BaseDriver & (FSD_File::*)( const Standard_Integer ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( const Standard_Integer ) >(&FSD_File::PutInteger), R"#(None)#" , py::arg("aValue")) .def("PutBoolean", (Storage_BaseDriver & (FSD_File::*)( const Standard_Boolean ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( const Standard_Boolean ) >(&FSD_File::PutBoolean), R"#(None)#" , py::arg("aValue")) .def("PutReal", (Storage_BaseDriver & (FSD_File::*)( const Standard_Real ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( const Standard_Real ) >(&FSD_File::PutReal), R"#(None)#" , py::arg("aValue")) .def("PutShortReal", (Storage_BaseDriver & (FSD_File::*)( const Standard_ShortReal ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( const Standard_ShortReal ) >(&FSD_File::PutShortReal), R"#(None)#" , py::arg("aValue")) .def("GetReference", (Storage_BaseDriver & (FSD_File::*)( Standard_Integer & ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( Standard_Integer & ) >(&FSD_File::GetReference), R"#(None)#" , py::arg("aValue")) .def("GetCharacter", (Storage_BaseDriver & (FSD_File::*)( Standard_Character & ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( Standard_Character & ) >(&FSD_File::GetCharacter), R"#(None)#" , py::arg("aValue")) .def("GetExtCharacter", (Storage_BaseDriver & (FSD_File::*)( Standard_ExtCharacter & ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( Standard_ExtCharacter & ) >(&FSD_File::GetExtCharacter), R"#(None)#" , py::arg("aValue")) .def("GetInteger", (Storage_BaseDriver & (FSD_File::*)( Standard_Integer & ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( Standard_Integer & ) >(&FSD_File::GetInteger), R"#(None)#" , py::arg("aValue")) .def("GetBoolean", (Storage_BaseDriver & (FSD_File::*)( Standard_Boolean & ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( Standard_Boolean & ) >(&FSD_File::GetBoolean), R"#(None)#" , py::arg("aValue")) .def("GetReal", (Storage_BaseDriver & (FSD_File::*)( Standard_Real & ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( Standard_Real & ) >(&FSD_File::GetReal), R"#(None)#" , py::arg("aValue")) .def("GetShortReal", (Storage_BaseDriver & (FSD_File::*)( Standard_ShortReal & ) ) static_cast<Storage_BaseDriver & (FSD_File::*)( Standard_ShortReal & ) >(&FSD_File::GetShortReal), R"#(None)#" , py::arg("aValue")) .def("Close", (Storage_Error (FSD_File::*)() ) static_cast<Storage_Error (FSD_File::*)() >(&FSD_File::Close), R"#(Closes the file driven by this driver. This file was opened by the last call to the function Open. The function returns Storage_VSOk if the closure is correctly done, or any other value of the Storage_Error enumeration which specifies the problem encountered.)#" ) .def("Destroy", (void (FSD_File::*)() ) static_cast<void (FSD_File::*)() >(&FSD_File::Destroy), R"#(None)#" ) // methods using call by reference i.s.o. return .def("ReadInfo", []( FSD_File &self , TCollection_AsciiString & dbVersion,TCollection_AsciiString & date,TCollection_AsciiString & schemaName,TCollection_AsciiString & schemaVersion,TCollection_ExtendedString & appName,TCollection_AsciiString & appVersion,TCollection_ExtendedString & objectType,NCollection_Sequence<TCollection_AsciiString> & userInfo ){ Standard_Integer nbObj; self.ReadInfo(nbObj,dbVersion,date,schemaName,schemaVersion,appName,appVersion,objectType,userInfo); return std::make_tuple(nbObj); }, R"#(None)#" , py::arg("dbVersion"), py::arg("date"), py::arg("schemaName"), py::arg("schemaVersion"), py::arg("appName"), py::arg("appVersion"), py::arg("objectType"), py::arg("userInfo")) .def("ReadTypeInformations", []( FSD_File &self , TCollection_AsciiString & typeName ){ Standard_Integer typeNum; self.ReadTypeInformations(typeNum,typeName); return std::make_tuple(typeNum); }, R"#(None)#" , py::arg("typeName")) .def("ReadRoot", []( FSD_File &self , TCollection_AsciiString & rootName,TCollection_AsciiString & aType ){ Standard_Integer aRef; self.ReadRoot(rootName,aRef,aType); return std::make_tuple(aRef); }, R"#(None)#" , py::arg("rootName"), py::arg("aType")) .def("ReadReferenceType", []( FSD_File &self ){ Standard_Integer reference; Standard_Integer typeNum; self.ReadReferenceType(reference,typeNum); return std::make_tuple(reference,typeNum); }, R"#(None)#" ) .def("ReadPersistentObjectHeader", []( FSD_File &self ){ Standard_Integer aRef; Standard_Integer aType; self.ReadPersistentObjectHeader(aRef,aType); return std::make_tuple(aRef,aType); }, R"#(None)#" ) // static methods .def_static("IsGoodFileType_s", (Storage_Error (*)( const TCollection_AsciiString & ) ) static_cast<Storage_Error (*)( const TCollection_AsciiString & ) >(&FSD_File::IsGoodFileType), R"#(None)#" , py::arg("aName")) .def_static("MagicNumber_s", (Standard_CString (*)() ) static_cast<Standard_CString (*)() >(&FSD_File::MagicNumber), R"#(None)#" ) // static methods using call by reference i.s.o. return // operators // additional methods and static methods ; // default constructor register_default_constructor<FSD_FileHeader , shared_ptr<FSD_FileHeader>>(m,"FSD_FileHeader"); static_cast<py::class_<FSD_FileHeader , shared_ptr<FSD_FileHeader> >>(m.attr("FSD_FileHeader")) // constructors // custom constructors // methods // methods using call by reference i.s.o. return // static methods // static methods using call by reference i.s.o. return // operators // additional methods and static methods ; static_cast<py::class_<FSD_CmpFile , shared_ptr<FSD_CmpFile> , FSD_File>>(m.attr("FSD_CmpFile")) // constructors .def(py::init< >() ) // custom constructors // methods .def("Open", (Storage_Error (FSD_CmpFile::*)( const TCollection_AsciiString & , const Storage_OpenMode ) ) static_cast<Storage_Error (FSD_CmpFile::*)( const TCollection_AsciiString & , const Storage_OpenMode ) >(&FSD_CmpFile::Open), R"#(None)#" , py::arg("aName"), py::arg("aMode")) .def("BeginWriteInfoSection", (Storage_Error (FSD_CmpFile::*)() ) static_cast<Storage_Error (FSD_CmpFile::*)() >(&FSD_CmpFile::BeginWriteInfoSection), R"#(None)#" ) .def("BeginReadInfoSection", (Storage_Error (FSD_CmpFile::*)() ) static_cast<Storage_Error (FSD_CmpFile::*)() >(&FSD_CmpFile::BeginReadInfoSection), R"#(None)#" ) .def("WritePersistentObjectHeader", (void (FSD_CmpFile::*)( const Standard_Integer , const Standard_Integer ) ) static_cast<void (FSD_CmpFile::*)( const Standard_Integer , const Standard_Integer ) >(&FSD_CmpFile::WritePersistentObjectHeader), R"#(None)#" , py::arg("aRef"), py::arg("aType")) .def("BeginWritePersistentObjectData", (void (FSD_CmpFile::*)() ) static_cast<void (FSD_CmpFile::*)() >(&FSD_CmpFile::BeginWritePersistentObjectData), R"#(None)#" ) .def("BeginWriteObjectData", (void (FSD_CmpFile::*)() ) static_cast<void (FSD_CmpFile::*)() >(&FSD_CmpFile::BeginWriteObjectData), R"#(None)#" ) .def("EndWriteObjectData", (void (FSD_CmpFile::*)() ) static_cast<void (FSD_CmpFile::*)() >(&FSD_CmpFile::EndWriteObjectData), R"#(None)#" ) .def("EndWritePersistentObjectData", (void (FSD_CmpFile::*)() ) static_cast<void (FSD_CmpFile::*)() >(&FSD_CmpFile::EndWritePersistentObjectData), R"#(None)#" ) .def("BeginReadPersistentObjectData", (void (FSD_CmpFile::*)() ) static_cast<void (FSD_CmpFile::*)() >(&FSD_CmpFile::BeginReadPersistentObjectData), R"#(None)#" ) .def("BeginReadObjectData", (void (FSD_CmpFile::*)() ) static_cast<void (FSD_CmpFile::*)() >(&FSD_CmpFile::BeginReadObjectData), R"#(None)#" ) .def("EndReadObjectData", (void (FSD_CmpFile::*)() ) static_cast<void (FSD_CmpFile::*)() >(&FSD_CmpFile::EndReadObjectData), R"#(None)#" ) .def("EndReadPersistentObjectData", (void (FSD_CmpFile::*)() ) static_cast<void (FSD_CmpFile::*)() >(&FSD_CmpFile::EndReadPersistentObjectData), R"#(None)#" ) .def("Destroy", (void (FSD_CmpFile::*)() ) static_cast<void (FSD_CmpFile::*)() >(&FSD_CmpFile::Destroy), R"#(None)#" ) // methods using call by reference i.s.o. return .def("ReadPersistentObjectHeader", []( FSD_CmpFile &self ){ Standard_Integer aRef; Standard_Integer aType; self.ReadPersistentObjectHeader(aRef,aType); return std::make_tuple(aRef,aType); }, R"#(None)#" ) // static methods .def_static("IsGoodFileType_s", (Storage_Error (*)( const TCollection_AsciiString & ) ) static_cast<Storage_Error (*)( const TCollection_AsciiString & ) >(&FSD_CmpFile::IsGoodFileType), R"#(None)#" , py::arg("aName")) .def_static("MagicNumber_s", (Standard_CString (*)() ) static_cast<Standard_CString (*)() >(&FSD_CmpFile::MagicNumber), R"#(None)#" ) // static methods using call by reference i.s.o. return // operators // additional methods and static methods ; // functions // ./opencascade\FSD_Base64Decoder.hxx // ./opencascade\FSD_BinaryFile.hxx // ./opencascade\FSD_BStream.hxx // ./opencascade\FSD_CmpFile.hxx // ./opencascade\FSD_File.hxx // ./opencascade\FSD_FStream.hxx // ./opencascade\FSD_FileHeader.hxx // Additional functions // operators // register typdefs // exceptions // user-defined post-inclusion per module in the body }; // user-defined post-inclusion per module // user-defined post
[ "adam.jan.urbanczyk@gmail.com" ]
adam.jan.urbanczyk@gmail.com
bb2c72e4bf98d7910f854dcbbb14c242aded9ea1
a5f0c800f6fa1cec512a6af984891eedfda58215
/ProgramPP/Chapter14/Problem01/Problem01/chapter14.cpp
0628b1b1aea6673f39d79ce9f39457c50b094346
[]
no_license
hskramer/CPlus
fc0ede66f3739699aec205fa9902790fc1bca400
7dc3a246ca7623872820cd50c29f8e58bfb8c0fa
refs/heads/master
2020-03-15T22:50:19.914715
2019-04-30T19:35:15
2019-04-30T19:35:15
124,801,193
0
0
null
null
null
null
UTF-8
C++
false
false
2,860
cpp
#include "chapter14.h" namespace Graph_lib { //-------------------------------------------------------------------------------------------------- void Smiley::draw_lines() const { Circle::draw_lines(); Circle eye1{ Point{center().x - int(radius() / 2.5), center().y - int(radius() / 2.5)}, radius() / 5 }; eye1.draw_lines(); Circle eye2{ Point{center().x + int(radius() / 2.5), center().y - int(radius() / 2.5)}, radius() / 5 }; eye2.draw_lines(); Arcs smile{ Point{center().x - int(radius() / 2), center().y - int(radius() / 4)}, radius(), radius(), 210, 330 }; smile.draw_lines(); } //-------------------------------------------------------------------------------------------------- void Frowny::draw_lines() const { Circle::draw_lines(); Circle eye1{ Point{center().x - int(radius() / 2.5), center().y - int(radius() / 2.5)}, radius() / 5 }; eye1.draw_lines(); Circle eye2{ Point{center().x + int(radius() / 2.5), center().y - int(radius() / 2.5)}, radius() / 5 }; eye2.draw_lines(); Arcs frown{ Point{center().x - int(radius() / 2), center().y + int(radius() / 2.5)}, radius(), radius(), 35, 145 }; frown.draw_lines(); } //-------------------------------------------------------------------------------------------------- void Smiley_Hat::draw_lines() const { Polygon shat; shat.add(Point{ center().x - radius(), center().y - radius() }); shat.add(Point{ center().x - radius(), center().y - int(radius() * 1.5)}); shat.add(Point{ center().x - int(radius() / 2) , center().y - int(radius() * 1.5) }); shat.add(Point{ center().x - int(radius() / 2), center().y - int(radius() * 2) }); shat.add(Point{ center().x + int(radius() / 2), center().y - int(radius() * 2) }); shat.add(Point{ center().x + int(radius() / 2), center().y - int(radius() * 1.5) }); shat.add(Point{ center().x + radius(), center().y - int(radius() * 1.5) }); shat.add(Point{ center().x + radius(), center().y - radius() }); shat.draw_lines(); } //-------------------------------------------------------------------------------------------------- void Frowny_Hat::draw_lines() const { Polygon fhat; fhat.add(Point{ center().x - radius(), center().y - radius() }); fhat.add(Point{ center().x - radius(), center().y - int(radius() * 1.5) }); fhat.add(Point{ center().x - int(radius() / 2) , center().y - int(radius() * 1.5) }); fhat.add(Point{ center().x - int(radius() / 2), center().y - int(radius() * 2) }); fhat.add(Point{ center().x + int(radius() / 2), center().y - int(radius() * 2) }); fhat.add(Point{ center().x + int(radius() / 2), center().y - int(radius() * 1.5) }); fhat.add(Point{ center().x + radius(), center().y - int(radius() * 1.5) }); fhat.add(Point{ center().x + radius(), center().y - radius() }); fhat.draw_lines(); } //-------------------------------------------------------------------------------------------------- }
[ "31109709+hskramer@users.noreply.github.com" ]
31109709+hskramer@users.noreply.github.com
24348c52abba3e3afdbc4ceed36560a9014cd3f4
99978be53a5f91a6041e6895ceadec02657fb908
/2_Transfom/Shader.h
9ea5383de077f975b01b173d0ca99d7e38b8689d
[]
no_license
XIANQw/LearnOpenGL
5e9b07ab43b568ab2eb4266d22feac98f633a36e
937cbecac46dfc605c88409699bbe88bf1b9fe37
refs/heads/main
2023-04-28T15:04:16.528976
2021-05-11T15:52:12
2021-05-11T15:52:12
351,415,109
0
0
null
null
null
null
GB18030
C++
false
false
3,858
h
#pragma once #include <glad/glad.h>; // 包含glad来获取所有的必须OpenGL头文件 #include <string> #include <fstream> #include <sstream> #include <iostream> inline void setShader(uint32_t& shader, const char* sourceCode, int shaderType) { int success; char infoLog[512]; shader = glCreateShader(shaderType); glShaderSource(shader, 1, &sourceCode, NULL); glCompileShader(shader); glGetShaderiv(shader, GL_COMPILE_STATUS, &success); if (!success) { glGetShaderInfoLog(shader, 512, NULL, infoLog); if (shaderType == GL_FRAGMENT_SHADER) std::cout << "ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\n" << infoLog << std::endl; else std::cout << "ERROR::SHADER::VERTEX::COMPILATION_FAILED\n" << infoLog << std::endl; } } inline void setShaderProgram(const uint32_t vShader, const uint32_t fShader, uint32_t& shaderProgram) { int success; char infoLog[512]; shaderProgram = glCreateProgram(); glAttachShader(shaderProgram, vShader); glAttachShader(shaderProgram, fShader); glLinkProgram(shaderProgram); glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success); if (!success) { glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog); std::cout << "ERROR::SHADER::PROGRAM::LINKING_FAILED\n" << infoLog << std::endl; } } class Shader { public: // 程序ID unsigned int ID; // 构造器从shader文件读取source code并构建着色器 Shader(const GLchar* vertexPath, const GLchar* fragmentPath) { // 1. 从文件路径中获取顶点/片段着色器 std::string vertexCode; std::string fragmentCode; std::ifstream vShaderFile; std::ifstream fShaderFile; // 保证ifstream对象可以抛出异常: vShaderFile.exceptions(std::ifstream::failbit | std::ifstream::badbit); fShaderFile.exceptions(std::ifstream::failbit | std::ifstream::badbit); try { // 打开文件 vShaderFile.open(vertexPath); fShaderFile.open(fragmentPath); std::stringstream vShaderStream, fShaderStream; // 读取文件的缓冲内容到数据流中 vShaderStream << vShaderFile.rdbuf(); fShaderStream << fShaderFile.rdbuf(); // 关闭文件处理器 vShaderFile.close(); fShaderFile.close(); // 转换数据流到string vertexCode = vShaderStream.str(); fragmentCode = fShaderStream.str(); } catch (std::ifstream::failure e) { std::cout << "ERROR::SHADER::FILE_NOT_SUCCESFULLY_READ" << std::endl; } const char* vShaderCode = vertexCode.c_str(); const char* fShaderCode = fragmentCode.c_str(); // 2. Compile uint32_t vShader, fShader; int success; char infoLog[512]; setShader(vShader, vShaderCode, GL_VERTEX_SHADER); setShader(fShader, fShaderCode, GL_FRAGMENT_SHADER); setShaderProgram(vShader, fShader, ID); glDeleteShader(vShader); glDeleteShader(fShader); } // 使用/激活程序 void use() { glUseProgram(ID); } // uniform工具函数 void setBool(const std::string& name, bool value) const { glUniform1i(glGetUniformLocation(ID, name.c_str()), value); } void setInt(const std::string& name, int value) const { glUniform1i(glGetUniformLocation(ID, name.c_str()), value); } void setFloat(const std::string& name, float value) const { glUniform1f(glGetUniformLocation(ID, name.c_str()), value); } void setMat4(const std::string& name, glm::mat4& mat) const { glUniformMatrix4fv(glGetUniformLocation(ID, name.c_str()), 1, GL_FALSE, glm::value_ptr(mat)); } };
[ "qiwei-xian@qq.com" ]
qiwei-xian@qq.com
2574c1eb5ed514d2368d6da680850e364561ba6c
8dc84558f0058d90dfc4955e905dab1b22d12c08
/content/shell/common/shell_switches.cc
de877107f61b2fcb0f8e600ea360404731577b1d
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
meniossin/src
42a95cc6c4a9c71d43d62bc4311224ca1fd61e03
44f73f7e76119e5ab415d4593ac66485e65d700a
refs/heads/master
2022-12-16T20:17:03.747113
2020-09-03T10:43:12
2020-09-03T10:43:12
263,710,168
1
0
BSD-3-Clause
2020-05-13T18:20:09
2020-05-13T18:20:08
null
UTF-8
C++
false
false
2,610
cc
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/shell/common/shell_switches.h" #include "base/command_line.h" #include "base/strings/string_split.h" #include "content/shell/common/layout_test/layout_test_switches.h" namespace switches { // Tells Content Shell that it's running as a content_browsertest. const char kContentBrowserTest[] = "browser-test"; // Makes Content Shell use the given path for its data directory. const char kContentShellDataPath[] = "data-path"; // The directory breakpad should store minidumps in. const char kCrashDumpsDir[] = "crash-dumps-dir"; // Exposes the window.internals object to JavaScript for interactive development // and debugging of layout tests that rely on it. const char kExposeInternalsForTesting[] = "expose-internals-for-testing"; // Enable site isolation (--site-per-process style isolation) for a subset of // sites. The argument is a wildcard pattern which will be matched against the // site URL to determine which sites to isolate. This can be used to isolate // just one top-level domain, or just one scheme. Example usages: // --isolate-sites-for-testing=*.com // --isolate-sites-for-testing=https://* const char kIsolateSitesForTesting[] = "isolate-sites-for-testing"; // Registers additional font files on Windows (for fonts outside the usual // %WINDIR%\Fonts location). Multiple files can be used by separating them // with a semicolon (;). const char kRegisterFontFiles[] = "register-font-files"; // Size for the content_shell's host window (i.e. "800x600"). const char kContentShellHostWindowSize[] = "content-shell-host-window-size"; // Hides toolbar from content_shell's host window. const char kContentShellHideToolbar[] = "content-shell-hide-toolbar"; // Forces all navigations to go through the browser process (in a // non-PlzNavigate way). const char kContentShellAlwaysFork[] = "content-shell-always-fork"; std::vector<std::string> GetSideloadFontFiles() { std::vector<std::string> files; const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kRegisterFontFiles)) { files = base::SplitString( command_line.GetSwitchValueASCII(switches::kRegisterFontFiles), ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); } return files; } bool IsRunWebTestsSwitchPresent() { return base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kRunWebTests); } } // namespace switches
[ "arnaud@geometry.ee" ]
arnaud@geometry.ee
1ff815763cbcd9220ce657e1884b3ddb60ea6dd9
da72d7ffe4d158b226e3b3d9aabe900d0d232394
/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.verify.cpp
6aaffa4d8d92670d9decef57d76de79bf5198631
[ "NCSA", "LLVM-exception", "MIT", "Apache-2.0" ]
permissive
ddcc/llvm-project
19eb04c2de679abaa10321cc0b7eab1ff4465485
9376ccc31a29f2b3f3b33d6e907599e8dd3b1503
refs/heads/next
2023-03-20T13:20:42.024563
2022-08-05T20:02:46
2022-08-05T19:14:06
225,963,333
0
0
Apache-2.0
2021-08-12T21:45:43
2019-12-04T21:49:26
C++
UTF-8
C++
false
false
6,214
cpp
//===----------------------------------------------------------------------===// // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format // TODO FMT Evaluate gcc-11 status // UNSUPPORTED: gcc-11 // Basic test to validate ill-formed code is properly detected. // <format> // template<class... Args> // size_t formatted_size(const locale& loc, // format-string<Args...> fmt, const Args&... args); // template<class... Args> // size_t formatted_size(const locale& loc, // wformat-string<Args...> fmt, const Args&... args); #include <format> #include <locale> #include "test_macros.h" // clang-format off void f() { std::formatted_size(std::locale(), "{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), "}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), "{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), "{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), "{:-}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), "{:#}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), "{:L}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), "{0:{0}}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), "{:.42d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), "{:d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} #ifndef TEST_HAS_NO_WIDE_CHARACTERS std::formatted_size(std::locale(), L"{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), L"}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), L"{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), L"{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), L"{:-}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), L"{:#}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), L"{:L}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), L"{0:{0}}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), L"{:.42d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} std::formatted_size(std::locale(), L"{:d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} #endif }
[ "koraq@xs4all.nl" ]
koraq@xs4all.nl
778c34bb98539670942223f8b06f9a9d3afee8b1
0d48e2d91325a89c39e9afe19cb162bda4d2a790
/.metadata/.plugins/org.eclipse.core.resources/.history/9/e0f80f97565c0019164aea82f5353e36
115a0663fb99a2fdd3ddde8b6df2fc30a4115521
[]
no_license
Vinccool96/Tp4Cpp
a21193fdd434fdf143488f0589152817e7cbadbc
cf0bc185f3df0469dbc20099a410790c059f34f8
refs/heads/master
2020-05-15T18:36:53.559800
2019-04-20T17:26:00
2019-04-20T17:26:00
182,431,102
0
0
null
null
null
null
UTF-8
C++
false
false
4,067
/** * \file gestionBibliographie.cpp * \brief Programme principal * \author etudiant * \date 2019-02-27 */ #include <iostream> #include "Reference.h" #include "validationFormat.h" #include "Ouvrage.h" #include "Journal.h" #include "Bibliographie.h" using namespace std; using namespace biblio; using namespace util; /** * \brief Crée une instance de la classe biblio::Ouvrage * \return l'instance de la classe biblio::Ouvrage */ Ouvrage creerOuvrage() { string auteurs; string titre; int annee; string identifiant; string editeur; string ville; cout << "Crée un ouvrage" << endl; do { cout << "Entre le nom des auteurs:" << endl; std::getline(std::cin, auteurs); } while (!auteurs.empty() && !validerFormatNom(auteurs)); do { cout << "Entre le titre:" << endl; std::getline(std::cin, titre); } while (!titre.empty()); do { string anneeStr; cout << "Entre l'année:" << endl; std::getline(std::cin, anneeStr); annee = std::stoi(anneeStr); } while (annee <= 0); do { cout << "Entre le code d'identification:" << endl; std::getline(std::cin, identifiant); } while (!(validerCodeIsbn(identifiant))); do { cout << "Entre l'éditeur:" << endl; std::getline(std::cin, editeur); } while (!editeur.empty() && !validerFormatNom(editeur)); do { cout << "Entre la ville:" << endl; std::getline(std::cin, ville); } while (!ville.empty() && !validerFormatNom(ville)); Ouvrage ouvrage(auteurs, titre, annee, identifiant, editeur, ville); return ouvrage; } /** * \brief Crée une instance de la classe biblio::Journal * \return l'instance de la classe biblio::Journal */ Journal creerJournal() { string auteurs; string titre; int annee; string identifiant; string nom; int volume; int numero; int page; cout << "Crée un journal" << endl; do { cout << "Entre le nom des auteurs:" << endl; std::getline(std::cin, auteurs); } while (!auteurs.empty() && !validerFormatNom(auteurs)); do { cout << "Entre le titre:" << endl; std::getline(std::cin, titre); } while (!titre.empty()); do { string anneeStr; cout << "Entre l'année:" << endl; std::getline(std::cin, anneeStr); annee = std::stoi(anneeStr); } while (annee <= 0); do { cout << "Entre le code d'identification:" << endl; std::getline(std::cin, identifiant); } while (!(validerCodeIssn(identifiant))); do { cout << "Entre le nom:" << endl; std::getline(std::cin, nom); } while (!nom.empty() && !validerFormatNom(nom)); do { string volumeStr; cout << "Entre le volume:" << endl; std::getline(std::cin, volumeStr); volume = std::stoi(volumeStr); } while (volume <= 0); do { string numeroStr; cout << "Entre le numéro:" << endl; std::getline(std::cin, numeroStr); numero = std::stoi(numeroStr); } while (numero <= 0); do { string pageStr; cout << "Entre la page:" << endl; std::getline(std::cin, pageStr); page = std::stoi(pageStr); } while (volume <= 0); Journal journal(auteurs, titre, annee, identifiant, nom, volume, numero, page); return journal; } /** * \brief lance le programme * \return un int de valeur 0 */ int main() { string nomBibli; cout << "Crée un bibliographie!" << endl; do { cout << "Nomme ta bibliographie:" << endl; std::getline(std::cin, nomBibli); } while (!nomBibli.empty()); Bibliographie bibli(nomBibli); bibli.ajouterReference(creerOuvrage()); bool recommencerOuvrage = false; do { try { recommencerOuvrage = false; bibli.ajouterReference(creerOuvrage()); } catch (ContratException e) { cout << "Tu dois recommencer" << endl; recommencerOuvrage = true; } } while (recommencerOuvrage); bibli.ajouterReference(creerJournal()); bool recommencerJournal = false; do { try { recommencerJournal = false; bibli.ajouterReference(creerJournal()); } catch (ContratException e) { cout << "Tu dois recommencer" << endl; recommencerJournal = true; } } while (recommencerJournal); cout << "Ta bibliographie:\n" << bibli.reqBibliographieFormate() << endl; cout << "Bye"; return 0; }
[ "Vinccool96@gmaiil.com" ]
Vinccool96@gmaiil.com
14fc3521f01984a940cbfc9b7255eb6593369324
185703f4b47fea7e8029bcdc28db23fb7bc314f3
/MIECCompiler/MiniIEC/Symbol.cpp
3f83e23464d2f51340e566133a383480a68b4671
[]
no_license
ReinhardWasHere/COM_3
3f3aa44d4ee940222a9c2c94c3e49807073b1466
64411ac2badea11702ab166161495cba879ca15c
refs/heads/master
2022-05-04T09:31:20.636753
2016-02-17T18:07:22
2016-02-17T18:07:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
415
cpp
#include "Symbol.h" Symbol::Symbol(std::string const& name, Type * type) : _name(name), _type(type) {} std::string Symbol::GetName() { return _name; } Type * Symbol::GetType() { return _type; } void Symbol::Print(std::ostream & ostream) { #ifdef _DEBUG ostream << "Class: Symbol" << std::endl; ostream << "Name: " << _name << std::endl; ostream << "Type: " << _type->GetTypeName() << std::endl; #endif }
[ "reinhard93@gmx.at" ]
reinhard93@gmx.at
0d4085089f111fed1c248ce2274248df525b84c6
0d2385a74908b604c1f37ead7dbbe4f87de31b7a
/src/net/tcp_server.cpp
6195636c1de40e3a711f07f20a6d2196142ca646
[]
no_license
0xBYTESHIFT/poker_backend
a780ca46b67144d27d79e6973813c58ef91099b3
b4ebb98e110cb13b3c5a072e37fcb5b706a7d812
refs/heads/master
2023-03-11T05:49:36.306979
2021-02-27T13:35:10
2021-02-27T13:35:10
334,289,079
0
0
null
2021-02-09T21:48:34
2021-01-29T23:46:37
C++
UTF-8
C++
false
false
1,454
cpp
#include "net/tcp_server.h" #include "components/api/api.h" #include "components/log.hpp" #include "tracy_include.h" #include <boost/bind.hpp> tcp_server::tcp_server(io_context_t& io_context, size_t port) : io_context_(io_context) , acceptor_(io_context, tcp::endpoint(tcp::v4(), port)) { ZoneScoped; start_accept(); this->handler_ = std::make_shared<mes_handler>(); } void tcp_server::start_accept() { ZoneScoped; auto lgr = get_logger(); auto prefix = "tcp_server::start_accept"; lgr.debug("{} waiting for connection", prefix); auto new_connection = tcp_connection::create(io_context_); auto func = boost::bind(&tcp_server::handle_accept, this, new_connection, boost::asio::placeholders::error); acceptor_.async_accept(new_connection->socket(), func); } void tcp_server::handle_accept(pointer_t new_connection, const ec_t& error) { ZoneScoped; auto lgr = get_logger(); auto prefix = "tcp_server::handle_accept"; api::connect_response resp; resp.code = 0; //ok; message msg = resp.to_json(); if (!error) { lgr.debug("{} new connection accepted", prefix); new_connection->deliver(msg); handler_->add_connection(new_connection); } else { lgr.error("{} error:{}", prefix, error.message()); } start_accept(); } auto tcp_server::get_mes_handler() const -> std::shared_ptr<mes_handler> { ZoneScoped; return this->handler_; }
[ "0xbyteshift@gmail.com" ]
0xbyteshift@gmail.com
3a7077da4a0b7707b05c85406a0418bee3d64bdb
3dc4ecd0b358c2d4135533e98ba1d03eeff2ed30
/ecclesia/lib/cache/rcu_snapshot_test.cc
747e6a19c701d8c5028248b2baf55a0861a906d2
[ "Apache-2.0" ]
permissive
qfc/ecclesia-machine-management
b40b2620b685b090e8df57671e93e15b891ec5fb
25cce1a5d54f3c4eea3b89603105dd1d4ed9434f
refs/heads/master
2022-12-14T20:28:39.123846
2020-09-11T16:36:33
2020-09-11T16:37:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,864
cc
/* * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "ecclesia/lib/cache/rcu_snapshot.h" #include <memory> #include <string> #include <vector> #include "gtest/gtest.h" #include "absl/memory/memory.h" namespace ecclesia { namespace { TEST(RcuSnapshot, CreateAndDestroyObject) { RcuSnapshot<int>::WithInvalidator object = RcuSnapshot<int>::Create(13); RcuSnapshot<int> &original = object.snapshot; auto copy = original; EXPECT_EQ(*original, 13); EXPECT_EQ(*copy, 13); } TEST(RcuSnapshot, InvalidateSnapshot) { RcuSnapshot<int>::WithInvalidator object = RcuSnapshot<int>::Create(31); RcuSnapshot<int> &original = object.snapshot; auto copy = original; EXPECT_TRUE(original.IsFresh()); EXPECT_TRUE(copy.IsFresh()); object.invalidator.InvalidateSnapshot(); EXPECT_FALSE(original.IsFresh()); EXPECT_FALSE(copy.IsFresh()); } TEST(RcuSnapshot, SimpleNotification) { RcuSnapshot<int>::WithInvalidator object = RcuSnapshot<int>::Create(37); RcuNotification notification; object.snapshot.RegisterNotification(notification); EXPECT_FALSE(notification.HasTriggered()); object.invalidator.InvalidateSnapshot(); EXPECT_TRUE(notification.HasTriggered()); } TEST(RcuSnapshot, NotificationTriggersImmediatelyOnInvalidSnapshot) { RcuSnapshot<int>::WithInvalidator object = RcuSnapshot<int>::Create(37); object.invalidator.InvalidateSnapshot(); RcuNotification notification; object.snapshot.RegisterNotification(notification); EXPECT_TRUE(notification.HasTriggered()); } TEST(RcuSnapshot, NotificationCanBeReset) { RcuSnapshot<int>::WithInvalidator object1 = RcuSnapshot<int>::Create(41); RcuSnapshot<int>::WithInvalidator object2 = RcuSnapshot<int>::Create(42); RcuNotification notification; object1.snapshot.RegisterNotification(notification); EXPECT_FALSE(notification.HasTriggered()); object1.invalidator.InvalidateSnapshot(); EXPECT_TRUE(notification.HasTriggered()); notification.Reset(); object2.snapshot.RegisterNotification(notification); EXPECT_FALSE(notification.HasTriggered()); object2.invalidator.InvalidateSnapshot(); EXPECT_TRUE(notification.HasTriggered()); } TEST(RcuSnapshot, NotificationCanBeRegisteredWithMultipleSnapshots) { RcuSnapshot<int>::WithInvalidator object1 = RcuSnapshot<int>::Create(43); RcuSnapshot<int>::WithInvalidator object2 = RcuSnapshot<int>::Create(44); RcuNotification notification; object1.snapshot.RegisterNotification(notification); object2.snapshot.RegisterNotification(notification); EXPECT_FALSE(notification.HasTriggered()); object2.invalidator.InvalidateSnapshot(); EXPECT_TRUE(notification.HasTriggered()); // Resetting the notification and then invalidating snapshot1 shouldn't do // anything because it should no longer be registered. notification.Reset(); EXPECT_FALSE(notification.HasTriggered()); object1.invalidator.InvalidateSnapshot(); EXPECT_FALSE(notification.HasTriggered()); } TEST(RcuSnapshot, NotificationCanBeUsedWithMultipleTypes) { RcuSnapshot<int>::WithInvalidator int_object = RcuSnapshot<int>::Create(59); RcuSnapshot<std::string>::WithInvalidator str_object = RcuSnapshot<std::string>::Create("abc"); RcuNotification notification; int_object.snapshot.RegisterNotification(notification); str_object.snapshot.RegisterNotification(notification); EXPECT_FALSE(notification.HasTriggered()); str_object.invalidator.InvalidateSnapshot(); EXPECT_TRUE(notification.HasTriggered()); } TEST(RcuSnapshot, DeleteNotificationBeforeSnapshot) { RcuSnapshot<int>::WithInvalidator object = RcuSnapshot<int>::Create(51); auto notification_ptr = absl::make_unique<RcuNotification>(); object.snapshot.RegisterNotification(*notification_ptr); notification_ptr = nullptr; } TEST(RcuSnapshot, DeleteSnapshotBeforeNotification) { RcuNotification notification; { RcuSnapshot<int>::WithInvalidator object = RcuSnapshot<int>::Create(53); object.snapshot.RegisterNotification(notification); object.invalidator.InvalidateSnapshot(); } } TEST(RcuSnapshot, DeleteSnapshotWithoutInvalidation) { RcuNotification notification; { RcuSnapshot<int>::WithInvalidator object = RcuSnapshot<int>::Create(53); object.snapshot.RegisterNotification(notification); } } TEST(RcuSnapshot, DependsOnSnapshots) { RcuSnapshot<int>::WithInvalidator s1 = RcuSnapshot<int>::Create(101); RcuSnapshot<std::string>::WithInvalidator s2 = RcuSnapshot<std::string>::Create("102"); RcuSnapshot<int>::WithInvalidator s3 = RcuSnapshot<int>::Create(103); RcuSnapshot<int>::WithInvalidator s4 = RcuSnapshot<int>::Create(104); std::vector<RcuSnapshot<int>> s3_and_4 = {s3.snapshot, s4.snapshot}; RcuSnapshot<int> dep = RcuSnapshot<int>::CreateDependent( RcuSnapshotDependsOn(s1.snapshot, s2.snapshot, s3_and_4), 410); RcuNotification notification; dep.RegisterNotification(notification); EXPECT_TRUE(dep.IsFresh()); EXPECT_FALSE(notification.HasTriggered()); s3.invalidator.InvalidateSnapshot(); EXPECT_FALSE(dep.IsFresh()); EXPECT_TRUE(notification.HasTriggered()); } TEST(RcuSnapshot, DependsOnStaleSnapshot) { RcuSnapshot<int>::WithInvalidator s1 = RcuSnapshot<int>::Create(101); RcuSnapshot<std::string> s2 = RcuSnapshot<std::string>::CreateStale("102"); RcuSnapshot<int> dep = RcuSnapshot<int>::CreateDependent( RcuSnapshotDependsOn(s1.snapshot, s2), 203); RcuNotification notification; dep.RegisterNotification(notification); EXPECT_FALSE(dep.IsFresh()); EXPECT_TRUE(notification.HasTriggered()); } TEST(RcuSnapshot, DependsOnSnapshotsWithMultipleNotifications) { RcuSnapshot<int>::WithInvalidator s1 = RcuSnapshot<int>::Create(123); RcuSnapshot<std::string>::WithInvalidator s2 = RcuSnapshot<std::string>::Create("456"); RcuSnapshot<int> dep = RcuSnapshot<int>::CreateDependent( RcuSnapshotDependsOn(s1.snapshot, s2.snapshot), 579); RcuNotification notification; dep.RegisterNotification(notification); EXPECT_TRUE(dep.IsFresh()); EXPECT_FALSE(notification.HasTriggered()); s1.invalidator.InvalidateSnapshot(); EXPECT_FALSE(dep.IsFresh()); EXPECT_TRUE(notification.HasTriggered()); s2.invalidator.InvalidateSnapshot(); EXPECT_FALSE(dep.IsFresh()); EXPECT_TRUE(notification.HasTriggered()); } } // namespace } // namespace ecclesia
[ "ecclesia-team@google.com" ]
ecclesia-team@google.com
d55e8f7bb2a469a1344c7ff587fa5c4f3d8b31b9
ff18d5236425e7aa0b46a9ce939c7cf28777fc4d
/WhispEngine/WhispEngine/ModuleScripting.h
12c07664dfb1679338f59c211132024a6105a3c0
[ "MIT" ]
permissive
Empty-Whisper/WhispEngine
04377a9da44cae87e4cd2f3aef2f4c0bf479cc14
f1f8412377db24569ea2e2db7118b0339a11e85d
refs/heads/master
2020-07-28T10:33:35.044397
2020-07-02T17:25:57
2020-07-02T17:25:57
209,391,424
12
5
MIT
2019-12-29T17:28:13
2019-09-18T19:48:14
C++
UTF-8
C++
false
false
852
h
#pragma once #include "Module.h" extern "C" { #include "Lua/Lua/include/lua.h" #include "Lua/Lua/include/lua.hpp" #include "Lua/Lua/include/lauxlib.h" } #include "Globals.h" class ModuleScripting : public Module { public: enum Functions { NONE = -1, START, PREUPDATE, UPDATE, POSTUPDATE, MAX }; public: ModuleScripting(); ~ModuleScripting(); bool Start() override; update_status PreUpdate() override; update_status Update() override; update_status PostUpdate() override; void ExecuteFunctionScript(const char* path, const char* name, Functions function); void ExecuteScript(const char* file); void LuaRegister() override; lua_State* GetState() const { return L; } private: lua_State* L = nullptr; static void Log(const char* s) { if (s != nullptr) { LOG(s); } else LOG("LUA FAILED: Message is nullptr"); } };
[ "christt105@gmail.com" ]
christt105@gmail.com
3762b9397ad1e4a29f0f0f68ab9106c02e14feb6
07c9e39247422eeb970e1b98ecb6988951a5d5e2
/WSEngine/include/core/Material.h
0555b9f17ed6cd496d46e81ddb6b30cbbf8be8ed
[ "MIT" ]
permissive
wingstone/WSEngine
a81d8009f1b1d91e63619339a08b1caab4f18beb
99eda0352fb481ab907fe7c14488f404d9f00212
refs/heads/master
2022-12-06T07:26:19.349488
2020-08-26T08:58:47
2020-08-26T08:58:47
282,385,255
0
0
null
null
null
null
UTF-8
C++
false
false
1,115
h
#ifndef MATERIAL_H #define MATERIAL_H #include <vector> #include <string> #include <glm/glm.hpp> #include "../core/Texture.h" #include "../core/RenderTexture.h" #include "../core/ShaderClass.h" #include "../component/Transform.h" #include "../component/Camera.h" #include "../component/Light.h" #include "LightSetting.h" using namespace std; using namespace glm; struct LightSetting; class Material { protected: ShaderClass *pshader; public: Material(ShaderClass *pshader) { this->pshader = pshader; } void ImportRenderSetting(Transform *transform, Camera *came, Light *light, LightSetting *lightSetting, RenderTexture *shaodwmap = nullptr); virtual void Render() = 0; }; class PBRMaterial : public Material { public: vector<Texture *> textures; vector<string> strings; Texture *shadowmap; vec4 diffuseColor; vec4 specularColor; float roughness; PBRMaterial(ShaderClass *pshader); void SetShadowMap(Texture *shadowmap); void Render(); }; class EmiMaterial : public Material { public: vec4 emissionColor; float intensity; EmiMaterial(ShaderClass *pshader); void Render(); }; #endif
[ "1812467051@qq.com" ]
1812467051@qq.com
5bd7db1dce4767b92d04a3541b62af1b49899ad1
b1241d14566231d89dd2a74da25f1229cae9c9f7
/RobotList.cpp
8d5159c8f200bbf381cbd062535a09938424b28e
[]
no_license
anesepark/Bot-O-Mat
11a378ed958bea28b2f45f40cf036448f37dbab2
f23a1d9e0123364baf951313838c6b416e1a34f5
refs/heads/master
2023-01-11T19:50:34.582337
2020-11-15T20:24:24
2020-11-15T20:24:24
312,929,582
0
0
null
null
null
null
UTF-8
C++
false
false
7,729
cpp
#include "RobotList.h" RobotList::RobotList() //create leaderboard { std::ifstream inFS; inFS.open("leaderboard.txt"); std::string line; if(inFS) //reading from leaderboard { std::string name, type; int points = 0; while (!inFS.eof()) { getline(inFS, line); if(line.empty()) break; if(line == "Overall Points:" || line == "By Category:") { continue; } name = line.substr(0, line.find(delimiter)); line.erase(0, line.find(delimiter)+2); type = line.substr(0, line.find(delimiter)); line.erase(0,line.find(delimiter) + 2); points = stoi(line); auto lead = std::make_tuple(name, type, points); leaders.push_back(lead); } //end of while inFS.close(); } else //if there is no file made that stores leaders, initialize leaderboard { leaders.push_back(std::make_tuple("n/a", "n/a", 0)); leaders.push_back(std::make_tuple("n/a", "unipedal", 0)); leaders.push_back(std::make_tuple("n/a", "bipedal", 0)); leaders.push_back(std::make_tuple("n/a", "quadrupedal", 0)); leaders.push_back(std::make_tuple("n/a", "arachnid", 0)); leaders.push_back(std::make_tuple("n/a", "radial", 0)); leaders.push_back(std::make_tuple("n/a", "aeronautical", 0)); } std::ifstream rblst; rblst.open("robots.txt"); std::string line2; if(rblst) //reading from saved robots { std::string name, robotType; while (!rblst.eof()) { getline(rblst, line2); if(line2.empty()) break; name = line2.substr(0, line2.find(delimiter)); line2.erase(0, line2.find(delimiter)+2); robotType = line2.substr(0, line2.find(delimiter)); Robot tempfriend(name, robotType); robots[name] = tempfriend; } //end of while rblst.close(); } } RobotList::~RobotList(){} bool RobotList::updateBoard(std::string name, std::string type, int points) //returns true/false to indicate whether there is a new highscore { bool updated = false; auto challenger = std::make_tuple(name, type, points); if(std::get<2>(leaders.at(0)) < points) //checking for overall points { leaders.at(0) = challenger; updated = true; } for(int i = 1; i < 7; i++) //checking each type of robot { if(std::get<2>(leaders.at(i)) < points && std::get<1>(leaders.at(i)) == type) { leaders.at(i) = challenger; updated = true; break; } } return updated; } void RobotList::printBoard() { std::cout << "Overall Points:\n"; std::cout << std::get<0>(leaders.at(0)) << ": " << std::get<1>(leaders.at(0)) << ": " << std::get<2>(leaders.at(0)) << "\n" ; std::cout << "By Category:\n"; for(int i = 1; i < 7; i++) { std::cout << std::get<0>(leaders.at(i))<< ": " << std::get<1>(leaders.at(i)) << ": " << std::get<2>(leaders.at(i)) << "\n"; } } void RobotList::saveBoard() { std::ofstream outFS; outFS.open("leaderboard.txt"); if(!outFS.is_open()) { std::cout << "Could not open file." << std::endl; return; } outFS << "Overall Points:\n"; outFS << std::get<0>(leaders.at(0)) << ": " << std::get<1>(leaders.at(0)) << ": " << std::get<2>(leaders.at(0)) << "\n" ; outFS << "By Category:\n"; for(int i = 1; i < 7; i++) { outFS << std::get<0>(leaders.at(i))<< ": " << std::get<1>(leaders.at(i)) << ": " << std::get<2>(leaders.at(i)) << "\n"; } outFS.close(); } void RobotList::saveRobots() { std::ofstream outFS; outFS.open("robots.txt"); if(!outFS.is_open()) { std::cout << "Could not open file." << std::endl; return; } for( auto rob : robots) { outFS << rob.second.getName() << ": " << rob.second.getType() << std::endl; } } void RobotList::changeName(std::string currentName, std::string newName) { if(robots.find(currentName) == robots.end()) //could not find the new name in list { Robot temp = robots[currentName]; robots.erase(currentName); robots[newName] = temp; robots[newName].setName(newName); } else { std::cout << "A robot with that name already exists." << std::endl; } } void RobotList::changeType(std::string currentName, std::string newType) { if(robots.find(currentName) != robots.end()) //if we found the robot { robots.at(currentName).setType(newType); //change type } else //did not find robot { std::cout << "Robot with the name " << currentName << " could not be found." << std::endl; } } void RobotList::addRobot(std::string name, std::string type) { if(robots.find(name) == robots.end()) //no robot with that name exists { std::cout << "Success! Robot with the name " << name << " and type " << type << " created." << std::endl; Robot newfriend(name, type); robots[name] = newfriend; } else //did not find robot { std::cout << "A robot with that name already exists." << std::endl; } } void RobotList::deleteRobot(std::string name) { if(robots.find(name) != robots.end()) //if we found the robot { robots.erase(name); } else { std::cout << "Robot with the name " << name << " could not be found." << std::endl; } } void RobotList::viewRobot(std::string name) { auto found = robots.find(name); if(found != robots.end()) //could not find robot { std::cout << "Name: " << robots[name].getName() << "\tType: " << robots[name].getType() << std::endl; } else { std::cout << "Robot with the name " << name << " could not be found." << std::endl; } } void RobotList::assignTasks(TaskList listOfTasks) { for(auto &rob : robots) { listOfTasks.getRandomTasks(rob.second.getTasks()); } } void RobotList::startJobs() //no specified time limit { for(auto rob : robots) { std::thread temp(RobotList::executeJobs, this, std::ref(robots[rob.second.getName()])); threads.emplace_back(move(temp)); } for (std::thread &t : threads) { t.join(); } for(auto rob : robots) //checks for a highscore { if(updateBoard(rob.second.getName(), rob.second.getType(), rob.second.getPoints())) std::cout << "New highscore from: " << rob.second.getName() << std::endl; } } void RobotList::startJobsTime(int specifiedTime) //Robots run with a specified time limit { for(auto &rob : robots) { std::thread temp(RobotList::executeJobsTime, this, specifiedTime, std::ref(robots[rob.second.getName()])); threads.emplace_back(move(temp)); } for (std::thread &t : threads) { t.join(); } for(auto rob : robots) { std::cout << "Name: " << rob.second.getName() << "\tPoints: " << rob.second.getPoints() << std::endl; if(updateBoard(rob.second.getName(), rob.second.getType(), rob.second.getPoints())) std::cout << "New highscore from: " << rob.second.getName() << std::endl; } } void RobotList::executeJobsTime(int specifiedTime, Robot rob) //thread function for specified time limit { robots[rob.getName()].startJob(specifiedTime); } void RobotList::executeJobs(Robot rob) //thread function without specified time limit { robots[rob.getName()].startJob(); } void RobotList::toString() { if(robots.size() == 0) { std::cout << "No robots currently in the list.\n"; return; } for (auto rob : robots) { std::cout << "Name: " << rob.second.getName() << "\tType: " << rob.second.getType() << std::endl; } } void RobotList::toStringPoints() //a toString, but prints out the points as well { for (auto rob : robots) { std::cout << "Name: " << rob.second.getName() << "\tType: " << rob.second.getType() << "\tPoints: " << rob.second.getPoints() << std::endl; } }
[ "aneseepark@gmail.com" ]
aneseepark@gmail.com
5210fe6d34597be357020f2c01472635af32a33f
6fa1ab5a12d94f6e7717ee5ee08e5ac5103733b9
/OTA.cpp
157e67cc673f19f93bebe10a45affcf4a3d17149
[]
no_license
fprumbau/SBMSEsp32
615f549cc2c38a1a67909a96cf3a83ff29b3908e
e15212bdb20ff5eb5c97255a723795a530c31d99
refs/heads/master
2023-05-02T09:05:14.527660
2023-04-29T08:26:50
2023-04-29T08:26:50
158,427,157
0
0
null
null
null
null
UTF-8
C++
false
false
7,366
cpp
#include <Update.h> #include "html.h" #include "global.h" //https://github.com/bbx10/WebServer_tng/issues/4 Anpassung ESP32 /** * - Wenn die Lader angeschaltet sind, aber der Ladestrom < 1A betr&auml;gt, k&ouml;nnen die L&uuml;fter abgeschaltet werden / bleiben */ void OTA::init(const char* host) { //OTA is possible only with 4mb memory long flashSize = ESP.getFlashChipSize(); Serial.print(F("Flash Size: ")); Serial.println(flashSize); if(flashSize > 4000000) { //set web UI MDNS.begin(host); MDNS.addService("http", "tcp", 80); Serial.printf("\n\nHTTPUpdateServer ready! Open http://%s.local/update in your browser\n", host); String _version = F("Build : "); _version += VERSION; updater.setUpdaterUi("Title", _version, "SBMS120 Solar Charger", "Branch : master", String(changelog)); //Optional: Authentifizieren //updater.setup("/update", "admin", "Go8319!"); updater.setup("/update", "", ""); } else { Serial.println(F("Flash OTA programming only possible with 4Mb Flash size!!!")); } } double calcSpeed(unsigned long ms, size_t len){ return (double)(len * 125) / (double)(ms * 16); } void OTA::setup(const char *path, String username, String password) { _username = username; _password = password; uint32_t t_start,t_stop; size_t fileSize; uint16_t ct = 0; // handler for the /update form page server.on(path, HTTP_GET, [&](AsyncWebServerRequest *request){ String pageIndex = String(update); pageIndex.replace("{title}",_title); pageIndex.replace("{banner}",_banner); pageIndex.replace("{build}",_build); pageIndex.replace("{branch}",_branch); pageIndex.replace("{deviceInfo}",_deviceInfo); pageIndex.replace("{footer}",_footer); AsyncWebServerResponse *response = request->beginResponse(200, "text/html", pageIndex); response->addHeader("Connection", "close"); response->addHeader("Access-Control-Allow-Origin", "*"); request->send(response); }); // handler for the /update form POST (once file upload finishes) server.on(path, HTTP_POST, [&](AsyncWebServerRequest *request){ // the request handler is triggered after the upload has finished... // create the response, add header, and send response String pageIndex = String(update); pageIndex.replace("{title}",_title); if(Update.hasError()){ pageIndex.replace(F("{banner}"),F("<b><font color=red>Update gescheitert</font></b>")); } else { pageIndex.replace(F("{banner}"),F("<b><font color=green>Update erfolgreich</font></b>")); pageIndex.replace(F("{redirect}"), F("redirect=true;")); } pageIndex.replace(F("{build}"),_build); pageIndex.replace(F("{branch}"),_branch); pageIndex.replace(F("{deviceInfo}"),_deviceInfo); pageIndex.replace(F("{footer}"),_footer); AsyncWebServerResponse *response = request->beginResponse(200, "text/html", pageIndex); response->addHeader(F("Connection"), F("close")); response->addHeader(F("Access-Control-Allow-Origin"), F("*")); request->send(response); },[&](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final){ //Upload handler chunks in data if(!index){ // if index == 0 then this is the first frame of data stopForOTA = true; //stoppt alle Aktionen im loop() yield(); delay(1500); //geht das hier?? unsicher!!!; 0.9.9.89: -1s udp.close(); //0.9.9.98 statt stop() Serial.printf("UploadStart: %s\n", filename.c_str()); Serial.setDebugOutput(true); t_start = millis(); fileSize = len; // calculate sketch space required for the update; 1048576 // 1248576 auf 1348576 erhoeht, 1.0.17 reverted uint32_t maxSketchSpace = (1248576 - 0x1000) & 0xFFFFF000; Serial.print(F("maxSketchSpace: ")); Serial.println(maxSketchSpace); if(!Update.begin(maxSketchSpace)){//start with max available size Update.printError(Serial); } //Update.runAsync(true); // tell the updaterClass to run in async mode (nicht da fuer ESP32) } else { ct++; if(ct%70==0) Serial.println(""); Serial.print("."); fileSize += len; } //Write chunked data to the free sketch space if(Update.write(data, len) != len){ Update.printError(Serial); } if(final){ // if the final flag is set then this is the last frame of data if(Update.end(true)){ //true to set the size to the current progress t_stop = millis(); Serial.print(F("\nTime UPLOAD: ")); Serial.print((t_stop - t_start) / 1000.0); Serial.println(F(" sec.")); Serial.print(F("Speed UPLOAD: ")); Serial.print(calcSpeed(t_stop - t_start, fileSize)); Serial.println(F(" Kbit/s")); Serial.printf("Upload Success, Rebooting: %u bytes\n", fileSize); restartRequired = true; // Tell the main loop to restart the ESP } else { Update.printError(Serial); } Serial.setDebugOutput(false); } }); //Hmmh not found, gehoert eigentlich nicht hier hin server.onNotFound([](AsyncWebServerRequest *request){ Serial.print(F("NOT_FOUND: ")); if(request->method() == HTTP_GET) Serial.print(F("GET")); else if(request->method() == HTTP_POST) Serial.print(F("POST")); else if(request->method() == HTTP_DELETE) Serial.print(F("DELETE")); else if(request->method() == HTTP_PUT) Serial.print(F("PUT")); else if(request->method() == HTTP_PATCH) Serial.print(F("PATCH")); else if(request->method() == HTTP_HEAD) Serial.print(F("HEAD")); else if(request->method() == HTTP_OPTIONS) Serial.println(F("OPTIONS")); else Serial.println(F("UNKNOWN")); Serial.printf(" http://%s%s\n", request->host().c_str(), request->url().c_str()); if(request->contentLength()){ Serial.printf("_CONTENT_TYPE: %s\n", request->contentType().c_str()); Serial.printf("_CONTENT_LENGTH: %u\n", request->contentLength()); } int headers = request->headers(); int i; for(i=0;i<headers;i++){ AsyncWebHeader* h = request->getHeader(i); Serial.printf("_HEADER[%s]: %s\n", h->name().c_str(), h->value().c_str()); } int params = request->params(); for(i=0;i<params;i++){ AsyncWebParameter* p = request->getParam(i); if(p->isFile()){ Serial.printf("_FILE[%s]: %s, size: %u\n", p->name().c_str(), p->value().c_str(), p->size()); } else if(p->isPost()){ Serial.printf("_POST[%s]: %s\n", p->name().c_str(), p->value().c_str()); } else { Serial.printf("_GET[%s]: %s\n", p->name().c_str(), p->value().c_str()); } } request->send(404); }); } void OTA::setUpdaterUi(String title,String banner,String build,String branch,String footer) { _title = title; _banner = banner; _build = build; _branch = branch; _deviceInfo = "ChipId : " + String(ESP.getChipRevision()); _footer = footer; }
[ "fprumbau@gmail.com" ]
fprumbau@gmail.com
245e9f9ea0395b71ba23781ee3b0eaba33306f8c
1634d4f09e2db354cf9befa24e5340ff092fd9db
/Wonderland/Wonderland/Editor/Modules/VulkanWrapper/Resource/Texture/VWTextureGroup.h
0f89a10c02eb9574e1651e8616dc2e951508a5d6
[ "MIT" ]
permissive
RodrigoHolztrattner/Wonderland
cd5a977bec96fda1851119a8de47b40b74bd85b7
ffb71d47c1725e7cd537e2d1380962b5dfdc3d75
refs/heads/master
2021-01-10T15:29:21.940124
2017-10-01T17:12:57
2017-10-01T17:12:57
84,469,251
4
1
null
null
null
null
UTF-8
C++
false
false
2,911
h
//////////////////////////////////////////////////////////////////////////////// // Filename: VWTextureGroup.h //////////////////////////////////////////////////////////////////////////////// #pragma once ////////////// // INCLUDES // ////////////// #define GLFW_INCLUDE_VULKAN #include <GLFW/glfw3.h> #include "..\..\..\NamespaceDefinitions.h" #include "..\..\Misc\VWDescriptorSetCreator.h" #include "..\..\..\Reference.h" #include "..\..\..\HashedString.h" #include "..\..\..\Hoard\Hoard.h" #include "..\VWImageArray.h" #include <vector> #include <map> #include <array> #include <list> #include <atomic> /////////////// // NAMESPACE // /////////////// ///////////// // DEFINES // ///////////// //////////// // GLOBAL // //////////// /////////////// // NAMESPACE // /////////////// // Just another graphic wrapper NamespaceBegin(VulkanWrapper) //////////////// // FORWARDING // //////////////// class VWContext; class VWTexture; class VWTextureGroupManager; //////////////// // STRUCTURES // //////////////// //////////////////////////////////////////////////////////////////////////////// // Class name: VWTextureGroup //////////////////////////////////////////////////////////////////////////////// class VWTextureGroup : public Hoard::Supply::Object { public: // Static const uint32_t TextureGroupBindingLocation = 0; static const uint32_t MaximumTexturePerGroup = 76; static const uint32_t MaximumTextureGroups = 1024; ////////////////// // CONSTRUCTORS // public: ////////// // Constructor / destructor VWTextureGroup(); ~VWTextureGroup(); ////////////////// // MAIN METHODS // public: ////////// // Create the descriptor set bool CreateDescriptorSet(VWContext* _graphicContext, VkDescriptorPool _descriptorPool, VkDescriptorSetLayout _descriptorSetLayout); // Process the internal resource bool ProcessResource(VWContext* _graphicContext); // Return the descriptor set VkDescriptorSet GetDescriptorSet() { return m_DescriptorSet; } // Return the total number of textures uint32_t GetTotalTextures() { return m_TextureNameMap.size(); } // Return the texture group identificator HashedStringIdentifier GetTextureGroupIdentificator() { return m_TextureGroupIdentificator; } // Check if this object is valid bool IsValid() override; protected: // Texture is a friend class friend VWTexture; // Find a texture inside this group uint32_t VWTextureGroup::FindTextureIndex(const char* _textureName); /////////////// // VARIABLES // private: ////// // The image object VWImageArray m_Image; // The texture group identificator HashedStringIdentifier m_TextureGroupIdentificator; // The group descriptor set VkDescriptorSet m_DescriptorSet; // The texture name map std::map<HashedStringIdentifier, uint32_t> m_TextureNameMap; }; typedef Reference::Blob<VWTextureGroup> VWTextureGroupReference; // Just another graphic wrapper NamespaceEnd(VulkanWrapper)
[ "rodrigoholztrattner@gmail.com" ]
rodrigoholztrattner@gmail.com
f7d16f9f7dba23bdf4d77ff58cf21011a7dd54d8
5128d73d075c9c30cf5a8f790a9409e96aed38fc
/source/Examples/LoggingDemo/main.cpp
d818b00460980c10b92e8b5fb73148751d686081
[ "MIT" ]
permissive
JayTwoLab/QSLogLib
4f11c89866721629e3a812ae57e136d982952fc5
215a016cafc7b21f008743f937c380cd17c98dac
refs/heads/master
2023-02-15T01:09:33.853833
2021-01-09T15:17:11
2021-01-09T15:17:11
130,447,226
2
0
null
null
null
null
UTF-8
C++
false
false
1,163
cpp
// // main.cpp // // LoggingDemo for QSLogLib #include <QtGlobal> #include <QCoreApplication> #include "QSLogLib/SLogLib.h" #include "QSLogLib/Devices/AbstractLoggingDevice.h" #include "QSLogLib/Devices/ConsoleLogger.h" #include "QSLogLib/Devices/FileLogger.h" #include "QSLogLib/Devices/UdpLogger.h" #include "QSLogLib/Formatters/AbstractFormatter.h" #include "QSLogLib/Formatters/DetailedFormatter.h" #include "QSLogLib/Formatters/ErrorFormatter.h" #include "QSLogLib/Formatters/InfoFormatter.h" #include "QSLogLib/Formatters/NullFormatter.h" int main(int argc, char *argv[]) { QCoreApplication mainApp(argc, argv); // Add these lines at the beginning of your program. // The devices and formatters are automatically deleted by SLogLib. using namespace QSLogLib; addLoggingDevice( new ConsoleLogger(new NullFormatter) ); addLoggingDevice( new FileLogger("foo.log", new DetailedFormatter) ); // The following line writes the message to both console and file. int a = 10; double b = 15.3; const char* c = "Success"; SLOGLIB_LOG_MSG_INFO("a = " << a << " b = " << b); SLOGLIB_LOG_MSG_INFO(c); return 0; }
[ "j2doll@gmail.com" ]
j2doll@gmail.com
313aa2a02fda269b68aad2f48229cb2d91b80756
19ce9231adbcd40cabd7caf0614e436c97edc1b5
/Ring.h
4d202600d9f3130049a63457bbe84d4369537de1
[]
no_license
arms22/blynk_motor_controller
e962b888a05270e85a2b20ceeb21b4fc1b8cbfc5
4ccae06184118fb9a450a76033d691d28fbfa58f
refs/heads/master
2021-01-22T19:21:47.964824
2017-03-16T12:15:42
2017-03-16T12:15:42
85,192,231
0
0
null
null
null
null
UTF-8
C++
false
false
574
h
#ifndef __RING__ #define __RING__ template<typename T, int LENGTH> class Ring { public: Ring() { _wp = _rp = 0; } void put(const T &dat) { int n = (_wp + 1) & (LENGTH - 1); if (n != _rp) { _buffer[_wp] = dat; _wp = n; } } T& get() { T &dat = _buffer[_rp]; if (_wp != _rp) { _rp = (_rp + 1) & (LENGTH - 1); } return dat; } int count() { return (_wp + LENGTH - _rp) & (LENGTH - 1); } private: int _wp, _rp; T _buffer[LENGTH]; }; #endif
[ "arms22@gmail.com" ]
arms22@gmail.com
baabd9c44a9622f07a087468b27d153b29b499ac
d6f4fe10f2b06486f166e8610a59f668c7a41186
/Modules/vtkDTMRI/cxx/vtkImageExtractSlices.cxx
918eeb0b2b5166599aebb79d8e968f89479b3141
[]
no_license
nagyistge/slicer2-nohistory
8a765097be776cbaa4ed1a4dbc297b12b0f8490e
2e3a0018010bf5ce9416aed5b5554868b24e9295
refs/heads/master
2021-01-18T10:55:51.892791
2011-02-23T16:49:01
2011-02-23T16:49:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
16,231
cxx
/*=auto========================================================================= Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved. See Doc/copyright/copyright.txt or http://www.slicer.org/copyright/copyright.txt for details. Program: 3D Slicer Module: $RCSfile: vtkImageExtractSlices.cxx,v $ Date: $Date: 2006/01/13 16:44:43 $ Version: $Revision: 1.11 $ =========================================================================auto=*/ #include "vtkImageExtractSlices.h" #include "vtkObjectFactory.h" #include "vtkImageData.h" //---------------------------------------------------------------------------- vtkImageExtractSlices* vtkImageExtractSlices::New() { // First try to create the object from the vtkObjectFactory vtkObject* ret = vtkObjectFactory::CreateInstance("vtkImageExtractSlices"); if(ret) { return (vtkImageExtractSlices*)ret; } // If the factory was unable to create the object, then create it here. return new vtkImageExtractSlices; } //---------------------------------------------------------------------------- vtkImageExtractSlices::vtkImageExtractSlices() { // default settings amount to a copy of the data this->SliceOffset = 0; this->SlicePeriod = 1; this->Mode = 0; this->NumberOfRepetitions = 1; this->Repetition = 1; this->AverageRepetitions = 1; } //---------------------------------------------------------------------------- void vtkImageExtractSlices::PrintSelf(ostream& os, vtkIndent indent) { vtkImageToImageFilter::PrintSelf(os,indent); os << indent << "SliceOffset: "<< this->SliceOffset<<endl; os << indent << "SlicePeriod: "<< this->SlicePeriod<<endl; if (this->Mode == MODESLICE) os << indent << "Mode to Slice "<<endl; else if (this-> Mode == MODEVOLUME) os << indent << "Mode to Volume "<<endl; else { os << indent << "Mode to Mosaic "<<endl; os << indent << "Number of Mosaic Slices: "<< this->MosaicSlices<<endl; os << indent << "Number of Mosaic Tiles: "<< this->MosaicTiles<<endl; } } //---------------------------------------------------------------------------- void vtkImageExtractSlices::ExecuteInformation(vtkImageData *input, vtkImageData *output) { int *inExt, outExt[6], totalInSlices; vtkDebugMacro("in Execute Information"); if (input == NULL) { vtkErrorMacro("No input"); return; } inExt = input->GetWholeExtent(); memcpy(outExt, inExt, 6 * sizeof (int)); //Check that number of repetitions is a multipler of number of slices. totalInSlices = inExt[5]-inExt[4]+1; if(fmod((float)totalInSlices,(float)this->NumberOfRepetitions)!= 0) { vtkErrorMacro("Number of repetition is not a multipler of the total number of slices"); return; } vtkDebugMacro("Before assigning info"); // change output extent to reflect the // total number of slices we will output, // given the entire input dataset if (this->Mode == MODESLICE) { totalInSlices = (inExt[5] - inExt[4] + 1)/this->NumberOfRepetitions; outExt[5] = outExt[4] + ((totalInSlices-1)-this->SliceOffset)/this->SlicePeriod; vtkDebugMacro("setting out ext to " << outExt[5]); output->SetWholeExtent(outExt); } if(this->Mode == MODEVOLUME) { totalInSlices = (inExt[5] - inExt[4] + 1)/this->NumberOfRepetitions; if(fmod((float)totalInSlices,(float)this->SlicePeriod)!=0) { vtkErrorMacro("We cannot run. Number of slices do not complete volume"); return; } outExt[5] = outExt[4] - 1 + totalInSlices/this->SlicePeriod; vtkDebugMacro("setting out ext to " << outExt[5]); output->SetWholeExtent(outExt); } if(this->Mode == MODEMOSAIC) { outExt[0] = 0; totalInSlices = (inExt[1] - inExt[0] + 1); if(fmod((float)totalInSlices,(float)this->MosaicTiles)!=0) { vtkErrorMacro("Too few or too many tiles per slice."); return; } outExt[1] = outExt[0] + totalInSlices/this->MosaicTiles - 1; vtkDebugMacro("outExt1: "<<outExt[1]); outExt[2] = 0; totalInSlices = (inExt[3] - inExt[2] + 1); if(fmod((float)totalInSlices,(float)this->MosaicTiles)!=0) { vtkErrorMacro("Too few or too many tiles per slice."); return; } outExt[3] = outExt[2] + totalInSlices/this->MosaicTiles - 1; vtkDebugMacro("outExt3: "<<outExt[1]); outExt[4] = 0; outExt[5] = this->MosaicSlices-1; output->SetWholeExtent(outExt); } } void vtkImageExtractSlices::ComputeInputUpdateExtent(int inExt[6], int outExt[6]) { int totalOutSlices; // set the input to the extent we need to look at // to calculate the requested output. // init to the whole extent this->GetInput()->GetWholeExtent(inExt); //If there is more than 1 repetition, request the whole input. if(this->NumberOfRepetitions == 1) { if (this->Mode == MODESLICE) { // change input extent to just be what is needed to // generate the currently requested output // where do we start in the input? inExt[4] = (outExt[4]*this->SlicePeriod) + this->SliceOffset; // how far do we go? totalOutSlices = (outExt[5] - outExt[4] + 1); // num periods is out slices - 1 inExt[5] = inExt[4] + (totalOutSlices-1)*this->SlicePeriod; } //cout << "in ext is " << inExt[4] << " " << inExt[5] << endl; } } //---------------------------------------------------------------------------- // This templated function executes the filter for any type of data. template <class T> static void vtkImageExtractSlicesExecute1(vtkImageExtractSlices *self, vtkImageData *inData, T * inPtr, int inExt[6], vtkImageData *outData, T * outPtr, int outExt[6]) { int idxX, idxY, idxZ; int idxRep; int maxX, maxY, maxZ; int inmaxX,inmaxY,inmaxZ; int inIncX, inIncY, inIncZ; int outIncX, outIncY, outIncZ; int initZ, finalZ; unsigned long count = 0; unsigned long target; int slice, outslice, extract, period, offset ; int numrep,rep,avrep; int sliceSize; int numSlices; int numSlicesperRep; // find the region to loop over: loop over entire input // and generate a (possibly) smaller output inmaxX = inExt[1] - inExt[0]; inmaxY = inExt[3] - inExt[2]; inmaxZ = inExt[5] - inExt[4]; // find the region to loop over: loop over entire output maxX = outExt[1] - outExt[0]; maxY = outExt[3] - outExt[2]; maxZ = outExt[5] - outExt[4]; target = (unsigned long)(outData->GetNumberOfScalarComponents()* (maxZ+1)*(maxY+1)/50.0); target++; // Get increments to march through image data inData->GetContinuousIncrements(inExt, inIncX, inIncY, inIncZ); outData->GetContinuousIncrements(outExt, outIncX, outIncY, outIncZ); // information for extracting the slices period = self->GetSlicePeriod(); offset = self->GetSliceOffset(); numrep = self->GetNumberOfRepetitions(); rep = self->GetRepetition(); avrep = self->GetAverageRepetitions(); // size of a whole slice for skipping sliceSize = (inmaxX+1)*(inmaxY+1); numSlices = ((inmaxZ + 1)/period)/numrep; numSlicesperRep = (inmaxZ + 1)/numrep; T* initOutPtr = outPtr; int initrep; int finalrep; //Set Initial repetition and final repetition to loop through if (avrep) { initrep = 0; finalrep = numrep; } else { initrep = rep; finalrep = rep+1; } for (idxZ = 0 ; idxZ <= maxZ ; idxZ++) { for (idxY= 0; idxY <= maxY ; idxY++) { for (idxX=0 ; idxX <=maxX ; idxX++) { *outPtr=0; outPtr++; } outPtr += outIncY; } outPtr += outIncZ; } for (idxRep = initrep ; idxRep < finalrep ; idxRep++) { //Init output pointer outPtr = initOutPtr; initZ = idxRep*numSlicesperRep; finalZ = initZ+numSlicesperRep-1; for (idxZ = initZ; idxZ <= finalZ; idxZ++) { // either extract this slice from the input, or skip it. slice = inExt[4] + idxZ; /* //Check first if slice is in the repetition we want to extract. //If we want to average across repetitions, then set extract to 1. if (avrep) extract = 1; else extract = (((int) floor((float)(slice/numSlices)/period)) == rep); */ if (self->GetMode() == MODESLICE) { extract = (fmod((float)slice,(float)period) == offset); //Check slice is in the limits of outExt[5]-outExt[4] outslice = (int)floor((float)slice/period); if(outslice>=outExt[4] && outslice<=outExt[5]) extract = extract && 1; else extract = 0; } else { extract = ((int)((slice - idxRep*numSlicesperRep)/numSlices) == offset); outslice = (int) fmod((float)(slice- idxRep*numSlicesperRep),(float) numSlices); if(outslice>=outExt[4] && outslice<=outExt[5]) extract = extract && 1; else extract = 0; } //cout <<"slice " << slice << " grab " << extract << endl; if (extract) { // copy desired slices to output for (idxY = 0; !self->AbortExecute && idxY <= maxY; idxY++) { if (!(count%target)) { self->UpdateProgress(count/(50.0*target) + (maxZ+1)*(maxY+1)); } count++; for (idxX = 0; idxX <= maxX; idxX++) { // Pixel operation *outPtr = *inPtr+*outPtr; inPtr++; outPtr++; } outPtr += outIncY; inPtr += inIncY; } } else { // just increment the pointer and skip the slice inPtr+=sliceSize; } outPtr += outIncZ; inPtr += inIncZ; } //Do not increment outPtr, we are in a repetition inPtr +=inIncZ; } //Divide by the number of repetition if (numrep>1) { outPtr = initOutPtr; for (idxZ = 0 ; idxZ <= maxZ ; idxZ++) { for (idxY= 0; idxY <= maxY ; idxY++) { for (idxX=0 ; idxX <=maxX ; idxX++) { *outPtr/=numrep; outPtr++; } outPtr += outIncY; } outPtr += outIncZ; } } } //---------------------------------------------------------------------------- // This templated function executes the filter for any type of data. template <class T> static void vtkImageExtractSlicesExecute2(vtkImageExtractSlices *self, vtkImageData *inData, T * inPtr, int inExt[6], vtkImageData *outData, T * outPtr, int outExt[6]) { int idxX, idxY, idxZ; int idxRep; int maxX, maxY, maxZ; int dimX, dimY; int inIncY, inIncZ; int outIncX, outIncY, outIncZ; unsigned long count = 0; unsigned long target; int period, offset, tiles ; int numrep,rep,avrep; // information for extracting the slices period = self->GetSlicePeriod(); offset = self->GetSliceOffset(); //z-slice tiles = self->GetMosaicTiles(); numrep = self->GetNumberOfRepetitions(); rep = self->GetRepetition(); avrep = self->GetAverageRepetitions(); // find the region to loop over: loop over entire output maxX = outExt[1] - outExt[0]; maxY = outExt[3] - outExt[2]; maxZ = outExt[5] - outExt[4]; int *outWholeExt = outData->GetWholeExtent(); dimX = outWholeExt[1] - outWholeExt[0] + 1; dimY = outWholeExt[3] - outWholeExt[2] + 1; target = (unsigned long)(outData->GetNumberOfScalarComponents()* (maxZ+1)*(maxY+1)/50.0); target++; // Get increments to march through image data inExt[4] = offset; inExt[5] = offset; //inData->GetContinuousIncrements(inExt, inIncX, inIncY, inIncZ); //Compute increments in an special way inIncY= dimX * (tiles-1); outData->GetContinuousIncrements(outExt, outIncX, outIncY, outIncZ); T* initPtr = (T *)inData->GetScalarPointerForExtent(inExt); int nc; int nr; T* initOutPtr = outPtr; int initrep; int finalrep; //Set Initial repetition and final repetition to loop through if (avrep) { initrep = 0; finalrep = numrep; } else { initrep = rep; finalrep = rep+1; } // Init output to zero for (idxZ = 0 ; idxZ <= maxZ ; idxZ++) { for (idxY= 0; idxY <= maxY ; idxY++) { for (idxX=0 ; idxX <=maxX ; idxX++) { *outPtr=0; outPtr++; } outPtr += outIncY; } outPtr += outIncZ; } //Loop throughout output data for (idxRep = initrep ; idxRep < finalrep ; idxRep++) { //Init output pointer outPtr = initOutPtr; for (idxZ = 0; idxZ <= maxZ; idxZ++) { //Initialize pointer to input data for each output slice nc = int (fmod((float)(outExt[4]+idxZ),(float)tiles)); nr = int (floor((float)((tiles*tiles-1-outExt[4]-idxZ)/tiles))); inIncZ = nc * dimX + nr * dimX*tiles* dimY; inPtr = initPtr+ inIncZ*(idxRep+1) +outExt[0] + inIncY*outExt[2]; //cout<<"idxZ: "<<idxZ<<" nc: "<<nc<<" nr: "<<nr<<" inIncZ:"<<inIncZ<<endl; for (idxY = 0; !self->AbortExecute && idxY <= maxY; idxY++) { if (!(count%target)) { self->UpdateProgress(count/(50.0*target) + (maxZ+1)*(maxY+1)); } count++; for (idxX = 0; idxX <= maxX; idxX++) { // Pixel operation *outPtr = *inPtr; inPtr++; outPtr++; } outPtr += outIncY; inPtr += inIncY; } outPtr += outIncZ; } } //Divide by the number of repetition if (numrep>1) { outPtr = initOutPtr; for (idxZ = 0 ; idxZ <= maxZ ; idxZ++) { for (idxY= 0; idxY <= maxY ; idxY++) { for (idxX=0 ; idxX <=maxX ; idxX++) { *outPtr/=numrep; outPtr++; } outPtr += outIncY; } outPtr += outIncZ; } } } //---------------------------------------------------------------------------- // This method is passed a input and output regions, and executes the filter // algorithm to fill the output from the inputs. // It just executes a switch statement to call the correct function for // the regions data types. void vtkImageExtractSlices::ThreadedExecute(vtkImageData *inData, vtkImageData *outData, int outExt[6], int id) { int inExt[6]; vtkDebugMacro("in threaded execute"); inData->GetExtent(inExt); void *inPtr = inData->GetScalarPointerForExtent(inExt); void *outPtr = outData->GetScalarPointerForExtent(outExt); // this filter expects 1 scalar component input if (inData->GetNumberOfScalarComponents() != 1) { vtkErrorMacro(<< "Execute: input has " << inData->GetNumberOfScalarComponents() << " instead of 1 scalar component"); return; } // this filter expects that input is the same type as output. if (inData->GetScalarType() != outData->GetScalarType()) { vtkErrorMacro(<< "Execute: input ScalarType (" << inData->GetScalarType() << "), must match output ScalarType (" << outData->GetScalarType() << ")"); return; } // call Execute method if (this->Mode == MODEMOSAIC) { switch (inData->GetScalarType()) { vtkTemplateMacro7(vtkImageExtractSlicesExecute2, this, inData, (VTK_TT *)(inPtr), inExt, outData, (VTK_TT *)(outPtr), outExt); default: vtkErrorMacro(<< "Execute: Unknown ScalarType"); return; } } else { switch (inData->GetScalarType()) { vtkTemplateMacro7(vtkImageExtractSlicesExecute1, this, inData, (VTK_TT *)(inPtr), inExt, outData, (VTK_TT *)(outPtr), outExt); default: vtkErrorMacro(<< "Execute: Unknown ScalarType"); return; } } }
[ "pieper@bwh.harvard.edu" ]
pieper@bwh.harvard.edu
4555c9bb3072ec685bac4b19110bc59ed236893f
cbd3aa8b1583f0e25f12b0e9932f78f2b19b4acb
/nbc/nbc_ta/nbc_ta_srv2_state.cpp
dfdb4cccaac67ef49f23e0a3a846f9017c4385bd
[ "Apache-2.0" ]
permissive
iihiro/NB-Classify
53ba43a41460e47b27603da86de8e758d4208110
d3772a4ab1d572b15d5358309290eca6a33ec854
refs/heads/master
2020-07-06T16:22:57.050389
2020-01-24T03:06:13
2020-01-24T03:06:13
203,078,650
0
0
Apache-2.0
2020-01-21T03:43:16
2019-08-19T01:45:38
C++
UTF-8
C++
false
false
3,989
cpp
/* * Copyright 2018 Yamana Laboratory, Waseda University * Supported by JST CREST Grant Number JPMJCR1503, Japan. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE‐2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stdsc/stdsc_state.hpp> #include <stdsc/stdsc_log.hpp> #include <nbc_ta/nbc_ta_srv2_state.hpp> namespace nbc_ta { namespace srv2 { struct StateReady::Impl { Impl(void) { } void set(stdsc::StateContext& sc, uint64_t event) { STDSC_LOG_TRACE("StateReady: event#%lu", event); switch (static_cast<Event_t>(event)) { case kEventSessionCreate: sc.next_state(StateSessionCreated::create()); break; default: break; } } }; struct StateSessionCreated::Impl { Impl() { } void set(stdsc::StateContext& sc, uint64_t event) { STDSC_LOG_TRACE("SessionCreated: event#%lu", event); switch (static_cast<Event_t>(event)) { case kEventBeginRequest: sc.next_state(StateComputable::create()); break; default: break; } } }; struct StateComputable::Impl { Impl(void) { } void set(stdsc::StateContext& sc, uint64_t event) { STDSC_LOG_TRACE("StateComputable: event#%lu", event); switch (static_cast<Event_t>(event)) { case kEventComputeRequest: sc.next_state(StateComputing::create()); break; case kEventEndRequest: sc.next_state(StateSessionCreated::create()); break; default: break; } } }; struct StateComputing::Impl { Impl(void) { } void set(stdsc::StateContext& sc, uint64_t event) { STDSC_LOG_TRACE("StateComputing(%lu): event#%lu", event); switch (static_cast<Event_t>(event)) { case kEventBeginRequest: sc.next_state(StateComputable::create()); break; case kEventEndRequest: sc.next_state(StateSessionCreated::create()); break; default: break; } } }; // Ready std::shared_ptr<stdsc::State> StateReady::create(void) { return std::shared_ptr<stdsc::State>(new StateReady()); } StateReady::StateReady(void) : pimpl_(new Impl()) { } void StateReady::set(stdsc::StateContext& sc, uint64_t event) { pimpl_->set(sc, event); } // SessionCreated std::shared_ptr<stdsc::State> StateSessionCreated::create(void) { return std::shared_ptr<stdsc::State>(new StateSessionCreated()); } StateSessionCreated::StateSessionCreated(void) : pimpl_(new Impl()) { } void StateSessionCreated::set(stdsc::StateContext& sc, uint64_t event) { pimpl_->set(sc, event); } // Computable std::shared_ptr<stdsc::State> StateComputable::create() { return std::shared_ptr<stdsc::State>(new StateComputable()); } StateComputable::StateComputable(void) : pimpl_(new Impl()) { } void StateComputable::set(stdsc::StateContext& sc, uint64_t event) { pimpl_->set(sc, event); } // Computing std::shared_ptr<stdsc::State> StateComputing::create() { return std::shared_ptr<stdsc::State>(new StateComputing()); } StateComputing::StateComputing(void) : pimpl_(new Impl()) { } void StateComputing::set(stdsc::StateContext& sc, uint64_t event) { pimpl_->set(sc, event); } } /* srv2 */ } /* nbc_ta */
[ "iizuka@eduam.co.jp" ]
iizuka@eduam.co.jp
7d6820e163a1cb4f8ce93f27f79411bd4513af53
776426915cb19273095dc9d8ad583d6847add5d4
/chefchr.cpp
41978ae988dca40e2a8dde26af3ab2401a196c92
[]
no_license
imharsh94/ALGO-DS
28832c9f843ee5a22463557c3493976399ad33cc
b9c131a2248c86da10f8df23606fdaef509c2d10
refs/heads/master
2020-08-11T21:22:37.082594
2019-10-12T10:37:32
2019-10-12T10:37:32
214,629,394
0
0
null
null
null
null
UTF-8
C++
false
false
570
cpp
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { string st; cin>>st; int ans=0,c=0; int s[4]={0}; for(int i=0; i<st.length(); i++) { for (int j = i; j < i+4; j++) { if(st[j] == 'c') s[0] = 1; if(st[j] == 'h') s[1] = 1; if(st[j] == 'e') s[2] = 1; if(st[j] == 'f') s[3] = 1; } for(int i=0 ; i<4 ; i++) { if(s[i] == 1) c++; s[i] = 0; } if(c==4) ans++; c = 0; } if(ans == 0) cout<<"normal"<<'\n'; else cout<<"lovely "<<ans<<'\n'; } return 0; }
[ "vardhan.harsh94@gmail.com" ]
vardhan.harsh94@gmail.com
de31900537e3345a8758429c1b095dd4df73901f
56825fcc0d7c55dbffcb325b254996340863b894
/generic/uva10038.cpp
487f2628018e6169e70cb9d9846ab963560998b2
[]
no_license
matheusrotta7/uva_onlinejudge_files
49589a356062d493ee2c8b71c268d0ad39072931
69ef715daf08b6145111621c5e544127cabb1a9b
refs/heads/master
2020-05-27T13:22:40.327968
2019-05-26T04:00:53
2019-05-26T04:00:53
188,637,773
0
0
null
null
null
null
UTF-8
C++
false
false
671
cpp
#include <bits/stdc++.h> using namespace std; int main() { bool verify[3001]; int n; while (scanf("%d", &n) != EOF) { int a, b; cin >> a; bool jolly = true; for (int i = 1; i < n; i++) { verify[i] = false; } for (int i = 1; i < n; i++) { cin >> b; int dif = abs(a-b); if (dif >= 1 && dif <= n-1 && verify[dif] == false) { verify[dif] = true; } else { jolly = false; } a = b; } if (jolly) cout << "Jolly\n"; else cout << "Not jolly\n"; } return 0; }
[ "matheusrotta7@gmail.com" ]
matheusrotta7@gmail.com
0b956e8f0ad02b108d85e9717470f04c076f7caa
c74e77aed37c97ad459a876720e4e2848bb75d60
/100-199/159/(28567530)[OK]A[ b'Friends or Not' ].cpp
7663aea04374b614a2582abedfcf7f2ce66d106a
[]
no_license
yashar-sb-sb/my-codeforces-submissions
aebecf4e906a955f066db43cb97b478d218a720e
a044fccb2e2b2411a4fbd40c3788df2487c5e747
refs/heads/master
2021-01-21T21:06:06.327357
2017-11-14T21:20:28
2017-11-14T21:28:39
98,517,002
1
1
null
null
null
null
UTF-8
C++
false
false
767
cpp
#include<bits/stdc++.h> using namespace std; typedef long long LL; typedef unsigned long long uLL; typedef long double ldb; typedef pair<int,int> pii; int T[1000]; string s[1000]; string t[1000]; int main() { ios_base::sync_with_stdio(0);cin.tie(0); int n, d; cin>>n>>d; for(int i = 0; i < n; ++i) cin>>s[i]>>t[i]>>T[i]; set<vector<string>> ans; for(int i = 0; i < n; ++i) { for(int j = i+1; j < n; ++j) { if(s[i] == t[j] && t[i] == s[j] && abs(T[i]-T[j])<=d && T[i] != T[j] && s[i] != s[j]) { ans.insert({min(s[i],s[j]), max(s[i],s[j])}); } } } cout<<ans.size()<<'\n'; for(auto i:ans) cout<<i[0]<<' '<<i[1]<<'\n'; return 0; }
[ "yashar_sb_sb@yahoo.com" ]
yashar_sb_sb@yahoo.com
189042fbfbdbbb4d3c801a17ac97ab47c57d010e
c953bfcab932ce04df2e68f5df243fc1a58105b2
/Cpp_StarCraft_Imitation_Project/Cpp_StarCraft_Imitation_ProjectView.cpp
3c26d768d434edc51d0d08a457f01188b5c0f932
[]
no_license
GaeTaeng/Cpp_StarCraft_Imitation_Project
91e0d1d8dc595a005ad9c24de8ea74df7de03d2e
b708cfe7451f6cf6610d59605824a04e77752f32
refs/heads/master
2022-11-16T13:46:54.692836
2022-11-12T23:44:36
2022-11-12T23:44:36
217,224,015
0
0
null
null
null
null
UHC
C++
false
false
4,928
cpp
// Cpp_StarCraft_Imitation_ProjectView.cpp : CCpp_StarCraft_Imitation_ProjectView 클래스의 구현 // #include "stdafx.h" // SHARED_HANDLERS는 미리 보기, 축소판 그림 및 검색 필터 처리기를 구현하는 ATL 프로젝트에서 정의할 수 있으며 // 해당 프로젝트와 문서 코드를 공유하도록 해 줍니다. #ifndef SHARED_HANDLERS #include "Cpp_StarCraft_Imitation_Project.h" #endif #include "Cpp_StarCraft_Imitation_ProjectDoc.h" #include "Cpp_StarCraft_Imitation_ProjectView.h" //CObj이하 내용 include #include "Obj.h" #include "MainGame.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CCpp_StarCraft_Imitation_ProjectView IMPLEMENT_DYNCREATE(CCpp_StarCraft_Imitation_ProjectView, CView) BEGIN_MESSAGE_MAP(CCpp_StarCraft_Imitation_ProjectView, CView) ON_WM_CREATE() ON_WM_KEYUP() ON_WM_DESTROY() ON_WM_RBUTTONDOWN() ON_WM_KEYDOWN() END_MESSAGE_MAP() // CCpp_StarCraft_Imitation_ProjectView 생성/소멸 CCpp_StarCraft_Imitation_ProjectView::CCpp_StarCraft_Imitation_ProjectView() { // TODO: 여기에 생성 코드를 추가합니다. } CCpp_StarCraft_Imitation_ProjectView::~CCpp_StarCraft_Imitation_ProjectView() { } BOOL CCpp_StarCraft_Imitation_ProjectView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: CREATESTRUCT cs를 수정하여 여기에서 // Window 클래스 또는 스타일을 수정합니다. return CView::PreCreateWindow(cs); } // CCpp_StarCraft_Imitation_ProjectView 그리기 void CCpp_StarCraft_Imitation_ProjectView::OnDraw(CDC* pDC) { pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; pInstance = CMainGame::getInstance(); //Main으로 돌릴 곳 SingleTurn Pattern 으로 DWORD dwTime = GetTickCount(); //printf("dwTime :: %ld\n", dwTime); //printf(" GetTickCount :: %ld\n", GetTickCount()); //if(dwTime < GetTickCount()) { pInstance->Render(pDC); Invalidate(); //} //printf("dwTime :: %ld\n", dwTime); // TODO: 여기에 원시 데이터에 대한 그리기 코드를 추가합니다. } // CCpp_StarCraft_Imitation_ProjectView 진단 #ifdef _DEBUG void CCpp_StarCraft_Imitation_ProjectView::AssertValid() const { CView::AssertValid(); } void CCpp_StarCraft_Imitation_ProjectView::Dump(CDumpContext& dc) const { CView::Dump(dc); } CCpp_StarCraft_Imitation_ProjectDoc* CCpp_StarCraft_Imitation_ProjectView::GetDocument() const // 디버그되지 않은 버전은 인라인으로 지정됩니다. { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCpp_StarCraft_Imitation_ProjectDoc))); return (CCpp_StarCraft_Imitation_ProjectDoc*)m_pDocument; } #endif //_DEBUG // CCpp_StarCraft_Imitation_ProjectView 메시지 처리기 int CCpp_StarCraft_Imitation_ProjectView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CView::OnCreate(lpCreateStruct) == -1) return -1; // TODO: 여기에 특수화된 작성 코드를 추가합니다. return 0; } void CCpp_StarCraft_Imitation_ProjectView::OnDestroy() { CView::OnDestroy(); AfxGetMainWnd()->PostMessageW(WM_COMMAND, ID_APP_EXIT, 0); // TODO: 여기에 메시지 처리기 코드를 추가합니다. } void CCpp_StarCraft_Imitation_ProjectView::OnRButtonDown(UINT nFlags, CPoint point) { // TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다. pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; for(list<CObj*>::iterator iter = pDoc->li_DragObj.begin(); iter != pDoc->li_DragObj.end(); ++iter) { (*iter)->to_move(point); } Invalidate(); CView::OnRButtonDown(nFlags, point); } void CCpp_StarCraft_Imitation_ProjectView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags) { // TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다. if(nChar == VK_ESCAPE) { PostQuitMessage(0); DestroyWindow(); } CView::OnKeyUp(nChar, nRepCnt, nFlags); } void CCpp_StarCraft_Imitation_ProjectView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { if(nChar == VK_ESCAPE) { PostQuitMessage(0); DestroyWindow(); } /* // TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다. if(nChar == VK_UP) { for(list<CObj*>::iterator iter = pDoc->li_DragObj.begin(); iter != pDoc->li_DragObj.end(); ++iter) { (*iter)->move(0, -10); } } if(nChar == VK_RIGHT) { for(list<CObj*>::iterator iter = pDoc->li_DragObj.begin(); iter != pDoc->li_DragObj.end(); ++iter) { (*iter)->move(10,0); } } if(nChar == VK_LEFT) { for(list<CObj*>::iterator iter = pDoc->li_DragObj.begin(); iter != pDoc->li_DragObj.end(); ++iter) { (*iter)->move(-10, 0); } } if(nChar == VK_DOWN) { for(list<CObj*>::iterator iter = pDoc->li_DragObj.begin(); iter != pDoc->li_DragObj.end(); ++iter) { (*iter)->move(0, 10); } } */ CView::OnKeyDown(nChar, nRepCnt, nFlags); }
[ "nuckly60@gmail.com" ]
nuckly60@gmail.com
f2abf3160875047eab07e07e0cd6350b1f1ecbda
662e36112643697e4f40b036a91c37436e3256d0
/map-structure/posegraph/src/pose-graph.cc
8192a7007c03b755cee38805820ba026ff458d63
[ "Apache-2.0" ]
permissive
ethz-asl/maplab
ca9e2cacd2fbaf9dac22b455e24a179f8613729a
0b4868efeb292851d71f98d31a1e6bb40ebb244b
refs/heads/master
2023-08-28T16:19:16.241444
2023-06-18T21:36:18
2023-06-18T21:36:18
112,253,403
2,488
755
Apache-2.0
2023-06-18T21:36:19
2017-11-27T21:58:23
C++
UTF-8
C++
false
false
4,439
cc
#include "posegraph/pose-graph.h" #include <unordered_map> #include <aslam/common/memory.h> #include <glog/logging.h> #include <maplab-common/accessors.h> #include "posegraph/edge.h" #include "posegraph/vertex.h" namespace pose_graph { void PoseGraph::swap(PoseGraph* other) { CHECK_NOTNULL(other); vertices_.swap(other->vertices_); edges_.swap(other->edges_); } void PoseGraph::addVertex(Vertex::UniquePtr vertex) { CHECK(vertex != nullptr); const VertexId& vertex_id = vertex->id(); CHECK(vertices_.emplace(vertex_id, std::move(vertex)).second) << "Vertex already exists."; } void PoseGraph::addEdge(Edge::UniquePtr edge) { // Insert new edge and do necessary book-keeping in vertices. CHECK(edge != nullptr); const Edge* const edge_raw = edge.get(); CHECK(edges_.emplace(edge_raw->id(), std::move(edge)).second) << "Edge already exists."; Vertex& vertex_from = getVertexMutable(edge_raw->from()); Vertex& vertex_to = getVertexMutable(edge_raw->to()); CHECK( vertex_from.addOutgoingEdge(edge_raw->id()) && vertex_to.addIncomingEdge(edge_raw->id())); } const Vertex& PoseGraph::getVertex(const VertexId& id) const { const VertexMap::const_iterator it = vertices_.find(id); CHECK(it != vertices_.end()) << "Vertex with ID " << id << " not in posegraph."; return *CHECK_NOTNULL(it->second.get()); } const Edge& PoseGraph::getEdge(const EdgeId& id) const { const EdgeMap::const_iterator it = edges_.find(id); CHECK(it != edges_.end()) << "Edge with ID " << id << " not in posegraph."; return *CHECK_NOTNULL(it->second.get()); } Vertex& PoseGraph::getVertexMutable(const VertexId& id) { return *getVertexPtrMutable(id); } Edge& PoseGraph::getEdgeMutable(const EdgeId& id) { return *getEdgePtrMutable(id); } Vertex* PoseGraph::getVertexPtrMutable(const VertexId& id) { return common::getChecked(vertices_, id).get(); } Edge* PoseGraph::getEdgePtrMutable(const EdgeId& id) { return common::getChecked(edges_, id).get(); } const Vertex* PoseGraph::getVertexPtr(const VertexId& id) const { return common::getChecked(vertices_, id).get(); } const Edge* PoseGraph::getEdgePtr(const EdgeId& id) const { return common::getChecked(edges_, id).get(); } bool PoseGraph::vertexExists(const VertexId& id) const { return vertices_.count(id) > 0u; } bool PoseGraph::edgeExists(const EdgeId& id) const { return edges_.count(id) > 0u; } bool PoseGraph::edgeExists(const VertexId& v1, const VertexId& v2) const { CHECK(vertexExists(v2)) << "Vertex with ID " << v2.hexString() << " not in posegraph."; const Vertex& from = getVertex(v1); std::unordered_set<EdgeId> incident_edges; from.incidentEdges(&incident_edges); for (const EdgeId& element : incident_edges) { const Edge& edge = getEdge(element); if (edge.to() == v2 || edge.from() == v2) { return true; } } return false; } void PoseGraph::getAllVertexIds(VertexIdList* vertices) const { CHECK_NOTNULL(vertices)->clear(); vertices->reserve(vertices_.size()); for (const VertexMap::value_type& vertex_id_pair : vertices_) { vertices->emplace_back(vertex_id_pair.first); } } void PoseGraph::getAllEdgeIds(EdgeIdList* edges) const { CHECK_NOTNULL(edges)->clear(); edges->reserve(edges_.size()); for (const EdgeMap::value_type& edge_id_pair : edges_) { edges->emplace_back(edge_id_pair.first); } } typename PoseGraph::EdgeMap::iterator PoseGraph::removeEdge( const pose_graph::EdgeId& id) { const EdgeMap::const_iterator edge_iterator = edges_.find(id); CHECK(id.isValid()); CHECK(edge_iterator != edges_.end()) << "Edge with ID " << id.hexString() << " does not exist."; getVertexPtrMutable(edge_iterator->second->from())->removeOutgoingEdge(id); getVertexPtrMutable(edge_iterator->second->to())->removeIncomingEdge(id); return edges_.erase(edge_iterator); } void PoseGraph::removeVertex(const pose_graph::VertexId& id) { const VertexMap::const_iterator it = vertices_.find(id); CHECK(it != vertices_.end()) << "Vertex with ID " << id << " does not exist."; CHECK(!it->second->hasIncomingEdges()) << "Vertex can't be linked with edges if you want to remove it."; CHECK(!it->second->hasOutgoingEdges()) << "Vertex can't be linked with edges if you want to remove it."; vertices_.erase(it); } } // namespace pose_graph
[ "aslmultiagent@gmail.com" ]
aslmultiagent@gmail.com
879a8c13d26071d3d1e062ad1c8c9f186bb204d1
9e597a5537517a0b96ba8ea972a05473f60b7cdf
/simulations_POWHEG/Djets/fastSimulations/fastsimulations/FastSim_powheg+pythia6_charm_1536594271/AliGenExtFile_dev.cxx
9e910f2e62802d310cb251bcc2b0106b6e44ebd6
[]
no_license
halfanda/alice_Djets
9e36301dfa1e822cbcfdd6b724446e02375fa03b
1d50096a3d12e7cb2973731ff2bbb0214aa13c55
refs/heads/master
2022-11-22T18:17:03.478630
2020-07-25T15:51:57
2020-07-25T15:51:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,071
cxx
/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ // Event generator that using an instance of type AliGenReader // reads particles from a file and applies cuts. // Example: In your Config.C you can include the following lines // AliGenExtFile_dev *gener = new AliGenExtFile_dev(-1); // gener->SetMomentumRange(0,999); // gener->SetPhiRange(-180.,180.); // gener->SetThetaRange(0,180); // gener->SetYRange(-999,999); // AliGenReaderTreeK * reader = new AliGenReaderTreeK(); // reader->SetFileName("myFileWithTreeK.root"); // gener->SetReader(reader); // gener->Init(); #include <Riostream.h> #include <AliGenEventHeader.h> #include <AliGenReader.h> #include <AliHeader.h> #include <AliLog.h> #include <AliRunLoader.h> #include <AliStack.h> #include <AliAnalysisManager.h> #include <AliAnalysisTaskEmcalLight.h> #include <TFile.h> #include <TParticle.h> #include <TTree.h> #include "AliGenExtFile_dev.h" ClassImp(AliGenExtFile_dev) AliGenExtFile_dev::AliGenExtFile_dev() : AliGenMC() , fReader(0) , fStartEvent(0) { // Constructor // // Read all particles fNpart = -1; } AliGenExtFile_dev::AliGenExtFile_dev(Int_t npart) : AliGenMC(npart) , fReader(0) , fStartEvent(0) { // Constructor fName = "ExtFile"; fTitle = "Primaries from ext. File"; } //____________________________________________________________ AliGenExtFile_dev::~AliGenExtFile_dev() { // Destructor delete fReader; } //___________________________________________________________ void AliGenExtFile_dev::Init() { // Initialize if (fReader) { fReader->SetFileName(fFileName.Data()); fReader->Init(); } } void AliGenExtFile_dev::InhibitAllTasks() { AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); if (mgr) { TIter iter(mgr->GetTasks()); while (auto obj = iter.Next()) { AliAnalysisTaskEmcalLight* task = dynamic_cast<AliAnalysisTaskEmcalLight*>(obj); if (!task) continue; task->SetInhibit(kTRUE); } } } //___________________________________________________________ void AliGenExtFile_dev::Generate() { // Generate particles Double_t polar[3] = { 0, 0, 0 }; // Double_t origin[3] = { 0, 0, 0 }; Double_t time = 0.; Double_t p[4]; Float_t random[6]; Int_t i = 0, j, nt; // // // Fast forward up to start Event for (Int_t ie = 0; ie < fStartEvent; ++ie) { Int_t nTracks = fReader->NextEvent(); if (nTracks == 0) { AliWarningStream() << "No more events in external file. Stopping event generation.\n"; InhibitAllTasks(); return; } for (i = 0; i < nTracks; ++i) { if (fReader->NextParticle() == nullptr) { AliWarningStream() << "Error while skipping tracks. Stopping event generation.\n"; InhibitAllTasks(); return; } } AliInfoStream() << "Skipping event " << ie << std::endl; } fStartEvent = 0; // do not skip events the second time do { if (fVertexSmear == kPerEvent) Vertex(); Int_t nTracks = fReader->NextEvent(); if (nTracks == 0) { // printf("\n No more events !!! !\n"); AliWarningStream() << "No more events in external file. Stopping event generation.\n"; InhibitAllTasks(); return; } // // Particle selection loop // // The selection criterium for the external file generator is as follows: // // 1) All tracks are subject to the cuts defined by AliGenerator, i.e. // fThetaMin, fThetaMax, fPhiMin, fPhiMax, fPMin, fPMax, fPtMin, fPtMax, // fYMin, fYMax. // If the particle does not satisfy these cuts, it is not put on the // stack. // 2) If fCutOnChild and some specific child is selected (e.g. if // fForceDecay==kSemiElectronic) the event is rejected if NOT EVEN ONE // child falls into the child-cuts. TParticle* iparticle = nullptr; if (fCutOnChild) { // Count the selected children Int_t nSelected = 0; while ((iparticle = fReader->NextParticle())) { Int_t kf = CheckPDGCode(iparticle->GetPdgCode()); kf = TMath::Abs(kf); if (ChildSelected(kf) && KinematicSelection(iparticle, 1)) { nSelected++; } } if (!nSelected) continue; // No particle selected: Go to next event fReader->RewindEvent(); } // // Stack selection loop // class SelectorLogic { // need to do recursive back tracking, requires a "nested" function private: Int_t idCount; std::map<Int_t, Int_t> firstMotherMap; std::map<Int_t, Int_t> secondMotherMap; std::map<Int_t, Bool_t> selectedIdMap; std::map<Int_t, Int_t> newIdMap; void selectMothersToo(Int_t particleId) { Int_t mum1 = firstMotherMap[particleId]; if (mum1 > -1 && !selectedIdMap[mum1]) { selectedIdMap[mum1] = true; selectMothersToo(mum1); } Int_t mum2 = secondMotherMap[particleId]; if (mum2 > -1 && !selectedIdMap[mum2]) { selectedIdMap[mum2] = true; selectMothersToo(mum2); } } public: SelectorLogic() : idCount(0) , firstMotherMap() , secondMotherMap() , selectedIdMap() , newIdMap() { } void init() { idCount = 0; } void setData(Int_t id, Int_t mum1, Int_t mum2, Bool_t selected) { idCount++; // we know that this function is called in succession of ids, so counting is fine to determine max id firstMotherMap[id] = mum1; secondMotherMap[id] = mum2; selectedIdMap[id] = selected; } void reselectCuttedMothersAndRemapIDs() { for (Int_t id = 0; id < idCount; ++id) { if (selectedIdMap[id]) { selectMothersToo(id); } } Int_t newId0 = 0; for (Int_t id = 0; id < idCount; id++) { if (selectedIdMap[id]) { newIdMap[id] = newId0; ++newId0; } else { newIdMap[id] = -1; } } } Bool_t isSelected(Int_t id) { return selectedIdMap[id]; } Int_t newId(Int_t id) { if (id == -1) return -1; return newIdMap[id]; } }; SelectorLogic selector; selector.init(); for (i = 0; i < nTracks; i++) { TParticle* jparticle = fReader->NextParticle(); selector.setData(i, jparticle->GetFirstMother(), jparticle->GetSecondMother(), KinematicSelection(jparticle, 0)); } selector.reselectCuttedMothersAndRemapIDs(); fReader->RewindEvent(); // // Stack filling loop // fNprimaries = 0; for (i = 0; i < nTracks; i++) { TParticle* jparticle = fReader->NextParticle(); Bool_t selected = selector.isSelected(i); if (!selected) { continue; } Int_t parent = selector.newId(jparticle->GetFirstMother()); // printf("particle %d -> %d, with mother %d -> %d\n", i, selector.newId(i), jparticle->GetFirstMother(), parent); p[0] = jparticle->Px(); p[1] = jparticle->Py(); p[2] = jparticle->Pz(); p[3] = jparticle->Energy(); Int_t idpart = jparticle->GetPdgCode(); if (fVertexSmear == kPerTrack) { Rndm(random, 6); for (j = 0; j < 3; j++) { origin[j] = fOrigin[j] + fOsigma[j] * TMath::Cos(2 * random[2 * j] * TMath::Pi()) * TMath::Sqrt(-2 * TMath::Log(random[2 * j + 1])); } Rndm(random, 2); time = fTimeOrigin + fOsigma[2] / TMath::Ccgs() * TMath::Cos(2 * random[0] * TMath::Pi()) * TMath::Sqrt(-2 * TMath::Log(random[1])); } else { origin[0] = fVertex[0] + jparticle->Vx(); origin[1] = fVertex[1] + jparticle->Vy(); origin[2] = fVertex[2] + jparticle->Vz(); time = fTime + jparticle->T(); } Int_t doTracking = fTrackIt && selected && (jparticle->TestBit(kTransportBit)); PushTrack(doTracking, parent, idpart, p[0], p[1], p[2], p[3], origin[0], origin[1], origin[2], time, polar[0], polar[1], polar[2], kPPrimary, nt, 1., jparticle->GetStatusCode()); KeepTrack(nt); fNprimaries++; } // track loop // Generated event header AliGenEventHeader* header = fReader->GetGenEventHeader(); if (!header) header = new AliGenEventHeader(); header->SetName(GetName()); header->SetNProduced(fNprimaries); header->SetPrimaryVertex(fVertex); header->SetInteractionTime(fTime); AddHeader(header); break; } while (true); // event loop SetHighWaterMark(nt); CdEventFile(); } //___________________________________________________________ void AliGenExtFile_dev::CdEventFile() { // CD back to the event file AliRunLoader::Instance()->CdGAFile(); }
[ "jakub.kvapil@cern.ch" ]
jakub.kvapil@cern.ch
0cdda934785222946d2c930bcf7296582f6d2dae
6cf2d9f4f46d3affc5a4cb53a1031585c8fce67f
/Sharaga_3kurs/OOP/me/labs/c++/lab01/lab01_01/lab01_01.cpp
f3a83e873595d7b7ab2168b370431cc6d2cffbba
[]
no_license
PashaEagle/Sharaga
ed84674d62673ebd5586a51e8205536efb627298
4da163eea61b19f1642a41569b0a5179da5e49be
refs/heads/master
2020-04-01T06:31:54.944482
2019-04-02T16:52:08
2019-04-02T16:52:08
152,952,018
3
0
null
null
null
null
UTF-8
C++
false
false
2,459
cpp
#include <iostream> #include <string> #include <bits/stdc++.h> #include <cstdlib> #include <iomanip> #include <algorithm> #include <random> #include <vector> using namespace std; class Student { private: char *name = "defaultName"; int course = -1; bool man = 0; public: Student(); Student(char *n, int c, bool m); //Student(const Student &obj); ~Student(); void input(); void output(); void setName(char *n); char* getName(); void setCourse(int c); int getCourse(); void setGender(bool m); bool getGender(); }; Student::Student(){}; Student::Student(char *n, int c, bool m) { setName(n); setCourse(c); setGender(m); } Student::~Student(){cout << "Object " << name << " deleted" << endl;}; //Student::Student(const Student &obj){}; void Student::input() { char *n = new char[20]; int c; bool m; int i = 0; while (i < 1) { try { cout << "Enter name: "; cin >> n; setName(n); cout << "Enter course: "; cin >> c; setCourse(c); cout << "Is it man (1) or woman (0)"; cin >> m; setGender(m); } catch(exception e) { cout << "Please, again.."; continue; } ++i; } } void Student::output() { cout << "Name : " << this->name << endl; cout << "Course : " << this->course << endl; cout << "Man : " << this->man << endl; } void Student::setName(char *n) { string str = n; if (str.length() > 20 || find_if(str.begin(), str.end(), ::isdigit) != str.end()) { cout << "Incorrect name" << endl; } else name = n; } char* Student::getName() { return name; } void Student::setCourse(int c) { c > 0 && c < 5 ? course = c : course = -1; if (course == -1) cout << "Incorrect course" << endl; } int Student::getCourse() { return course; } void Student::setGender(bool m) { if (m == 1 || m == 0) man = m; else cout << "Incorrect gender" << endl; } bool Student::getGender() { return man; } int main() { Student s1; Student s2("Vasya", 3, true); cout << s1.getName() << endl; cout << s1.getCourse() << endl; cout << s1.getGender() << endl; cout << endl; cout << s2.getName() << endl; cout << s2.getCourse() << endl; cout << s2.getGender() << endl; cout << endl; s1.setName("Petya"); cout << s1.getName() << endl; cout << endl; s1.input(); s1.output(); cout << endl; s2.output(); Student s3; s3 = s2; /*s1.setCourse(8); cout << s1.getCourse() << endl;*/ return 0; }
[ "kolpal17@gmail.com" ]
kolpal17@gmail.com
e3259e98a4b58db2388f4bb7efd2bf2c8c0a086b
56fadd70c1311a2a1914a4d25e732b466bc44d62
/problems/backtracking-execises/number-decomposed-in-prime-numbers.cpp
18809b3fa7ea50c3ec98d0a5e394c77b05fd175a
[]
no_license
dandelionn/algorithms
f618f2df0e3c1836fb2add8e948aaf2c053036f9
895f5270617ebb894810c3d263de7626acf4b675
refs/heads/master
2021-06-22T01:59:21.256980
2020-11-12T20:56:49
2020-11-12T20:56:49
134,471,219
0
0
null
null
null
null
UTF-8
C++
false
false
1,219
cpp
#include <iostream> using namespace std; int a[100],s=0,n,as,ev,k,ok=0; int prim(int b) { int d=2,ok=0; while(d<=b/2) { if(b%d==0) ok++; d++; } return ok; } void init() { if(k==1) a[k]=0; else a[k]=a[k-1]-1; } int succesor() { if(a[k]<n-s) {a[k]++; return 1;} else s-=a[k-1]; return 0; } int valid() { if(s+a[k]<=n) {s+=a[k]; return 1;} else return 0; } int solutie() { return s==n; } void tipar() { int u=0; for(int i=1;i<=k;i++) u+=prim(a[i]); if(u==0) {for(int i=1;i<=k;i++) cout<<a[i]<<' '; cout<<'\n';} s-=a[k]; } void bt() { k=1; init(); while(k>0) { as=1;ev=0; while(as&&!ev) { as=succesor(); if(as) ev=valid(); } if(as) if(solutie()) tipar(); else {k++; init();} else k--; } } int main() { cout<<"n=";cin>>n; bt(); }
[ "michea.paul@yahoo.com" ]
michea.paul@yahoo.com
6594f65b0908e26ee688f0321d3ff74fcbd314ee
cc7661edca4d5fb2fc226bd6605a533f50a2fb63
/mscorlib/DISPPARAMS.h
8f6aeda0c1aec8596348dc280f81e4905cfb1870
[ "MIT" ]
permissive
g91/Rust-C-SDK
698e5b573285d5793250099b59f5453c3c4599eb
d1cce1133191263cba5583c43a8d42d8d65c21b0
refs/heads/master
2020-03-27T05:49:01.747456
2017-08-23T09:07:35
2017-08-23T09:07:35
146,053,940
1
0
null
2018-08-25T01:13:44
2018-08-25T01:13:44
null
UTF-8
C++
false
false
443
h
#pragma once namespace System { namespace Runtime { { namespace InteropServices { { { namespace ComTypes { class DISPPARAMS : public ValueType // 0x0 { public: __int64 rgvarg; // 0x10 (size: 0x8, flags: 0x6, type: 0x18) __int64 rgdispidNamedArgs; // 0x18 (size: 0x8, flags: 0x6, type: 0x18) int cArgs; // 0x20 (size: 0x4, flags: 0x6, type: 0x8) int cNamedArgs; // 0x24 (size: 0x4, flags: 0x6, type: 0x8) }; // size = 0x28 }
[ "info@cvm-solutions.co.uk" ]
info@cvm-solutions.co.uk
509c4b4e693801f09c321d4cbf43b6cc78d194fa
8bf6fa2e41892ed67e2725bbd199f6d2980cca8c
/Sources/Library/Cryptopp/twofish.cpp
266543a39e625d3d730b1016cfb02465079f0aba
[ "LicenseRef-scancode-unknown-license-reference", "BSL-1.0", "LicenseRef-scancode-public-domain" ]
permissive
Shinronz/AluxiaMu
90cecbf0a04432113d9fde8e4990180ebf3c08da
5f5dcd621e1c4ecbabca95b978dd5529e09f1a56
refs/heads/master
2021-01-20T01:29:13.185992
2017-05-18T01:22:48
2017-05-18T01:22:48
89,285,116
1
2
null
null
null
null
UTF-8
C++
false
false
4,385
cpp
// twofish.cpp - modified by Wei Dai from Matthew Skala's twofish.c // The original code and all modifications are in the public domain. #include "pch.h" #include "twofish.h" #include "secblock.h" #include "misc.h" NAMESPACE_BEGIN(CryptoPP) // compute (c * x^4) mod (x^4 + (a + 1/a) * x^3 + a * x^2 + (a + 1/a) * x + 1) // over GF(256) static inline unsigned int Mod(unsigned int c) { static const unsigned int modulus = 0x14d; unsigned int c2 = (c<<1) ^ ((c & 0x80) ? modulus : 0); unsigned int c1 = c2 ^ (c>>1) ^ ((c & 1) ? (modulus>>1) : 0); return c | (c1 << 8) | (c2 << 16) | (c1 << 24); } // compute RS(12,8) code with the above polynomial as generator // this is equivalent to multiplying by the RS matrix static word32 ReedSolomon(word32 high, word32 low) { for (unsigned int i=0; i<8; i++) { high = Mod(high>>24) ^ (high<<8) ^ (low>>24); low <<= 8; } return high; } inline word32 Twofish::Base::h0(word32 x, const word32 *key, unsigned int kLen) { x = x | (x<<8) | (x<<16) | (x<<24); switch(kLen) { #define Q(a, b, c, d, t) q[a][GETBYTE(t,0)] ^ (q[b][GETBYTE(t,1)] << 8) ^ (q[c][GETBYTE(t,2)] << 16) ^ (q[d][GETBYTE(t,3)] << 24) case 4: x = Q(1, 0, 0, 1, x) ^ key[6]; case 3: x = Q(1, 1, 0, 0, x) ^ key[4]; case 2: x = Q(0, 1, 0, 1, x) ^ key[2]; x = Q(0, 0, 1, 1, x) ^ key[0]; } return x; } inline word32 Twofish::Base::h(word32 x, const word32 *key, unsigned int kLen) { x = h0(x, key, kLen); return mds[0][GETBYTE(x,0)] ^ mds[1][GETBYTE(x,1)] ^ mds[2][GETBYTE(x,2)] ^ mds[3][GETBYTE(x,3)]; } void Twofish::Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &) { AssertValidKeyLength(keylength); unsigned int len = (keylength <= 16 ? 2 : (keylength <= 24 ? 3 : 4)); SecBlock<word32> key(len*2); GetUserKey(LITTLE_ENDIAN_ORDER, key.begin(), len*2, userKey, keylength); unsigned int i; for (i=0; i<40; i+=2) { word32 a = h(i, key, len); word32 b = rotlFixed(h(i+1, key+1, len), 8); m_k[i] = a+b; m_k[i+1] = rotlFixed(a+2*b, 9); } SecBlock<word32> svec(2*len); for (i=0; i<len; i++) svec[2*(len-i-1)] = ReedSolomon(key[2*i+1], key[2*i]); for (i=0; i<256; i++) { word32 t = h0(i, svec, len); m_s[0*256+i] = mds[0][GETBYTE(t, 0)]; m_s[1*256+i] = mds[1][GETBYTE(t, 1)]; m_s[2*256+i] = mds[2][GETBYTE(t, 2)]; m_s[3*256+i] = mds[3][GETBYTE(t, 3)]; } } #define G1(x) (m_s[0*256+GETBYTE(x,0)] ^ m_s[1*256+GETBYTE(x,1)] ^ m_s[2*256+GETBYTE(x,2)] ^ m_s[3*256+GETBYTE(x,3)]) #define G2(x) (m_s[0*256+GETBYTE(x,3)] ^ m_s[1*256+GETBYTE(x,0)] ^ m_s[2*256+GETBYTE(x,1)] ^ m_s[3*256+GETBYTE(x,2)]) #define ENCROUND(n, a, b, c, d) \ x = G1 (a); y = G2 (b); \ x += y; y += x + k[2 * (n) + 1]; \ (c) ^= x + k[2 * (n)]; \ (c) = rotrFixed(c, 1); \ (d) = rotlFixed(d, 1) ^ y #define ENCCYCLE(n) \ ENCROUND (2 * (n), a, b, c, d); \ ENCROUND (2 * (n) + 1, c, d, a, b) #define DECROUND(n, a, b, c, d) \ x = G1 (a); y = G2 (b); \ x += y; y += x; \ (d) ^= y + k[2 * (n) + 1]; \ (d) = rotrFixed(d, 1); \ (c) = rotlFixed(c, 1); \ (c) ^= (x + k[2 * (n)]) #define DECCYCLE(n) \ DECROUND (2 * (n) + 1, c, d, a, b); \ DECROUND (2 * (n), a, b, c, d) typedef BlockGetAndPut<word32, LittleEndian> Block; void Twofish::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const { word32 x, y, a, b, c, d; Block::Get(inBlock)(a)(b)(c)(d); a ^= m_k[0]; b ^= m_k[1]; c ^= m_k[2]; d ^= m_k[3]; const word32 *k = m_k+8; ENCCYCLE (0); ENCCYCLE (1); ENCCYCLE (2); ENCCYCLE (3); ENCCYCLE (4); ENCCYCLE (5); ENCCYCLE (6); ENCCYCLE (7); c ^= m_k[4]; d ^= m_k[5]; a ^= m_k[6]; b ^= m_k[7]; Block::Put(xorBlock, outBlock)(c)(d)(a)(b); } void Twofish::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const { word32 x, y, a, b, c, d; Block::Get(inBlock)(c)(d)(a)(b); c ^= m_k[4]; d ^= m_k[5]; a ^= m_k[6]; b ^= m_k[7]; const word32 *k = m_k+8; DECCYCLE (7); DECCYCLE (6); DECCYCLE (5); DECCYCLE (4); DECCYCLE (3); DECCYCLE (2); DECCYCLE (1); DECCYCLE (0); a ^= m_k[0]; b ^= m_k[1]; c ^= m_k[2]; d ^= m_k[3]; Block::Put(xorBlock, outBlock)(a)(b)(c)(d); } NAMESPACE_END ////////////////////////////////////////////////////////////////////// // iDev.Games - MuOnline S9EP2 IGC9.5 - TRONG.WIN - DAO VAN TRONG //////////////////////////////////////////////////////////////////////
[ "geretto@hotmail.com" ]
geretto@hotmail.com
1e49b44214e70ee0d14981d1d558c52458672ef5
244eef1bb61a74230949439cb958f4f990e2ca32
/ouzel/graphics/direct3d11/D3D11DepthStencilState.hpp
808dd101afdc39b66ee3ebab5a23599ac1408b76
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
weizai118/ouzel
6608f453dc0715d9e10873506b98f715122babad
4f1f7448da415bea189f9c892f81398ec5495e24
refs/heads/master
2020-07-12T00:18:46.089139
2019-08-26T21:46:19
2019-08-26T21:46:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,356
hpp
// Copyright 2015-2019 Elviss Strazdins. All rights reserved. #ifndef OUZEL_GRAPHICS_D3D11DEPTHSTENCILSTATE_HPP #define OUZEL_GRAPHICS_D3D11DEPTHSTENCILSTATE_HPP #include "core/Setup.h" #if OUZEL_COMPILE_DIRECT3D11 #pragma push_macro("WIN32_LEAN_AND_MEAN") #pragma push_macro("NOMINMAX") #ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN #endif #ifndef NOMINMAX # define NOMINMAX #endif #include <d3d11.h> #pragma pop_macro("WIN32_LEAN_AND_MEAN") #pragma pop_macro("NOMINMAX") #include "graphics/direct3d11/D3D11RenderResource.hpp" #include "graphics/CompareFunction.hpp" #include "graphics/StencilOperation.hpp" namespace ouzel { namespace graphics { namespace d3d11 { class RenderDevice; class DepthStencilState final: public RenderResource { public: DepthStencilState(RenderDevice& initRenderDevice, bool initDepthTest, bool initDepthWrite, CompareFunction initCompareFunction, bool initStencilEnabled, uint32_t initStencilReadMask, uint32_t initStencilWriteMask, StencilOperation initFrontFaceStencilFailureOperation, StencilOperation initFrontFaceStencilDepthFailureOperation, StencilOperation initFrontFaceStencilPassOperation, CompareFunction initFrontFaceStencilCompareFunction, StencilOperation initBackFaceStencilFailureOperation, StencilOperation initBackFaceStencilDepthFailureOperation, StencilOperation initBackFaceStencilPassOperation, CompareFunction initBackFaceStencilCompareFunction); ~DepthStencilState(); inline auto getDepthStencilState() const { return depthStencilState; } private: ID3D11DepthStencilState* depthStencilState = nullptr; }; } // namespace d3d11 } // namespace graphics } // namespace ouzel #endif #endif // OUZEL_GRAPHICS_D3D11DEPTHSTENCILSTATE_HPP
[ "elviss@elviss.lv" ]
elviss@elviss.lv
2d801b910ec10907162123e746538ab5a3028c12
533621231aa7233de90e29c31ae721e97c29fb8b
/Codeforces/GYM/3 Estrelas/2016, Samara University ACM ICPC Quarterfinal Qualification Contest - 101149/K.cpp
4df03d62455be6396ba7f849919be8d8a0c76f3a
[]
no_license
NatanGarcias/Competitive-Programming
00ad96389d24040b9d69eed04af04e8da0a4feb6
ffb7a156352432c6a246c0024522aa97b5a5f2b8
refs/heads/master
2021-11-29T16:35:36.476318
2021-08-21T00:21:08
2021-08-21T00:21:08
238,455,629
2
0
null
null
null
null
UTF-8
C++
false
false
1,273
cpp
#include<bits/stdc++.h> using namespace std; template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << "{"; for (typename vector<T>::const_iterator vi = v.begin(); vi != v.end(); ++vi) { if (vi != v.begin()) os << ", "; os << *vi; } os << "}"; return os; } template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { os << '(' << p.first << ", " << p.second << ')'; return os; } typedef long long ll; typedef long double ld; typedef pair<int,int> pii; #define optimize ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define endl "\n" #define fi first #define se second #define pb push_back #define sz(x) (ll)(x.size()) #define all(x) x.begin(),x.end() #define FOR(x,a,n) for(int x= (int)(a);(x) < int(n);(x)++) #define ms(x,a) memset(x,a,sizeof(x)) #define INF 0x3f3f3f3f #define INFLL 0x3f3f3f3f3f3f3f3f #define mod 1000000007LL #define MAXN 200010 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); ll T,N,M,K; // PI * Radiodrome const ld P = 0.916297857297023; void solve(){ N -= K; M -= T; ld ans = N*N + M*M; cout << fixed << setprecision(12) << ans*P << endl; } int main(){ optimize; cin >> N >> M; cin >> K >> T; solve(); return 0; }
[ "natans.garcias@gmail.com" ]
natans.garcias@gmail.com
30d9bde49fa8917449141ed640c30e8ad3f74ee2
18df702758fa034d30f7e3573e9a986a93b5ba88
/external/rkmedia/src/flow/source_stream_flow.cc
c78561c8689ad26bda3401e0f57a21f76153f301
[ "BSD-3-Clause" ]
permissive
qiaoweibiao/merged
e8eedb87c73f12436fb26b8058ea295fc3e703c0
3b016b1330c2a148753d00c542aaa39e7f86e726
refs/heads/master
2023-08-25T01:53:59.791416
2021-10-25T19:22:50
2021-10-25T19:22:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,399
cc
// Copyright 2019 Fuzhou Rockchip Electronics Co., Ltd. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <sys/prctl.h> #include "buffer.h" #include "flow.h" #include "stream.h" #include "utils.h" #ifdef MOD_TAG #undef MOD_TAG #endif #define MOD_TAG 9 namespace easymedia { class SourceStreamFlow : public Flow { public: SourceStreamFlow(const char *param); virtual ~SourceStreamFlow(); static const char *GetFlowName() { return "source_stream"; } virtual int Control(unsigned long int request, ...) final { if (!stream) return -1; va_list vl; va_start(vl, request); void *arg = va_arg(vl, void *); va_end(vl); return stream->IoCtrl(request, arg); } private: void ReadThreadRun(); bool loop; std::thread *read_thread; std::shared_ptr<Stream> stream; std::string tag; }; SourceStreamFlow::SourceStreamFlow(const char *param) : loop(false), read_thread(nullptr) { std::list<std::string> separate_list; std::map<std::string, std::string> params; if (!ParseWrapFlowParams(param, params, separate_list)) { SetError(-EINVAL); return; } std::string &name = params[KEY_NAME]; const char *stream_name = name.c_str(); const std::string &stream_param = separate_list.back(); stream = REFLECTOR(Stream)::Create<Stream>(stream_name, stream_param.c_str()); if (!stream) { RKMEDIA_LOGI("Create stream %s failed\n", stream_name); SetError(-EINVAL); return; } tag = "SourceFlow:"; tag.append(name); if (!SetAsSource(std::vector<int>({0}), void_transaction00, tag)) { SetError(-EINVAL); return; } loop = true; read_thread = new std::thread(&SourceStreamFlow::ReadThreadRun, this); if (!read_thread) { loop = false; SetError(-EINVAL); return; } SetFlowTag(tag); } SourceStreamFlow::~SourceStreamFlow() { loop = false; StopAllThread(); int stop = 1; if (stream && Control(S_STREAM_OFF, &stop)) RKMEDIA_LOGI("Fail to stop source stream\n"); RKMEDIA_LOGI("#SourceStreamFlow[%s]: stream off....\n", GetFlowTag()); if (read_thread) { source_start_cond_mtx->lock(); loop = false; source_start_cond_mtx->notify(); source_start_cond_mtx->unlock(); read_thread->join(); delete read_thread; } RKMEDIA_LOGI("#SourceStreamFlow[%s]: read thread exit sucessfully!\n", GetFlowTag()); stream.reset(); RKMEDIA_LOGI("#SourceStreamFlow[%s]: stream reset sucessfully!\n", GetFlowTag()); } void SourceStreamFlow::ReadThreadRun() { prctl(PR_SET_NAME, this->tag.c_str()); source_start_cond_mtx->lock(); if (waite_down_flow) { if (down_flow_num == 0 && IsEnable()) { source_start_cond_mtx->wait(); } } source_start_cond_mtx->unlock(); while (loop) { if (stream->Eof()) { // TODO: tell that I reach eof SetDisable(); break; } auto buffer = stream->Read(); #ifdef RKMEDIA_TIMESTAMP_DEBUG //if (buffer) // buffer->TimeStampReset(); //Consti10: if(buffer){ //NOTE: This value is set here: V4L2CaptureStream::Read() //ret_buf->SetAtomicTimeVal(buf_ts); //ret_buf->SetTimeVal(buf_ts); //aka the v4l2 timestamp is written as both atomic time val and time val int64_t now=easymedia::gettimeofday(); int64_t bufferSystemTime=buffer->GetAtomicClock(); //int64_t delayUs=now - bufferSystemTime; //float delayMs=delayUs/ 1000.0; //printf("Consti10:buffSystemTime:[%lld] now:[%lld] delay:[%f] (ms)\n", bufferSystemTime, // now, delayMs); buffer->TimeStampReset(); buffer->TimeStampRecord("Consti10:SourceBufferValue",bufferSystemTime); //Time value of the buffer (in past), think this is written by ISP (or even the original cif value) buffer->TimeStampRecord("Consti10:SourceBufferInsideRkMedia",now); //Time value when (YUV) buffer was first tracked inside rkmedia } #endif //RKMEDIA_TIMESTAMP_DEBUG SendInput(buffer, 0); //Consti10: What happens when I send each input buffer twice ?! //SendInput(buffer, 0); } } DEFINE_FLOW_FACTORY(SourceStreamFlow, Flow) const char *FACTORY(SourceStreamFlow)::ExpectedInputDataType() { return nullptr; } // TODO! const char *FACTORY(SourceStreamFlow)::OutPutDataType() { return ""; } } // namespace easymedia
[ "geierconstantinabc@gmail.com" ]
geierconstantinabc@gmail.com
49c59960f07d2568dc614aeb59884dfc19525ba5
75b82680d7733e08dfd230c88e1cba3a2b233293
/ffead-server/tests/FfeadServerTestSuite.cpp
7fac29387aa87385f0da994df86e182aa0f1ab68
[]
no_license
clawplach/ffead-cpp
ad7ec4c10581cadbfd883352deb94fb6740fb20c
128b879b018b97b897b3a49d5908e48709fe9621
refs/heads/master
2020-12-27T15:37:32.949949
2013-11-30T17:29:26
2013-11-30T17:29:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,481
cpp
/* Copyright 2009-2012, Sumeet Chhetri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* * FfeadServerTestSuite.cpp * * Created on: 29-Jan-2013 * Author: sumeetc */ #include "HttpResponseParser.h" #include "CsvFileReader.h" #include "PropFileReader.h" #include "Timer.h" #include "sstream" #include "Client.h" #include "SSLClient.h" int main() { PropFileReader propFileReader; propMap props = propFileReader.getProperties("testValues.prop"); CsvFileReader csvFileReader; strVecVec testCases = csvFileReader.getRows("test.csv"); Timer timer, timerc; string cookies, result; int total, skipped = 0, passed = 0, failed = 0, header = 0, counter = 0; total = (int)testCases.size(); string ip = props["SERVER_IP_ADDRESS"]; if(ip=="") ip = "localhost"; int port = 8080; if(props["SERVER_PORT"]!="") { try{ port = CastUtil::lexical_cast<int>(props["SERVER_PORT"]); } catch(...) { } } bool sslEnabled = false; if(props["SERVER_SSL_ENABLED"]!="") { try{ sslEnabled = CastUtil::lexical_cast<bool>(props["SERVER_SSL_ENABLED"]); } catch(...) { } } cout << "Server IP - " << ip <<endl; cout << "Server Port - " << port <<endl; cout << "Server SSL Enabled - " << CastUtil::lexical_cast<string>(sslEnabled) <<endl; timerc.start(); for (int var = 0; var < total; ++var) { ClientInterface* client; if(sslEnabled) client = new SSLClient; else client = new Client; if(testCases[var].size()>=4) { if(testCases[var][0]=="ENABLED") { header++; continue; } counter = var; string request = testCases[var][2]; if(testCases[var][0]=="N" || testCases[var][0]=="n") { cout << "Request " << counter << " " << request << " was Skipped" << endl; skipped++; continue; } bool debugCont = false; string debugContStr = testCases[var][1]; if(debugContStr=="Y" || debugContStr=="y") debugCont = true; string responseCode = testCases[var][3]; string file; if(testCases[var].size()>4) file = testCases[var][4]; string fileCntlen; if(testCases[var].size()>5) fileCntlen = testCases[var][5]; string reqContTyp, content, headers, respCntType; if(testCases[var].size()>6) { reqContTyp = testCases[var][6]; } if(testCases[var].size()>7) { content = testCases[var][7]; } if(testCases[var].size()>8) { headers = testCases[var][8]; if(headers!="" && headers.find("HEADERVALS_")!=string::npos) { headers = props[headers]; } else { vector<string> headerVec; StringUtil::split(headerVec, headers, ";"); headers = ""; for (int var = 0; var < (int)headerVec.size(); ++var) { vector<string> param; StringUtil::split(param, headerVec.at(var), "="); if(param.size()==2) { headers += param.at(0) + ": " + param.at(1) + "\r\n"; } } } } if(testCases[var].size()>9) { respCntType = testCases[var][9]; } string data = request; data += " HTTP/1.1\r\nHost: "+ip+":"+CastUtil::lexical_cast<string>(port)+"\r\nUser-Agent: Program\r\n"; if(content!="" && content.find("TSTVALUES_")!=string::npos) content = props[content]; if(reqContTyp!="") { data += "Content-Type: " + reqContTyp + "\r\n"; } if(content.length()>0) { data += "Content-Length: " + CastUtil::lexical_cast<string>((int)content.length()) + "\r\n"; } if(cookies!="") { data += "Cookie: " + cookies + "\r\n"; } if(headers!="") { data += headers; } data += "\r\n"; if(content!="") { data += content; } timer.start(); client->connectionUnresolv(ip,port); int bytes = client->sendData(data); string tot = client->getTextData("\r\n","Content-Length"); long long millis = timer.elapsedMilliSeconds(); HttpResponse res; HttpResponseParser parser(tot, res); if(res.getHeader("Set-Cookie")!="") { cookies = res.getHeader("Set-Cookie"); cookies = cookies.substr(0, cookies.find(";")); } string debugContentValue; if(debugCont) { debugContentValue = ", Content => " + parser.getContent(); } string ss; bool passedFlag = false, done = false; if(res.getStatusCode()==responseCode) { if(respCntType!="") { if(res.getHeader("Content-Type")==respCntType) { ss.clear(); ss = "Test " + CastUtil::lexical_cast<string>(counter) + " " + request + " was Successfull, Response Time = " + CastUtil::lexical_cast<string>(millis) + "ms" + debugContentValue; passedFlag = true; } else { ss.clear(); ss = "Test " + CastUtil::lexical_cast<string>(counter) + " " + request + " Failed, Response Time = " + CastUtil::lexical_cast<string>(millis) + "ms" + ", Expected ContentType = " + respCntType + ", Actual ContentType = " + res.getHeader("Content-Type"); passedFlag = false; } done = true; } if(!done) { string cntlen = res.getHeader("Content-Length"); if(file!="") { ifstream myfile (&file[0], ios::binary | ios::ate); if (myfile.is_open() && cntlen!="" && myfile.tellg()==CastUtil::lexical_cast<int>(cntlen)) { ss.clear(); ss = "Test " + CastUtil::lexical_cast<string>(counter) + " " + request + " was Successfull, Response Time = " + CastUtil::lexical_cast<string>(millis) + "ms" + debugContentValue; passedFlag = true; } else { ss.clear(); ss = "Test " + CastUtil::lexical_cast<string>(counter) + " " + request + ", Invalid Content Length, Response Time = " + CastUtil::lexical_cast<string>(millis) + "ms" + debugContentValue; passedFlag = false; } } else if((file=="" && fileCntlen=="") || (fileCntlen!="" && fileCntlen==cntlen)) { ss.clear(); ss = "Test " + CastUtil::lexical_cast<string>(counter) + " " + request + " was Successfull, Response Time = " + CastUtil::lexical_cast<string>(millis) + "ms" + debugContentValue; passedFlag = true; } else { ss.clear(); ss = "Test " + CastUtil::lexical_cast<string>(counter) + " " + request + ", Invalid Content Length, Response Time = " + CastUtil::lexical_cast<string>(millis) + "ms" + debugContentValue; passedFlag = false; } } } else { ss.clear(); ss = "Test " + CastUtil::lexical_cast<string>(counter) + " " + request + " Failed, Response Time = " + CastUtil::lexical_cast<string>(millis) + "ms" + ", Expected Status = " + responseCode + ", Actual Status = " + res.getStatusCode(); passedFlag = false; } cout << ss << endl; if(passedFlag) passed++; else failed++; client->closeConnection(); delete client; } else { skipped++; } } cout << "Total Tests = " << total-1 << ", Passed = " << passed << ", Failed = " << failed << ", Skipped = " << skipped << ", Time taken = " << timerc.elapsedMilliSeconds() << "ms" << endl; return 0; }
[ "sumeet.chhetri@gmail.com" ]
sumeet.chhetri@gmail.com
63ce1969d525dede2068c987d3bd72f70c10ff9a
22549a867445219745da0a7446ed4963a0502167
/Bai233.cpp
71c0d377e41b770cb70e08d9083854d3ed321e67
[]
no_license
hoangtrung1999/Code-Bai-Tap-Ky-Thuat-Lap-Trinh---thay-Nguyen-Tan-Trang-Minh-Khang
afb5273db9b575548c60d352ca498c141a0fcaf1
033e37ea6018bd2450f414c5af60896eb28e5d3c
refs/heads/master
2022-10-04T04:50:05.020285
2018-01-06T03:48:21
2018-01-06T03:48:21
114,956,184
0
1
null
2022-09-16T12:16:30
2017-12-21T03:06:29
C++
UTF-8
C++
false
false
613
cpp
#include <iostream> using namespace std; int Calculate (int Array[10]) { int Sum; bool Check[10] = {false}; bool Checked = false; for (int i = 0 ; i < 10 ; i++) { Sum = 0; for (int k = i ; k < 10 ; k++) { if (Check[k] == false && (Array[i] == Array[k])) { Sum++; Check[k] = true; Checked = true; } } if (Checked == true) { cout<<"Gia tri "<<Array[i]<<" xuat hien "<<Sum<<" lan."<<endl; Checked = false; } } return 0; } int main(int argc, char const *argv[]) { int Array[10]; for (int i = 0 ; i < 10 ; i++) cin>>Array[i]; Calculate(Array); return 0; }
[ "hoangtrung1999@yahoo.com.vn" ]
hoangtrung1999@yahoo.com.vn
d635ff467eb3eeda4a97c215384508ad8072dd64
7112b17f779520e100ccf6f58e2db4f41cabdb27
/Tehnike-programiranja-2018/Z3/Z4/main.cpp
3af85c43c11ce89d743664027f3143a50cab0f45
[]
no_license
hhamzic1/university-projects
6e4360e54363b1b2216985a6bc75e6052e30acc4
0f69d9dc02aa87910fc999a3de69ed3d47afc4d2
refs/heads/master
2022-08-22T09:52:37.897205
2020-05-04T17:47:41
2020-05-04T17:47:41
261,016,579
7
0
null
null
null
null
UTF-8
C++
false
false
2,821
cpp
//TP 2018/2019: Zadaća 3, Zadatak 4 #include <iostream> #include <string> #include <vector> #include <set> #include <list> #include <stdexcept> int brslova(std::string s) { int brojac=0; for(int i=0; i<s.size(); i++) { if((s[i]>='a' && s[i]<='z') || (s[i]>='A' && s[i]<='Z') || (s[i]>='0' && s[i]<='9')) brojac++; } return brojac; } std::vector<std::set<std::string>> Razvrstavanje(std::vector<std::string> v, int n) { if(n<1 || n>v.size()) throw std::logic_error("Razvrstavanje nemoguce"); std::list<std::string> imena; for(int i=0; i<v.size(); i++) imena.push_back(v[i]); std::vector<std::set<std::string>> razvrstani; razvrstani.resize(n); auto it=imena.begin(); razvrstani[0].insert(*it); int br_vel=brslova(*it); it=imena.erase(it); std::vector<int> vel_timova; vel_timova.resize(n); for(int i=0; i<n; i++) { if(i<v.size()%n) { vel_timova[i]=v.size()/n+1; if((double(v.size()/n)-v.size()/n)>=0.5) vel_timova[i]++; //raspodjela u timove } else { //vektor ljude po broju timova vel_timova[i]=int(v.size()/n); if((double(v.size()/n)-v.size()/n)>=0.5) vel_timova[i]++; //raspodjela u timove } } int index_tima=0; while(imena.size()!=0) { br_vel--; if(it==imena.end()) it=imena.begin(); for(int i=0; i<br_vel; i++) { it++; if(it==imena.end()) it=imena.begin(); } if(razvrstani[index_tima].size()>=vel_timova[index_tima]) index_tima++; razvrstani[index_tima].insert(*it); br_vel=brslova(*it); it=imena.erase(it); } return razvrstani; } int main () { std::cout<<"Unesite broj djece: "; int n; std::cin>>n; std::cout<<"Unesite imena djece: "; std::cin.ignore(10000,'\n'); std::vector<std::string> veka; std::string pomocni; for(int i=0; i<n; i++) { std::getline(std::cin, pomocni); veka.push_back(pomocni); } std::cout<<"\nUnesite broj timova: "; int m; std::cin>>m; try { auto skup=Razvrstavanje(veka, m); for(int i=0; i<skup.size(); i++) { std::cout<<"Tim "<<i+1<<": "; int brojac=0; for(auto x : skup[i]) { if(brojac!=skup[i].size()-1) std::cout<<x<<", "; else std::cout<<x; brojac++; } std::cout<<std::endl; } return 0; } catch(std::logic_error a) { std::cout<<"Izuzetak: "<<a.what(); } }
[ "hhamzic1@etf.unsa.ba" ]
hhamzic1@etf.unsa.ba
48b96c447742a7f01acf483ce02a288478b0830e
d37e70599f93a40e893c17f28eaba5585a985545
/torch/csrc/distributed/rpc/python_rpc_handler.h
68c7bd88f3dbdcad97717d1bb3108308683f9e8e
[ "BSD-3-Clause", "BSD-2-Clause", "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
vingovan/pytorch
9729a2bde58c69ad600e8a885f29613c34cd7c2e
1487582ba7f046e496554d40301e31b4ebc22422
refs/heads/master
2020-12-11T17:33:13.345644
2020-01-14T17:35:57
2020-01-14T17:38:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,721
h
#pragma once #include <torch/csrc/distributed/rpc/message.h> #include <torch/csrc/distributed/rpc/types.h> #include <torch/csrc/utils/pybind.h> namespace torch { namespace distributed { namespace rpc { // Singleton class provides interface to execute python UDF remote call // and deserialize the returned results by running python function // in internal_rpc_utilities. // The singleton object is constructed at first when RPC agent is // constructed, where the python function in // torch/distributed/internal_rpc_utils.py are imported only once. class PYBIND11_EXPORT PythonRpcHandler { public: static PythonRpcHandler& getInstance(); // Deserialize Python function, run it, and serialize its return value. std::vector<char> generatePythonUDFResult( const std::vector<char>& pickledPayload, const std::vector<torch::Tensor>& requestTensorTable, std::vector<torch::Tensor>& responseTensorTable); // Returned python UDF result is pickled binary string, so run python // function to unpickle the python UDF result and return py::object to user py::object loadPythonUDFResult( const std::vector<char>& pickledPayload, const std::vector<torch::Tensor>& tensorTable); // Run a pickled Python UDF and return the result py::object py::object runPythonUDF(const SerializedPyObj& serializedObj); // Serialized a py::object into a string SerializedPyObj serialize(const py::object& obj); // Deserialize a string into a py::object py::object deserialize(const SerializedPyObj& serializedObj); // Check if obj is RemoteException, then throw it void handleException(const py::object& obj); // Explicitly clean up py::objects to avoid segment faults when // py::objects with CPython are cleaned up later at program exit // See similar issues reported https://github.com/pybind/pybind11/issues/1598 // and https://github.com/pybind/pybind11/issues/1493 // Our local tests also caught this segment faults if py::objects are cleaned // up at program exit. The explanation is: CPython cleans up most critical // utilities before cleaning up PythonRpcHandler singleton, so when // PythonRpcHandler signleton cleans up py::objects and call dec_ref(), it // will crash. // The solution is to clean up py::objects earlier when Rpc agent join(). // Be note that py::objects can not be cleaned up when Rpc agent is destroyed // as well, as Rpc agent is global variable and it will have same issue as // PythonRpcHandler. void cleanup(); std::shared_ptr<torch::jit::script::CompilationUnit> jitCompilationUnit(); private: PythonRpcHandler(); ~PythonRpcHandler() = default; PythonRpcHandler(const PythonRpcHandler&) = delete; PythonRpcHandler& operator=(const PythonRpcHandler&) = delete; PythonRpcHandler(PythonRpcHandler&&) = delete; PythonRpcHandler& operator=(PythonRpcHandler&&) = delete; // Ref to `torch.distributed.rpc.internal._run_function`. py::object pyRunFunction_; // Ref to `torch.distributed.rpc.internal._load_return_value`. py::object pyLoadReturnValue_; // Ref to `torch.distributed.rpc.internal.serialize`. py::object pySerialize_; // Ref to 'torch.distributed.rpc.internal._handle_exception' py::object pyHandleException_; // Shared ptr to python compilation unit in jit, it is constructed in python // side (see _python_cu = torch._C.CompilationUnit() in jit/__init__.py) // and imported in C++ (see get_python_cu() in csrc/jit/pybind_utils.h). // We import the compilation unit here only once for less cost and thread // safety. std::shared_ptr<torch::jit::script::CompilationUnit> jitCompilationUnit_; }; } // namespace rpc } // namespace distributed } // namespace torch
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
ea3df33ba8f433c9dfedb99f1823295d32bf55d8
e48ea9e6c1a634d574f06ceb2f618cb75d338c88
/main_window/messagepeer/rpc_service_base.cpp
3a07b76a7c9515b84e397dba750f55bb3e06c8d9
[]
no_license
jhc80/StringToolsV2-v2x_tci_dll
b9b29f6b3644f881227803c3dec9ca0a74364892
947e1ca8c1a374a18ec9285a2037880601a07366
refs/heads/master
2023-06-30T20:15:05.538953
2021-08-05T00:58:15
2021-08-05T00:58:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,468
cpp
#include "rpc_service_base.h" #include "syslog.h" #include "mem_tool.h" #include "peerglobals.h" CRpcServiceBase::CRpcServiceBase() { this->InitBasic(); } CRpcServiceBase::~CRpcServiceBase() { this->Destroy(); } status_t CRpcServiceBase::InitBasic() { CPeerServiceBase::InitBasic(); this->m_dest_peer_name.InitBasic(); return OK; } status_t CRpcServiceBase::Init(CTaskMgr *mgr) { this->InitBasic(); CPeerServiceBase::Init(mgr); this->m_dest_peer_name.Init(); return OK; } status_t CRpcServiceBase::Destroy() { CPeerServiceBase::Destroy(); this->m_dest_peer_name.Destroy(); this->InitBasic(); return OK; } status_t CRpcServiceBase::Copy(CRpcServiceBase *_p) { ASSERT(0); return OK; } status_t CRpcServiceBase::Comp(CRpcServiceBase *_p) { ASSERT(0); return 0; } status_t CRpcServiceBase::Print(CFileBase *_buf) { ASSERT(0); return OK; } status_t CRpcServiceBase::SendReturnValue(CRpcCallContext *context, CRpcParamBase *ret) { ASSERT(context && ret); CMiniBson bson; bson.Init(); bson.StartDocument(); ret->SaveBson(&bson); bson.EndDocument(); return this->SendResponse(CPeerMessage::NewBsonMessage( context->GetFrom()->CStr(),context->GetMethod(), context->GetCallbackId(),&bson )); } status_t CRpcServiceBase::SendPartReturnValue(CRpcCallContext *context, CRpcParamBase *ret) { ASSERT(context && ret); CMiniBson bson; bson.Init(); bson.StartDocument(); ret->SaveBson(&bson); bson.EndDocument(); return this->SendPartResponse(CPeerMessage::NewBsonMessage( context->GetFrom()->CStr(),context->GetMethod(), context->GetCallbackId(),&bson )); } int CRpcServiceBase::AddCallback(CClosure *closure) { if(!closure)return 0; GLOBAL_PEER_CALLBACK_MAP(map); int callback_id = map->AllocUniqueId(); if(!map->AddClosure(closure,callback_id)) { callback_id = 0; } return callback_id; } status_t CRpcServiceBase::SetCallbackTimeout(int cbid,int timeout) { GLOBAL_PEER_CALLBACK_MAP(map); return map->SetCallbackTimeout(cbid,timeout); } CMem* CRpcServiceBase::GetDestPeerName() { return &m_dest_peer_name; } const char* CRpcServiceBase::GetDestPeerNameStr() { if(m_dest_peer_name.StrLen() == 0) return ""; return m_dest_peer_name.CStr(); } status_t CRpcServiceBase::SetDestPeerName(CMem *_dest_peer_name) { ASSERT(_dest_peer_name); return this->m_dest_peer_name.Copy(_dest_peer_name); } status_t CRpcServiceBase::SetDestPeerName(const char *_dest_peer_name) { CMem tmp(_dest_peer_name); return this->SetDestPeerName(&tmp); } status_t CRpcServiceBase::SendRequest(CRpcParamBase *params,int method, int callback) { CMiniBson *pbson = NULL; CMiniBson bson; if(params) { bson.Init(); bson.StartDocument(); params->SaveBson(&bson); bson.EndDocument(); pbson = &bson; } return CPeerServiceBase::SendRequest(CPeerMessage::NewBsonMessage( GetDestPeerNameStr(),method,callback,pbson )); } status_t CRpcServiceBase::Start() { CPeerServiceBase::Start(); if(IsInServiceSide()) { this->SetCanFetchMessage(true); this->StartFetchMessageTask(); } return OK; }
[ "xiangpeng_chen@126.com" ]
xiangpeng_chen@126.com
cf37abb4735666905e4b40330db3d29b16c54288
26ba18f15532023552cf9523feb84a317b47beb0
/JUCE/extras/Projucer/Source/ComponentEditor/UI/jucer_PaintRoutineEditor.cpp
7d86b993ef43b3ac2f1df9d265d2f34787335edb
[ "GPL-1.0-or-later", "GPL-3.0-only", "ISC", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license", "MIT" ]
permissive
Ultraschall/ultraschall-soundboard
d3fdaf92061f9eacc65351b7b4bc937311f9e7fc
8a7a538831d8dbf7689b47611d218560762ae869
refs/heads/main
2021-12-14T20:19:24.170519
2021-03-17T22:34:11
2021-03-17T22:34:11
27,304,678
27
3
MIT
2021-02-16T20:49:08
2014-11-29T14:36:19
C++
UTF-8
C++
false
false
7,886
cpp
/* ============================================================================== This file is part of the JUCE library. Copyright (c) 2020 - Raw Material Software Limited JUCE is an open source library subject to commercial or open-source licensing. By using JUCE, you agree to the terms of both the JUCE 6 End-User License Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020). End User License Agreement: www.juce.com/juce-6-licence Privacy Policy: www.juce.com/juce-privacy-policy Or: You may also use this code under the terms of the GPL v3 (see www.gnu.org/licenses). JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE DISCLAIMED. ============================================================================== */ #include "../../Application/jucer_Headers.h" #include "../../Application/jucer_Application.h" #include "../UI/jucer_JucerCommandIDs.h" #include "jucer_PaintRoutineEditor.h" #include "../jucer_ObjectTypes.h" #include "jucer_JucerDocumentEditor.h" //============================================================================== PaintRoutineEditor::PaintRoutineEditor (PaintRoutine& pr, JucerDocument& doc, JucerDocumentEditor* docHolder) : graphics (pr), document (doc), documentHolder (docHolder), componentOverlay (nullptr), componentOverlayOpacity (0.0f) { refreshAllElements(); setSize (document.getInitialWidth(), document.getInitialHeight()); } PaintRoutineEditor::~PaintRoutineEditor() { document.removeChangeListener (this); removeAllElementComps(); removeChildComponent (&lassoComp); deleteAllChildren(); } void PaintRoutineEditor::removeAllElementComps() { for (int i = getNumChildComponents(); --i >= 0;) if (PaintElement* const e = dynamic_cast<PaintElement*> (getChildComponent (i))) removeChildComponent (e); } Rectangle<int> PaintRoutineEditor::getComponentArea() const { if (document.isFixedSize()) return Rectangle<int> ((getWidth() - document.getInitialWidth()) / 2, (getHeight() - document.getInitialHeight()) / 2, document.getInitialWidth(), document.getInitialHeight()); return getLocalBounds().reduced (4); } //============================================================================== void PaintRoutineEditor::paint (Graphics& g) { const Rectangle<int> clip (getComponentArea()); g.reduceClipRegion (clip); g.setOrigin (clip.getPosition()); graphics.fillWithBackground (g, true); grid.draw (g, &graphics); } void PaintRoutineEditor::paintOverChildren (Graphics& g) { if (componentOverlay.isNull() && document.getComponentOverlayOpacity() > 0.0f) updateComponentOverlay(); if (componentOverlay.isValid()) { const Rectangle<int> clip (getComponentArea()); g.drawImageAt (componentOverlay, clip.getX(), clip.getY()); } } void PaintRoutineEditor::resized() { if (getWidth() > 0 && getHeight() > 0) { componentOverlay = Image(); refreshAllElements(); } } void PaintRoutineEditor::updateChildBounds() { const Rectangle<int> clip (getComponentArea()); for (int i = 0; i < getNumChildComponents(); ++i) if (PaintElement* const e = dynamic_cast<PaintElement*> (getChildComponent (i))) e->updateBounds (clip); } void PaintRoutineEditor::updateComponentOverlay() { if (componentOverlay.isValid()) repaint(); componentOverlay = Image(); componentOverlayOpacity = document.getComponentOverlayOpacity(); if (componentOverlayOpacity > 0.0f) { if (documentHolder != nullptr) componentOverlay = documentHolder->createComponentLayerSnapshot(); if (componentOverlay.isValid()) { componentOverlay.multiplyAllAlphas (componentOverlayOpacity); repaint(); } } } void PaintRoutineEditor::visibilityChanged() { document.beginTransaction(); if (isVisible()) { refreshAllElements(); document.addChangeListener (this); } else { document.removeChangeListener (this); componentOverlay = Image(); } } void PaintRoutineEditor::refreshAllElements() { for (int i = getNumChildComponents(); --i >= 0;) if (auto* e = dynamic_cast<PaintElement*> (getChildComponent (i))) if (! graphics.containsElement (e)) removeChildComponent (e); Component* last = nullptr; for (int i = graphics.getNumElements(); --i >= 0;) { auto* e = graphics.getElement (i); addAndMakeVisible (e); if (last != nullptr) e->toBehind (last); else e->toFront (false); last = e; } updateChildBounds(); if (grid.updateFromDesign (document)) repaint(); if (currentBackgroundColour != graphics.getBackgroundColour()) { currentBackgroundColour = graphics.getBackgroundColour(); repaint(); } if (componentOverlayOpacity != document.getComponentOverlayOpacity()) { componentOverlay = Image(); componentOverlayOpacity = document.getComponentOverlayOpacity(); repaint(); } } void PaintRoutineEditor::changeListenerCallback (ChangeBroadcaster*) { refreshAllElements(); } void PaintRoutineEditor::mouseDown (const MouseEvent& e) { if (e.mods.isPopupMenu()) { ApplicationCommandManager* commandManager = &ProjucerApplication::getCommandManager(); PopupMenu m; m.addCommandItem (commandManager, JucerCommandIDs::editCompLayout); m.addCommandItem (commandManager, JucerCommandIDs::editCompGraphics); m.addSeparator(); for (int i = 0; i < ObjectTypes::numElementTypes; ++i) m.addCommandItem (commandManager, JucerCommandIDs::newElementBase + i); m.show(); } else { addChildComponent (lassoComp); lassoComp.beginLasso (e, this); } } void PaintRoutineEditor::mouseDrag (const MouseEvent& e) { lassoComp.toFront (false); lassoComp.dragLasso (e); } void PaintRoutineEditor::mouseUp (const MouseEvent& e) { lassoComp.endLasso(); if (! (e.mouseWasDraggedSinceMouseDown() || e.mods.isAnyModifierKeyDown())) { graphics.getSelectedElements().deselectAll(); graphics.getSelectedPoints().deselectAll(); } } void PaintRoutineEditor::findLassoItemsInArea (Array <PaintElement*>& results, const Rectangle<int>& lasso) { for (int i = 0; i < getNumChildComponents(); ++i) if (PaintElement* const e = dynamic_cast<PaintElement*> (getChildComponent (i))) if (e->getBounds().expanded (-e->borderThickness).intersects (lasso)) results.add (e); } SelectedItemSet <PaintElement*>& PaintRoutineEditor::getLassoSelection() { return graphics.getSelectedElements(); } bool PaintRoutineEditor::isInterestedInFileDrag (const StringArray& files) { return File::createFileWithoutCheckingPath (files[0]) .hasFileExtension ("jpg;jpeg;png;gif;svg"); } void PaintRoutineEditor::filesDropped (const StringArray& filenames, int x, int y) { const File f (filenames [0]); if (f.existsAsFile()) { std::unique_ptr<Drawable> d (Drawable::createFromImageFile (f)); if (d != nullptr) { d.reset(); document.beginTransaction(); graphics.dropImageAt (f, jlimit (10, getWidth() - 10, x), jlimit (10, getHeight() - 10, y)); document.beginTransaction(); } } }
[ "daniel@lindenfelser.de" ]
daniel@lindenfelser.de
a7e48091624a4d5c49efd3fce6da4faf0d55170b
5d17bf841cdd98aaf69e35832449d5bdbb98b748
/projects/geometric-flow/src/mean-curvature-flow.cpp
5bc9641fc54a39d2b84a5a62959ad7be3e38a40b
[ "MIT" ]
permissive
siyuanpan/ddg-exercises
3c26bf6d3fb5e6bec8bd40a399e17bbac8493aa7
529885387fe0e32529d754f95c055ba611ae4467
refs/heads/main
2023-04-03T05:52:31.420122
2021-02-15T05:03:04
2021-02-15T05:03:04
338,831,759
1
0
null
2021-02-14T15:08:28
2021-02-14T15:08:28
null
UTF-8
C++
false
false
1,200
cpp
// Implement member functions for MeanCurvatureFlow class. #include "mean-curvature-flow.h" /* Constructor * Input: The surface mesh <inputMesh> and geometry <inputGeo>. */ MeanCurvatureFlow::MeanCurvatureFlow(ManifoldSurfaceMesh* inputMesh, VertexPositionGeometry* inputGeo) { // Build member variables: mesh, geometry mesh = inputMesh; geometry = inputGeo; } /* * Build the mean curvature flow operator. * * Input: The mass matrix <M> of the mesh, and the timestep <h>. * Returns: A sparse matrix representing the mean curvature flow operator. */ SparseMatrix<double> MeanCurvatureFlow::buildFlowOperator(const SparseMatrix<double>& M, double h) const { // TODO return identityMatrix<double>(1); // placeholder } /* * Performs mean curvature flow. * * Input: The timestep <h>. * Returns: */ void MeanCurvatureFlow::integrate(double h) { // TODO // Note: Geometry Central has linear solvers: https://geometry-central.net/numerical/linear_solvers/ // Note: Update positions via geometry->inputVertexPositions for (Vertex v : mesh->vertices()) { geometry->inputVertexPositions[v] = geometry->inputVertexPositions[v]; // placeholder } }
[ "nicolefeng7@gmail.com" ]
nicolefeng7@gmail.com
1c6b062f55766e8512fa90e713eed31449256191
4dece967cbb7a1f3a461a12881f4cd12c513f4e7
/Proj/Shin_Dokyoung_Project1_HighLowGame - 44187/Shin_Dokyoung_Project1_HighLowGame_V2/main.cpp
ee1561f7690d1aacbc6467e54045c393eb996c62
[]
no_license
ds2465310/ShinDokyoung_CIS5_44187
04b9e47432f83ee0831deeb8a2dad1c729d7ff64
1762be84f0daa3f0d0358884ae54741c675893d8
refs/heads/master
2021-01-22T18:50:08.481071
2017-06-03T12:18:56
2017-06-03T12:18:56
85,116,436
0
0
null
null
null
null
UTF-8
C++
false
false
1,898
cpp
/* File: main.cpp Author: Shin Dokyoung Created on April 13, 2017, 11:15 PM Purpose: Simulate a high-low game. */ //System Libraries #include <iostream> #include <string> #include <cstdlib> #include <ctime> using namespace std; //User Libraries //Global Constants //Such as PI, Vc, -> Math/Science values //as well as conversions from system of units to //another //Function Prototypes //Executable code begins here!!! int main(int argc, char** argv) { //Declare Variables string playerName; int num; int guess; int tries = 0; char Answer; do { //Input values - random generator srand(time(0)); cout << "\n\nWELCOME TO THE HIGH-LOW GAME\n\n"; cout << "Enter your name : "; getline(cin, playerName); //Process by mapping inputs to outputs num = std::rand()%100 + 1;//random number between 1 to 100 //Output values do { cout << playerName << ", Enter a guess between 1 and 100: "; cin >> guess; if (guess <= 0 || guess > 100) { cout << "Please check the number!! It should be between 1 to 100." "\nTry again.\n"; } tries++; if (guess > num) { cout << "Too high! Bad luck this time!!\n\n"; } else if (guess < num) { cout << "Too low! Bad luck this time!!\n\n"; } else { cout << "\nCorrect! Your got it in " << tries << " guesses!\n"; } }while (guess!=num); cout << "Do you want to try again? [Y/N]"; cin >> Answer; }while (Answer == 'Y'|| Answer == 'y'); //Exit stage right! return 0; }
[ "dshin3@student.rcc.edu" ]
dshin3@student.rcc.edu
dfa5dd3d579298c87c36ef033e27bc6c5d61f1e4
341346a9fafe3a59443b707cff895e97ecf9230f
/Controller.cpp
0c9c5e1f62a69a00d691ac245cb733a362ad0667
[]
no_license
sarahopris/Laborator6
27d2275dc250dabe44437919ed25a2ad4e0d3ce4
5457c9e5e59f24d616dfc2e0a8aa8433464e4ece
refs/heads/master
2022-08-01T20:08:18.056932
2020-05-22T10:32:39
2020-05-22T10:32:39
265,954,870
0
0
null
null
null
null
UTF-8
C++
false
false
1,731
cpp
#include "Controller.h" #include <algorithm> #include "FileWatchlist.h" #include "RepositoryExceptions.h" using namespace std; void Controller::addMovieToRepository(const std::string& title, const std::string& genre, const int& year, const int& like, const std::string& trailer) { Filme m{ title, genre, year, like, trailer }; this->validator.validate(m); this->repo.addMovie(m); } void Controller::removeMovieFromRepository(const std::string& title, const std::string& genre) { Filme m = this->repo.findByTitleandGenre(title, genre); this->repo.removeMovie(m); } void Controller::addMovieToWatchlist(const Filme& movie) { if (this->watchlist == nullptr) return; this->watchlist->add(movie); } void Controller::addAllMoviesByGenreToWatchlist(const std::string& genre) { vector<Filme> movielist = this->repo.getMovies(); int nMovies = count_if(movielist.begin(), movielist.end(), [genre](const Filme& m) { return m.getGenre() == genre; }); vector<Filme> moviesbyGenre(nMovies); copy_if(movielist.begin(), movielist.end(), moviesbyGenre.begin(), [genre](const Filme& m) { return m.getGenre() == genre; }); for (auto m : moviesbyGenre) this->watchlist->add(m); } void Controller::startWatchlist() { if (this->watchlist == nullptr) return; this->watchlist->play(); } void Controller::nextMovieWatchlist() { if (this->watchlist == nullptr) return; this->watchlist->next(); } void Controller::saveWatchlist(const std::string& filename) { if (this->watchlist == nullptr) return; this->watchlist->setFilename(filename); this->watchlist->writeToFile(); } void Controller::openWatchlist() const { if (this->watchlist == nullptr) return; this->watchlist->displayWatchlist(); }
[ "Sarah@DESKTOP-PKV7BNF" ]
Sarah@DESKTOP-PKV7BNF
adb16c2d66124e877ec8d2380686919acbbb101e
c5a17ffbd62eee183790cc33847ebc719346a8ba
/printBalancedParenthesis.cpp
707adb87b129b68b4a527d388b6231a898359d4c
[]
no_license
manyu22/CPPPrograms
dff92b3b01cbd8612112e23c183bf763bcc73d69
bf65fda36db44358747d1970d01d8d89c3952e2f
refs/heads/master
2019-01-19T17:50:39.544406
2014-06-27T11:28:00
2014-06-27T11:28:00
21,249,341
1
0
null
null
null
null
UTF-8
C++
false
false
783
cpp
# include<iostream> #include<cstdio> # define MAX_SIZE 100 // the number of such possible brackets for n pair is actually given by catalan number for n (2n)!/(n!*(n+1)!) void _printParenthesis(int pos, int n, int open, int close)// open and close maintains the count of the open and close brakets { static char str[MAX_SIZE]; if(close == n) { printf("%s %d\n", str, count); return; } else { if(open > close) { str[pos] = '}'; _printParenthesis(pos+1, n, open, close+1); } if(open < n) { str[pos] = '{'; _printParenthesis(pos+1, n, open+1, close); } } } void printParenthesis(int n) { if(n > 0) _printParenthesis(0, n, 0, 0); return; } int main() { int n = 5; printParenthesis(n); return 0; }
[ "aesthetemanyu@gmail.com" ]
aesthetemanyu@gmail.com
26abb40286f843fe97f6dbefdc7c1cca2763b78e
84c6373c46202a7cf980f7bdf2c087d85bc66a8e
/CastleVania/Grid.h
fccd28ac6ca5c4e959480b1e16f7133a1855388d
[]
no_license
cuonglv212/NhapMonGame
23b2ab80a8135e9dd6dcd19852c1a6e60cbbaba5
6317787cba4459f83c092dcbb0d95d25fb3a58f6
refs/heads/master
2022-01-14T08:06:03.088571
2019-06-11T21:31:31
2019-06-11T21:31:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
565
h
#pragma once #include "Cell.h" class Grid { int widthLevel1, heightLevel1; int rowCells, columnCells; int cellWidth, cellHeight; Cell** gridData; vector<BaseObject*> allObjectsHaveToWork; static Grid* instance; public: static Grid* getInstance(); void addObjectToGrid(BaseObject* object); vector<BaseObject*> getAllObjectsInActiveCells(); //Hàm này đóng vai trò là bao chứa các object đã đang hoạt động trong camera và các object mới được camera quét qua vector<BaseObject*> getAllObjectsHaveToWork(); Grid(); ~Grid(); };
[ "42339586+CuonglvNexlesoft@users.noreply.github.com" ]
42339586+CuonglvNexlesoft@users.noreply.github.com
4f1377e4ef30ee4d832097432ab3a96d09774460
b812db5d69f1ddc38596149460a0cbdf5248e0a7
/Codechef/08 LTIME51/MATPAN.cpp
ce0bc8068b2f3807215149154d5d3bebc7f3f5b7
[]
no_license
mnaveenkumar2009/Competitive-Programming
f15536906f8a6015654baf73fec3b94f334c998a
9bd02ae15d132468e97bc86a95e924910fe5692a
refs/heads/master
2021-06-06T12:22:59.879873
2020-07-12T11:41:44
2020-07-12T11:41:44
99,432,530
1
0
null
null
null
null
UTF-8
C++
false
false
695
cpp
#include <bits/stdc++.h> using namespace std; #define f(i,n) for(i=0;i<n;i++) #define pb push_back #define sd(n) scanf("%d",&n) #define sc(n) scanf("%c",&n) #define slld(n) scanf("%lld",&n) #define mod 1000000007 int main() { int t; sd(t); while(t--) { string s; int i; long long a[26]; int count[26]; f(i,26) {count[i]=0; slld(a[i]); } cin>>s; f(i,s.length()) { count[s[i]-'a']++; } long long ans=0; f(i,26) { //cout<<count[i]<<endl; if(!count[i])ans+=a[i]; } cout<<ans<<endl; } return 0; }
[ "mnaveenkumar2009@gmail.com" ]
mnaveenkumar2009@gmail.com
14b4992c2b9bd5d9fe31a60b6ec33e024cd89a23
a2361fc4dedad83691086eae5d9e46153b2b9305
/src/wasm/baseline/s390/liftoff-assembler-s390.h
8abbded6e9208f611167b08b6694ab1a604e70c2
[ "BSD-3-Clause", "SunPro", "bzip2-1.0.6" ]
permissive
xjy1204/v8
e7df3f213b27a63e45f8683c0e7bdec3d2f1b864
476a45766c8c132da07c65255ca41db529a29191
refs/heads/master
2021-05-09T23:38:04.917401
2018-01-24T12:00:48
2018-01-24T12:01:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,551
h
// Copyright 2017 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_WASM_BASELINE_LIFTOFF_ASSEMBLER_S390_H_ #define V8_WASM_BASELINE_LIFTOFF_ASSEMBLER_S390_H_ #include "src/wasm/baseline/liftoff-assembler.h" namespace v8 { namespace internal { namespace wasm { void LiftoffAssembler::ReserveStackSpace(uint32_t bytes) { UNIMPLEMENTED(); } void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value, RelocInfo::Mode rmode) { UNIMPLEMENTED(); } void LiftoffAssembler::LoadFromContext(Register dst, uint32_t offset, int size) { UNIMPLEMENTED(); } void LiftoffAssembler::SpillContext(Register context) { UNIMPLEMENTED(); } void LiftoffAssembler::FillContextInto(Register dst) { UNIMPLEMENTED(); } void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr, Register offset_reg, uint32_t offset_imm, LoadType type, LiftoffRegList pinned, uint32_t* protected_load_pc) { UNIMPLEMENTED(); } void LiftoffAssembler::Store(Register dst_addr, Register offset_reg, uint32_t offset_imm, LiftoffRegister src, StoreType type, LiftoffRegList pinned, uint32_t* protected_store_pc) { UNIMPLEMENTED(); } void LiftoffAssembler::LoadCallerFrameSlot(LiftoffRegister dst, uint32_t caller_slot_idx) { UNIMPLEMENTED(); } void LiftoffAssembler::MoveStackValue(uint32_t dst_index, uint32_t src_index, ValueType type) { UNIMPLEMENTED(); } void LiftoffAssembler::MoveToReturnRegister(LiftoffRegister reg) { UNIMPLEMENTED(); } void LiftoffAssembler::Move(LiftoffRegister dst, LiftoffRegister src) { UNIMPLEMENTED(); } void LiftoffAssembler::Spill(uint32_t index, LiftoffRegister reg, ValueType type) { UNIMPLEMENTED(); } void LiftoffAssembler::Spill(uint32_t index, WasmValue value) { UNIMPLEMENTED(); } void LiftoffAssembler::Fill(LiftoffRegister reg, uint32_t index, ValueType type) { UNIMPLEMENTED(); } #define UNIMPLEMENTED_GP_BINOP(name) \ void LiftoffAssembler::emit_##name(Register dst, Register lhs, \ Register rhs) { \ UNIMPLEMENTED(); \ } #define UNIMPLEMENTED_GP_UNOP(name) \ bool LiftoffAssembler::emit_##name(Register dst, Register src) { \ UNIMPLEMENTED(); \ } #define UNIMPLEMENTED_FP_BINOP(name) \ void LiftoffAssembler::emit_##name(DoubleRegister dst, DoubleRegister lhs, \ DoubleRegister rhs) { \ UNIMPLEMENTED(); \ } #define UNIMPLEMENTED_SHIFTOP(name) \ void LiftoffAssembler::emit_##name(Register dst, Register lhs, Register rhs, \ LiftoffRegList pinned) { \ UNIMPLEMENTED(); \ } UNIMPLEMENTED_GP_BINOP(i32_add) UNIMPLEMENTED_GP_BINOP(i32_sub) UNIMPLEMENTED_GP_BINOP(i32_mul) UNIMPLEMENTED_GP_BINOP(i32_and) UNIMPLEMENTED_GP_BINOP(i32_or) UNIMPLEMENTED_GP_BINOP(i32_xor) UNIMPLEMENTED_SHIFTOP(i32_shl) UNIMPLEMENTED_SHIFTOP(i32_sar) UNIMPLEMENTED_SHIFTOP(i32_shr) UNIMPLEMENTED_GP_UNOP(i32_eqz) UNIMPLEMENTED_GP_UNOP(i32_clz) UNIMPLEMENTED_GP_UNOP(i32_ctz) UNIMPLEMENTED_GP_UNOP(i32_popcnt) UNIMPLEMENTED_GP_BINOP(ptrsize_add) UNIMPLEMENTED_FP_BINOP(f32_add) UNIMPLEMENTED_FP_BINOP(f32_sub) UNIMPLEMENTED_FP_BINOP(f32_mul) #undef UNIMPLEMENTED_GP_BINOP #undef UNIMPLEMENTED_GP_UNOP #undef UNIMPLEMENTED_FP_BINOP #undef UNIMPLEMENTED_SHIFTOP void LiftoffAssembler::emit_i32_test(Register reg) { UNIMPLEMENTED(); } void LiftoffAssembler::emit_i32_compare(Register lhs, Register rhs) { UNIMPLEMENTED(); } void LiftoffAssembler::emit_ptrsize_compare(Register lhs, Register rhs) { UNIMPLEMENTED(); } void LiftoffAssembler::emit_jump(Label* label) { UNIMPLEMENTED(); } void LiftoffAssembler::emit_cond_jump(Condition cond, Label* label) { UNIMPLEMENTED(); } void LiftoffAssembler::StackCheck(Label* ool_code) { UNIMPLEMENTED(); } void LiftoffAssembler::CallTrapCallbackForTesting() { UNIMPLEMENTED(); } void LiftoffAssembler::AssertUnreachable(AbortReason reason) { UNIMPLEMENTED(); } void LiftoffAssembler::PushCallerFrameSlot(const VarState& src, uint32_t src_index) { UNIMPLEMENTED(); } void LiftoffAssembler::PushCallerFrameSlot(LiftoffRegister reg) { UNIMPLEMENTED(); } void LiftoffAssembler::PushRegisters(LiftoffRegList regs) { UNIMPLEMENTED(); } void LiftoffAssembler::PopRegisters(LiftoffRegList regs) { UNIMPLEMENTED(); } void LiftoffAssembler::DropStackSlotsAndRet(uint32_t num_stack_slots) { UNIMPLEMENTED(); } void LiftoffAssembler::PrepareCCall(uint32_t num_params, const Register* args) { UNIMPLEMENTED(); } void LiftoffAssembler::SetCCallRegParamAddr(Register dst, uint32_t param_idx, uint32_t num_params) { UNIMPLEMENTED(); } void LiftoffAssembler::SetCCallStackParamAddr(uint32_t stack_param_idx, uint32_t param_idx, uint32_t num_params) { UNIMPLEMENTED(); } void LiftoffAssembler::CallC(ExternalReference ext_ref, uint32_t num_params) { UNIMPLEMENTED(); } void LiftoffAssembler::CallNativeWasmCode(Address addr) { UNIMPLEMENTED(); } void LiftoffAssembler::CallRuntime(Zone* zone, Runtime::FunctionId fid) { UNIMPLEMENTED(); } void LiftoffAssembler::CallIndirect(wasm::FunctionSig* sig, compiler::CallDescriptor* call_desc, Register target) { UNIMPLEMENTED(); } void LiftoffAssembler::AllocateStackSlot(Register addr, uint32_t size) { UNIMPLEMENTED(); } void LiftoffAssembler::DeallocateStackSlot(uint32_t size) { UNIMPLEMENTED(); } } // namespace wasm } // namespace internal } // namespace v8 #endif // V8_WASM_BASELINE_LIFTOFF_ASSEMBLER_S390_H_
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
543834fadfa4de038cff5646cad2021bf162bc67
955ceafddde194fbf388a5a4587cae5ea88f76bb
/src/scene/triangle.hpp
56c30b75b13f4f9ef3165e264814d93add147e63
[ "MIT" ]
permissive
miuho/Optimized-Photon-Mapping
7be89c75c1a4e5d90f9bd40757f10c882aa0cd29
15bba93c46fc3924ae203e1dcca91ea9069752b8
refs/heads/master
2020-03-19T12:08:01.948220
2018-06-07T15:42:04
2018-06-07T15:42:04
136,497,804
1
1
null
null
null
null
UTF-8
C++
false
false
1,212
hpp
/** * @file triangle.hpp * @brief Class definition for Triangle. * * @author Eric Butler (edbutler) */ #ifndef _462_SCENE_TRIANGLE_HPP_ #define _462_SCENE_TRIANGLE_HPP_ #include "scene/scene.hpp" namespace _462 { /** * a triangle geometry. * Triangles consist of 3 vertices. Each vertex has its own position, normal, * texture coordinate, and material. These should all be interpolated to get * values in the middle of the triangle. * These values are all in local space, so it must still be transformed by * the Geometry's position, orientation, and scale. */ class Triangle : public Geometry { public: struct Vertex { // note that position and normal are in local space Vector3 position; Vector3 normal; Vector2 tex_coord; const Material* material; }; // the triangle's vertices, in CCW order Vertex vertices[3]; Triangle(); virtual ~Triangle(); virtual void render() const; virtual void intersection_test(const Ray& r, Intersection& inter, real_t *closest_found_t) const; virtual void init_bound(Bound& bound) const; }; } /* _462 */ #endif /* _462_SCENE_TRIANGLE_HPP_ */
[ "miuhingon@hotmail.com" ]
miuhingon@hotmail.com
16b1484112d6b2329f3af2c145ccf288add191e9
07b565803873e0a391e6e005d7a3d69b0c2d12d5
/problems/day20/solve.h
8202ed43bd712efe4adfe82ef5b877c45028d70b
[]
no_license
Mesoptier/advent-of-code-2019
6f1fdb38edfa0dd3446159b349cfa85be1e602d2
c46083214633973a5c6b16a2621ee2ce1de2bc73
refs/heads/master
2020-09-23T07:15:41.412225
2019-12-25T09:55:07
2019-12-25T09:55:07
225,436,235
3
0
null
null
null
null
UTF-8
C++
false
false
2,711
h
#pragma once #include <istream> #include <vector> #include <map> #include <unordered_map> #include <set> #include <queue> #include <bitset> #include <ostream> namespace Day20 { enum Direction { North = 1, South = 2, West = 3, East = 4, }; struct Coord { int x; int y; bool operator==(const Coord& rhs) const { return x == rhs.x && y == rhs.y; } bool operator!=(const Coord& rhs) const { return !(rhs == *this); } bool operator<(const Coord& rhs) const { if (x < rhs.x) return true; if (rhs.x < x) return false; return y < rhs.y; } bool operator>(const Coord& rhs) const { return rhs < *this; } bool operator<=(const Coord& rhs) const { return !(rhs < *this); } bool operator>=(const Coord& rhs) const { return !(*this < rhs); } [[nodiscard]] Coord step(Direction direction) const { switch (direction) { case North: return { x, y - 1 }; case South: return { x, y + 1 }; case West: return { x - 1, y }; case East: return { x + 1, y }; default: throw std::invalid_argument("invalid direction"); } } [[nodiscard]] std::vector<Coord> get_neighbors() const { return {{ {x + 1, y}, {x - 1, y}, {x, y + 1}, {x, y - 1}, }}; } }; template<class V> using Grid = std::unordered_map<Coord, V>; Grid<char> parse_input(std::istream& input); int solve1(std::istream& input); int solve2(std::istream& input); int solve(std::istream& input, bool part2); } namespace { template <class T> inline void hash_combine(std::size_t& s, const T & v) { std::hash<T> h; s^= h(v) + 0x9e3779b9 + (s<< 6) + (s>> 2); } } namespace std { template<> struct hash<Day20::Coord> { size_t operator()(const Day20::Coord& coord) const { size_t s = 0; hash_combine(s, coord.x); hash_combine(s, coord.y); return s; } }; template<class T1, class T2> struct hash<pair<T1, T2>> { size_t operator()(const pair<T1, T2> p) const { size_t s = 0; hash_combine(s, p.first); hash_combine(s, p.second); return s; } }; }
[ "koen.klaren@gmail.com" ]
koen.klaren@gmail.com
79911679725a7ae4724d3992fac67cba6e3b4a00
ece46d54db148fcd1717ae33e9c277e156067155
/SDK/zrxsdk2020/inc/zgeplin2d.h
8a5ae37a9324a6a276fba9605dfec193cfeaad76
[]
no_license
15831944/ObjectArx
ffb3675875681b1478930aeac596cff6f4187ffd
8c15611148264593730ff5b6213214cebd647d23
refs/heads/main
2023-06-16T07:36:01.588122
2021-07-09T10:17:27
2021-07-09T10:17:27
384,473,453
0
1
null
2021-07-09T15:08:56
2021-07-09T15:08:56
null
UTF-8
C++
false
false
816
h
#ifndef ZC_GEPLIN2D_H #define ZC_GEPLIN2D_H #include "zgecurv2d.h" #include "zgekvec.h" #include "zgept2dar.h" #include "zgevec2d.h" #include "zgepnt2d.h" #include "zgesent2d.h" #pragma pack (push, 8) class GE_DLLEXPIMPORT ZcGePolyline2d : public ZcGeSplineEnt2d { public: ZcGePolyline2d(); ZcGePolyline2d(const ZcGePolyline2d& src); ZcGePolyline2d(const ZcGePoint2dArray&); ZcGePolyline2d(const ZcGeKnotVector& knots, const ZcGePoint2dArray& points); ZcGePolyline2d(const ZcGeCurve2d& crv, double apprEps); int numFitPoints () const; ZcGePoint2d fitPointAt (int idx) const; ZcGeSplineEnt2d& setFitPointAt(int idx, const ZcGePoint2d& point); ZcGePolyline2d& operator = (const ZcGePolyline2d& pline); }; #pragma pack (pop) #endif
[ "3494543191@qq.com" ]
3494543191@qq.com
c1b13be00095b909f577af564aae485bd42ed321
fc5fdadbc748f3b3e64145cf389a944ed84526bb
/Firmware_ESP/Firmware_ESP.ino
5a06225ad9dc779d53985bbbaca523b73145d172
[]
no_license
embedded-iot/ESP8266
b97b29b0f89ed6665ddf26a345506c9c72b791ab
b2823f838f72eb334da0b9efeeb540f246012144
refs/heads/master
2018-10-12T19:01:47.003252
2018-03-22T16:21:13
2018-03-22T16:21:13
109,482,656
0
0
null
null
null
null
UTF-8
C++
false
false
10,388
ino
/********************************************** Firmware ESP8266 v1-12 Vision 1.0 Author : Nguyen Van Quan Configuration Default : Serial baud rate : 9600 TCP SERVER PORT 333 ACCESS POINT Command AT: - AT - AT+MODE? - AT+MODE=[mode] - AT+CWJAP? - AT+CWJAP="SSID","Password" - AT+CIFSR - AT+CWSAP? - AT+CWSAP="SSID","Password" - AT+HTTP="request" - AT+CIPCLOSE - AT+CIPSEND="data send" Response: - OK : Command successfuly. - FAIL: Command not successfuly. - Other. *********************************************/ #include <ESP8266WiFi.h> #include <WiFiClient.h> #include <ESP8266HTTPClient.h> #include <EEPROM.h> String ssid = "huy huy"; String password = "19101994"; String ap_ssid = "ESP8266"; String ap_password = ""; int Mode=1; #define DEBUGGING1 #define ADDR 0 #define ADDR_SSID (ADDR+0) #define ADDR_PASS (ADDR+20) #define ADDR_APSSID (ADDR+40) #define ADDR_APPASS (ADDR+60) #define ADDR_MODE (ADDR+80) // Start a TCP Server on port 333 WiFiServer server(333); /* * Function DEBUG */ void DEBUG(String s){ #ifdef DEBUGGING Serial.println(s); #endif } /* * Function Read Config */ void ReadAllConfig() { if ((int)EEPROM.read(ADDR_SSID)<20) ssid=ReadStringFromEEPROM(ADDR_SSID); if ((int)EEPROM.read(ADDR_PASS)<20) password=ReadStringFromEEPROM(ADDR_PASS); if ((int)EEPROM.read(ADDR_APSSID)<20) ap_ssid=ReadStringFromEEPROM(ADDR_APSSID); if ((int)EEPROM.read(ADDR_APPASS)<20) ap_password=ReadStringFromEEPROM(ADDR_APPASS); if ((int)EEPROM.read(ADDR_MODE)==1 || (int)EEPROM.read(ADDR_MODE)==2) Mode=EEPROM.read(ADDR_MODE); else Mode=3; #ifdef DEBUGGING Serial.println("STATION SSID ="+ssid); Serial.println("STATION PASSWORD="+password); Serial.println("ACCESSPOINT SSID="+ap_ssid); Serial.println("ACCESSPOINT PASSWORD="+ap_password); #endif } /* * Function ESP8266 Access Point * Parameter : +nameWifi : Name Access Point * +passWifi : Password Access Point * Note : if passWifi="" then Access Point Mode OPEN * if passWifi.length()>8 then Access Point Mode WPA2 * Return: None. */ void AP_Wifi(String nameWifi,String passWifi) { Serial.println( WiFi.softAP(nameWifi.c_str(),passWifi.c_str()) ? "OK" : "FAIL"); #ifdef DEBUGGING Serial.print("Configuring access point..."); Serial.println(nameWifi+"-"+passWifi); IPAddress myIP = WiFi.softAPIP(); Serial.print("AP IP address: "); Serial.println(myIP); #endif Serial.println("OK"); } /* * Function ESP8266 Connect To Other Access Point * Parameter : +nameWifi : Name Other Access Point * +passWifi : Password Other Access Point * Note : if Access Point Mode OPEN then passWifi="" * if Access Point Mode WPA2 then passWifi.length()>8 * Return: None. */ void ConnectWifi(String nameWifi,String passWifi) { //WiFi.disconnect(); WiFi.begin(nameWifi.c_str(),passWifi.c_str()); #ifdef DEBUGGING Serial.print("Connecting"); #endif int d=0; while (WiFi.status() != WL_CONNECTED && d<60) { delay(100); d=d+1; #ifdef DEBUGGING Serial.print("."); #endif } #ifdef DEBUGGING if (d<60){ Serial.println("IP local :"); Serial.println(WiFi.localIP()); } #endif if (d<60)Serial.println("OK"); else Serial.println("FAIL"); } /* * Function setup */ void setup (){ Serial.begin(9600); Serial.println("Config"); EEPROM.begin(512); ReadAllConfig(); // Read All Config WiFi.disconnect(); if (Mode==3) { WiFi.mode(WIFI_AP_STA); ConnectWifi(ssid,password); //Connect to Access Point AP_Wifi(ap_ssid,ap_password); // ESP8266 Access Point } else if (Mode==1) { WiFi.mode(WIFI_AP); AP_Wifi(ap_ssid,ap_password); // ESP8266 Access Point } else if (Mode==2){ WiFi.mode(WIFI_STA); ConnectWifi(ssid,password); //Connect to Access Point } //ConnectWifi(ssid,password); // ESP8266 connect to other access point server.begin(); // Start the TCP server port 333 Serial.println("Begin"); } /* * Function Save String To EEPROM * Parameter : +data : String Data * +address : address in EEPROM * Return: None. */ void SaveStringToEEPROM(String data,int address) { int len=data.length(); EEPROM.write(address,len); #ifdef DEBUGGING Serial.println("Write lengt "+String(len)+"\n"); #endif for (int i=1;i<=len;i++) EEPROM.write(address+i,data.charAt(i-1)); EEPROM.commit(); } /* * Function Read String From EEPROM * Parameter : +address : address in EEPROM * Return: String. */ String ReadStringFromEEPROM(int address) { String s=""; int len=(int)EEPROM.read(address); #ifdef DEBUGGING Serial.println("Read length "+String(len)+"\n"); #endif for (int i=1;i<=len;i++) s+=(char)EEPROM.read(address+i); return s; } /* * Function HTTP_REQUEST_GET * Parameter : +request : Request GET from ESP To Website (or Address Website) * Example : request= https://www.google.com.vn/?gfe_rd=cr&ei=yBDmWPrYHubc8ge42aawBA&gws_rd=ssl#q=ESP8266&* * Return: Page content. */ void HTTP_REQUEST(String request) { if(WiFi.status()== WL_CONNECTED) { HTTPClient http; //Declare an object of class HTTPClient //String yeucau="http://iotproject.comeze.com/UpData.php?Data="+String(so); //String yeucau="http://managerpower.comli.com/uploaddata.php?user=tranngoctk112&pass=anhngoc1995&data=123;1,2;3,4;4,5;5,25"; //String yeucau="http://iotproject.comeze.com/UpData.php?Data="+s; String yeucau=request; http.begin(yeucau);//Specify request destination int httpCode= http.GET();//Send the request #ifdef DEBUGGING Serial.println(yeucau); Serial.println("http code "+String(httpCode)); #endif if(httpCode>0){ //Check the returning code String payload = http.getString(); //Get the request response payload Serial.println(payload); //Print the response payload } http.end(); //Close connection } } /* * Function SET_AT_COMMAND * Parameter : +commandAT : Command AT Communication ESP * Return: None. */ void SET_AT_COMMAND(String commandAT) { #ifdef DEBUGGING Serial.println("\n"+commandAT); #endif if (commandAT.indexOf("AT")>=0 && commandAT.length()<=4) { Serial.println("OK"); }else if (commandAT.indexOf("AT+MODE?")>=0){ Serial.println("MODE: "+String(Mode)); } else if (commandAT.indexOf("AT+MODE=")>=0){ int index=commandAT.indexOf("="); String m=commandAT.substring(index+1,index+2); #ifdef DEBUGGING Serial.println("MODE: "+m); #endif if (m=="1" || m=="2" || m=="3") { Mode=atoi(m.c_str()); Serial.println("MODE: "+Mode); EEPROM.write(ADDR_MODE,Mode); EEPROM.commit(); Serial.println("OK"); }else Serial.println("FAIL"); } else if (commandAT.indexOf("AT+CWJAP?")>=0){ if (WiFi.status()== WL_CONNECTED) Serial.println(ssid+"-"+password); else Serial.println("No AP"); }else if (commandAT.indexOf("AT+CWJAP=")>=0){ ssid= commandAT.substring(commandAT.indexOf("=\"")+2,commandAT.indexOf("\",\"")); password= commandAT.substring(commandAT.indexOf("\",\"")+3,commandAT.lastIndexOf("\"")); SaveStringToEEPROM(ssid,ADDR_SSID); SaveStringToEEPROM(password,ADDR_PASS); ssid=ReadStringFromEEPROM(ADDR_SSID); password=ReadStringFromEEPROM(ADDR_PASS); #ifdef DEBUGGING Serial.println("EEPROM ssid="+ssid); Serial.println("EEPROM password="+password); #endif ConnectWifi(ssid,password); }else if (commandAT.indexOf("AT+CIFSR")>=0){ Serial.print("+AP:"); Serial.println(WiFi.softAPIP()); if (WiFi.status()== WL_CONNECTED) { Serial.print("+ST:"); Serial.println(WiFi.localIP()); } else Serial.println("No IP"); } else if (commandAT.indexOf("AT+HTTP=")>=0) { String request=commandAT.substring(commandAT.indexOf("AT+HTTP=")+9,commandAT.lastIndexOf("\"")); #ifdef DEBUGGING Serial.println(request); #endif HTTP_REQUEST(request); } else if (commandAT.indexOf("AT+CWSAP?")>=0){ Serial.println(ap_ssid+"-"+ap_password); } else if (commandAT.indexOf("AT+CWSAP=")>=0){ String ap_ssid1= commandAT.substring(commandAT.indexOf("=\"")+2,commandAT.indexOf("\",\"")); String ap_password1= commandAT.substring(commandAT.indexOf("\",\"")+3,commandAT.lastIndexOf("\"")); if (ap_password1.length()==0 || ap_password1.length()>=8) { SaveStringToEEPROM(ap_ssid1,ADDR_APSSID); SaveStringToEEPROM(ap_password1,ADDR_APPASS); ap_ssid=ReadStringFromEEPROM(ADDR_APSSID); ap_password=ReadStringFromEEPROM(ADDR_APPASS); #ifdef DEBUGGING Serial.println("EEPROM ap_ssid="+ap_ssid); Serial.println("EEPROM ap_password="+ap_password); #endif AP_Wifi(ap_ssid,ap_password); }else Serial.println("FAIL"); } } WiFiClient client; void loop() { if (Serial.available()) { String commandAT=Serial.readString(); SET_AT_COMMAND(commandAT); } client = server.available(); if (client) { Serial.println("Client connected."); while (client.connected()) { if (client.available()) { //char command = client.read(); String command = client.readString(); Serial.println("+IPD:"+command); } if (Serial.available()) { String commandAT=Serial.readString(); SET_AT_COMMAND(commandAT); if (commandAT.indexOf("AT+CIPCLOSE")>=0) { client.stop(); Serial.println("OK"); } else if (commandAT.indexOf("AT+CIPSEND=")>=0) { String SendDataToClient=commandAT.substring(commandAT.indexOf("=\"")+2,commandAT.lastIndexOf("\""))+"\r\n"; #ifdef DEBUGGING Serial.println(SendDataToClient); #endif client.write(SendDataToClient.c_str()); Serial.println("SEND OK"); } } delay(10); } client.stop(); Serial.println("Client disconnected"); } delay(10); }
[ "nguyenquan5895@gmail.com" ]
nguyenquan5895@gmail.com
0fa008f1a17267d01323feb30ea64f1068928196
d7fa4cc8510202f391a7c667d22205ec39f3c1cd
/Hrishikesh Dombe/Assignments/PP_Windows/24.06.2018/03-RTR_Tessellation_Shader_With_Change/01-RTR_Tessellation_Shader_With_Change.cpp
04c3f7fd143ff9643668607f494dc2f94006bcea
[]
no_license
RohitMagdum-VSI/VSIOpenGLDemos
f21ae6a91d41bbe3136e92c9c2eed985d3488607
763e2e3cc956122c5aad756961feb7259396d479
refs/heads/master
2022-02-21T21:42:53.601810
2022-02-10T13:51:24
2022-02-10T13:51:24
120,849,630
2
0
null
null
null
null
UTF-8
C++
false
false
16,076
cpp
#include<windows.h> #include<C:\glew\include\GL\glew.h> #include<gl/GL.h> #include<stdio.h> #include"../../Resources/vmath.h" #pragma comment(lib,"User32.lib") #pragma comment(lib,"GDI32.lib") #pragma comment(lib,"C:\\glew\\lib\\Release\\Win32\\glew32.lib") #pragma comment(lib,"opengl32.lib") #define WIN_WIDTH 800 #define WIN_HEIGHT 600 using namespace vmath; enum { HAD_ATTRIBUTE_POSITION = 0, HAD_ATTRIBUTE_COLOR, HAD_ATTRIBUTE_NORMAL, HAD_ATTRIBUTE_TEXTURE0, }; LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); FILE *gpFile; HWND ghwnd; HDC ghdc; HGLRC ghrc; DWORD dwStyle; WINDOWPLACEMENT wpPrev = { sizeof(WINDOWPLACEMENT) }; bool gbActiveWindow = false; bool gbFullscreen = false; bool gbIsEscapeKeyPressed = false; GLuint gVertexShaderObject; GLuint gTessellationControlShaderObject; GLuint gTessellationEvaluationShaderObject; GLuint gFragmentShaderObject; GLuint gShaderProgramObject; GLuint gVao; GLuint gVbo; GLuint gMVPUniform; GLuint gNumberOfSegmentsUniform; GLuint gNumberOfStripsUniform; GLuint gLineColorUniform; mat4 gPerspectiveProjectionMatrix; unsigned int gNumberOfLineSegments; int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int iCmdShow) { void initialize(void); void display(void); void uninitialize(int); WNDCLASSEX wndclass; HWND hwnd; MSG msg; TCHAR szClassName[] = TEXT("My App"); bool bDone = false; if (fopen_s(&gpFile, "Log.txt", "w") != NULL) { MessageBox(NULL, TEXT("Cannot Create Log File !!!"), TEXT("Error"), MB_OK); exit(EXIT_FAILURE); } else fprintf(gpFile, "Log File Created Successfully...\n"); wndclass.cbSize = sizeof(WNDCLASSEX); wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.lpszClassName = szClassName; wndclass.lpszMenuName = NULL; wndclass.lpfnWndProc = WndProc; wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION); wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); RegisterClassEx(&wndclass); hwnd = CreateWindowEx(WS_EX_APPWINDOW, szClassName, TEXT("Tessellation Shader"), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE, 100, 100, WIN_WIDTH, WIN_HEIGHT, NULL, NULL, hInstance, NULL); if (hwnd == NULL) { fprintf(gpFile, "Cannot Create Window...\n"); uninitialize(1); } ghwnd = hwnd; ShowWindow(hwnd, iCmdShow); SetFocus(hwnd); SetForegroundWindow(hwnd); initialize(); while (bDone == false) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) bDone = true; else { TranslateMessage(&msg); DispatchMessage(&msg); } } else { if (gbActiveWindow == true) { if (gbIsEscapeKeyPressed == true) bDone = true; display(); } } } uninitialize(0); return((int)msg.wParam); } LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { void resize(int, int); void ToggleFullscreen(void); static WORD xMouse = NULL; static WORD yMouse = NULL; switch (iMsg) { case WM_ACTIVATE: if (HIWORD(wParam) == 0) gbActiveWindow = true; else gbActiveWindow = false; break; case WM_CREATE: break; case WM_SIZE: resize(LOWORD(lParam), HIWORD(lParam)); break; case WM_KEYDOWN: switch (wParam) { case VK_ESCAPE: gbIsEscapeKeyPressed = true; break; case VK_UP: gNumberOfLineSegments++; if (gNumberOfLineSegments >= 50) gNumberOfLineSegments = 50; break; case VK_DOWN: gNumberOfLineSegments--; if (gNumberOfLineSegments <= 0) gNumberOfLineSegments = 1; break; case 0x46: if (gbFullscreen == false) { ToggleFullscreen(); gbFullscreen = true; } else { ToggleFullscreen(); gbFullscreen = false; } break; } break; case WM_DESTROY: PostQuitMessage(0); break; } return(DefWindowProc(hwnd, iMsg, wParam, lParam)); } void initialize(void) { void resize(int, int); void uninitialize(int); PIXELFORMATDESCRIPTOR pfd; int iPixelFormatIndex; ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR)); pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); pfd.nVersion = 1; pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 24; pfd.cRedBits = 8; pfd.cGreenBits = 8; pfd.cBlueBits = 8; pfd.cAlphaBits = 8; pfd.cDepthBits = 32; ghdc = GetDC(ghwnd); if (ghdc == NULL) { fprintf(gpFile, "GetDC() Failed.\n"); uninitialize(1); } iPixelFormatIndex = ChoosePixelFormat(ghdc, &pfd); if (iPixelFormatIndex == 0) { fprintf(gpFile, "ChoosePixelFormat() Failed.\n"); uninitialize(1); } if (SetPixelFormat(ghdc, iPixelFormatIndex, &pfd) == FALSE) { fprintf(gpFile, "SetPixelFormat() Failed.\n"); uninitialize(1); } ghrc = wglCreateContext(ghdc); if (ghrc == NULL) { fprintf(gpFile, "wglCreateContext() Failed.\n"); uninitialize(1); } if (wglMakeCurrent(ghdc, ghrc) == FALSE) { fprintf(gpFile, "wglMakeCurrent() Failed"); uninitialize(1); } GLenum glew_error = glewInit(); if (glew_error != GLEW_OK) { wglDeleteContext(ghrc); ghrc = NULL; ReleaseDC(ghwnd, ghdc); ghdc = NULL; } //Vertex Shader gVertexShaderObject = glCreateShader(GL_VERTEX_SHADER); const GLchar *vertexShaderSourceCode = "#version 450 core" \ "\n" \ "in vec2 vPosition;" \ "void main(void)" \ "{" \ "gl_Position = vec4(vPosition,0.0,1.0);" \ "}"; glShaderSource(gVertexShaderObject, 1, (const GLchar **)&vertexShaderSourceCode, NULL); glCompileShader(gVertexShaderObject); GLint iInfoLogLength = 0; GLint iShaderCompiledStatus = 0; char *szInfoLog = NULL; glGetShaderiv(gVertexShaderObject, GL_COMPILE_STATUS, &iShaderCompiledStatus); if (iShaderCompiledStatus == GL_FALSE) { glGetShaderiv(gVertexShaderObject, GL_INFO_LOG_LENGTH, &iInfoLogLength); if (iInfoLogLength > 0) { szInfoLog = (char *)malloc(iInfoLogLength); if (szInfoLog != NULL) { GLsizei written; glGetShaderInfoLog(gVertexShaderObject, iInfoLogLength, &written, szInfoLog); fprintf(gpFile, "Vertex Shader Compilation Log : %s\n",szInfoLog); free(szInfoLog); uninitialize(1); exit(0); } } } //Tessellation Control Shader gTessellationControlShaderObject = glCreateShader(GL_TESS_CONTROL_SHADER); const GLchar *tessellationControlShaderSourceCode = "#version 450" \ "\n" \ "layout(vertices=4)out;" \ "uniform int numberOfSegments;" \ "uniform int numberOfStrips;" \ "void main(void)" \ "{" \ "gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;" \ "gl_TessLevelOuter[0] = float(numberOfStrips);" \ "gl_TessLevelOuter[1] = float(numberOfSegments);" \ "}"; glShaderSource(gTessellationControlShaderObject, 1, (const GLchar **)&tessellationControlShaderSourceCode, NULL); glCompileShader(gTessellationControlShaderObject); iInfoLogLength = 0; iShaderCompiledStatus = 0; //*szInfoLog = NULL; glGetShaderiv(gTessellationControlShaderObject, GL_COMPILE_STATUS, &iShaderCompiledStatus); if (iShaderCompiledStatus == GL_FALSE) { glGetShaderiv(gTessellationControlShaderObject, GL_INFO_LOG_LENGTH, &iInfoLogLength); if (iInfoLogLength > 0) { szInfoLog = (char *)malloc(iInfoLogLength); if (szInfoLog != NULL) { GLsizei written; glGetShaderInfoLog(gTessellationControlShaderObject, iInfoLogLength, &written, szInfoLog); fprintf(gpFile, "Tessellation Control Shader Compilation Log : %s\n", szInfoLog); free(szInfoLog); uninitialize(1); exit(0); } } } //Tessellation Evaluation Shader gTessellationEvaluationShaderObject = glCreateShader(GL_TESS_EVALUATION_SHADER); const GLchar *tessellationEvaluationShaderSourceCode = "#version 450 core" \ "\n" \ "layout(isolines)in;" \ "uniform mat4 u_mvp_matrix;" \ "void main(void)" \ "{" \ "float u = gl_TessCoord.x;" \ "vec3 p0 = gl_in[0].gl_Position.xyz;" \ "vec3 p1 = gl_in[1].gl_Position.xyz;" \ "vec3 p2 = gl_in[2].gl_Position.xyz;" \ "vec3 p3 = gl_in[3].gl_Position.xyz;" \ "float u1 = (1.0 - u);" \ "float u2 = u * u;" \ "float b3 = u2 * u;" \ "float b2 = 3.0 * u2 * u1;" \ "float b1 = 3.0 * u * u1 * u1;" \ "float b0 = u1 * u1 * u1;" \ "vec3 p = p0 * b0 + p1 * b1 + p2 * b2 + p3 * b3;" \ "gl_Position = u_mvp_matrix * vec4(p, 1.0);" \ "}"; glShaderSource(gTessellationEvaluationShaderObject, 1, (const GLchar **)&tessellationEvaluationShaderSourceCode, NULL); glCompileShader(gTessellationEvaluationShaderObject); iInfoLogLength = 0; iShaderCompiledStatus = 0; //*szInfoLog = NULL; glGetShaderiv(gTessellationEvaluationShaderObject, GL_COMPILE_STATUS, &iShaderCompiledStatus); if (iShaderCompiledStatus == GL_FALSE) { glGetShaderiv(gTessellationEvaluationShaderObject, GL_INFO_LOG_LENGTH, &iInfoLogLength); if (iInfoLogLength > 0) { szInfoLog = (char *)malloc(iInfoLogLength); if (szInfoLog != NULL) { GLsizei written; glGetShaderInfoLog(gTessellationEvaluationShaderObject, iInfoLogLength, &written, szInfoLog); fprintf(gpFile, "Tessellation Evaluation Shader Compilation Log : %s\n", szInfoLog); free(szInfoLog); uninitialize(1); exit(0); } } } //Fragment Shader gFragmentShaderObject = glCreateShader(GL_FRAGMENT_SHADER); const GLchar *fragmentShaderSourceCode = "#version 450 core"\ "\n"\ "uniform vec4 lineColor;" \ "out vec4 FragColor;"\ "void main(void)"\ "{"\ "FragColor = lineColor;"\ "}"; glShaderSource(gFragmentShaderObject, 1, (const GLchar **)&fragmentShaderSourceCode, NULL); glCompileShader(gFragmentShaderObject); glGetShaderiv(gFragmentShaderObject, GL_COMPILE_STATUS, &iShaderCompiledStatus); if (iShaderCompiledStatus == GL_FALSE) { glGetShaderiv(gFragmentShaderObject, GL_INFO_LOG_LENGTH, &iInfoLogLength); if (iInfoLogLength > 0) { szInfoLog = (char*)malloc(iInfoLogLength); if (szInfoLog != NULL) { GLsizei written; glGetShaderInfoLog(gFragmentShaderObject, iInfoLogLength, &written, szInfoLog); fprintf(gpFile, "Fragment Shader Compilation Log : %s\n", szInfoLog); free(szInfoLog); uninitialize(1); exit(0); } } } //Shader Program gShaderProgramObject = glCreateProgram(); glAttachShader(gShaderProgramObject, gVertexShaderObject); glAttachShader(gShaderProgramObject, gTessellationControlShaderObject); glAttachShader(gShaderProgramObject, gTessellationEvaluationShaderObject); glAttachShader(gShaderProgramObject, gFragmentShaderObject); glBindAttribLocation(gShaderProgramObject, HAD_ATTRIBUTE_POSITION, "vPosition"); glLinkProgram(gShaderProgramObject); GLint iShaderProgramLinkStatus = 0; glGetProgramiv(gShaderProgramObject, GL_LINK_STATUS, &iShaderProgramLinkStatus); if (iShaderProgramLinkStatus == GL_FALSE) { glGetProgramiv(gShaderProgramObject, GL_INFO_LOG_LENGTH, &iInfoLogLength); if (iInfoLogLength > 0) { szInfoLog = (char *)malloc(iInfoLogLength); if (szInfoLog != NULL) { GLsizei written; glGetProgramInfoLog(gShaderProgramObject, iInfoLogLength, &written, szInfoLog); fprintf(gpFile, "Shader Program Link Log : %s\n", szInfoLog); free(szInfoLog); uninitialize(1); exit(0); } } } gMVPUniform = glGetUniformLocation(gShaderProgramObject, "u_mvp_matrix"); gNumberOfSegmentsUniform = glGetUniformLocation(gShaderProgramObject, "numberOfSegments"); gNumberOfStripsUniform = glGetUniformLocation(gShaderProgramObject, "numberOfStrips"); gLineColorUniform = glGetUniformLocation(gShaderProgramObject, "lineColor"); const GLfloat vertices[] = { -1.0f,-1.0f, -0.5f,1.0f, 0.5f,-1.0f, 1.0f,1.0f }; glGenVertexArrays(1, &gVao); glBindVertexArray(gVao); glGenBuffers(1, &gVbo); glBindBuffer(GL_ARRAY_BUFFER, gVbo); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); glVertexAttribPointer(HAD_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, NULL); glEnableVertexAttribArray(HAD_ATTRIBUTE_POSITION); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glShadeModel(GL_SMOOTH); glHint(GL_PERSPECTIVE_CORRECTION_HINT , GL_NICEST); glEnable(GL_CULL_FACE); glLineWidth(3.0f); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gPerspectiveProjectionMatrix = mat4::identity(); gNumberOfLineSegments = 1; resize(WIN_WIDTH, WIN_HEIGHT); } void display(void) { TCHAR str[255]; glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); //Use Shader Program Object glUseProgram(gShaderProgramObject); mat4 modelViewMatrix = mat4::identity(); mat4 modelViewProjectionMatrix = mat4::identity(); modelViewMatrix = translate(0.0f, 0.0f, -4.0f); modelViewProjectionMatrix = gPerspectiveProjectionMatrix*modelViewMatrix; glUniformMatrix4fv(gMVPUniform, 1, GL_FALSE, modelViewProjectionMatrix); glUniform1i(gNumberOfSegmentsUniform, gNumberOfLineSegments); glUniform1i(gNumberOfStripsUniform, 1); glUniform4fv(gLineColorUniform, 1, vmath::vec4(0.0f, 0.0f, 1.0f, 1.0f)); wsprintf(str, TEXT("Tessellation Shader : Segments = %d"), gNumberOfLineSegments); SetWindowText(ghwnd, str); glBindVertexArray(gVao); glPatchParameteri(GL_PATCH_VERTICES, 4); glDrawArrays(GL_PATCHES, 0, 4); glBindVertexArray(0); glUseProgram(0); SwapBuffers(ghdc); } void resize(int width, int height) { if (height == 0) height = 1; glViewport(0, 0, (GLsizei)width, (GLsizei)height); gPerspectiveProjectionMatrix = perspective(45.0f, (GLfloat)width / (GLfloat)height, 0.1f, 100.0f); } void ToggleFullscreen(void) { MONITORINFO mi = { sizeof(MONITORINFO) }; if (gbFullscreen == false) { dwStyle = GetWindowLong(ghwnd, GWL_STYLE); if (dwStyle & WS_OVERLAPPEDWINDOW) { if (GetWindowPlacement(ghwnd, &wpPrev) && GetMonitorInfo(MonitorFromWindow(ghwnd, MONITORINFOF_PRIMARY), &mi)) { SetWindowLong(ghwnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW); SetWindowPos(ghwnd, HWND_TOP, mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right - mi.rcMonitor.left, mi.rcMonitor.bottom - mi.rcMonitor.top, SWP_NOZORDER | SWP_FRAMECHANGED); } } ShowCursor(FALSE); } else { SetWindowLong(ghwnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW); SetWindowPlacement(ghwnd, &wpPrev); SetWindowPos(ghwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED); ShowCursor(TRUE); } } void uninitialize(int i_Exit_Flag) { if (gbFullscreen == false) { SetWindowLong(ghwnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW); SetWindowPlacement(ghwnd, &wpPrev); SetWindowPos(ghwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED); ShowCursor(TRUE); } if (gVao) { glDeleteVertexArrays(1, &gVao); gVao = 0; } if (gVbo) { glDeleteBuffers(1, &gVbo); gVbo = 0; } //Detach Shader glDetachShader(gShaderProgramObject, gVertexShaderObject); glDetachShader(gShaderProgramObject, gTessellationControlShaderObject); glDetachShader(gShaderProgramObject, gTessellationEvaluationShaderObject); glDetachShader(gShaderProgramObject, gFragmentShaderObject); //Delete Shader glDeleteShader(gVertexShaderObject); gVertexShaderObject = 0; glDeleteShader(gTessellationControlShaderObject); gTessellationControlShaderObject = 0; glDeleteShader(gTessellationEvaluationShaderObject); gTessellationEvaluationShaderObject = 0; glDeleteShader(gFragmentShaderObject); gFragmentShaderObject = 0; //Delete Program glDeleteProgram(gShaderProgramObject); gShaderProgramObject = 0; //Stray call to glUseProgram(0) glUseProgram(0); wglMakeCurrent(NULL, NULL); if (ghrc != NULL) { wglDeleteContext(ghrc); ghrc = NULL; } if (ghdc != NULL) { ReleaseDC(ghwnd, ghdc); ghdc = NULL; } if (i_Exit_Flag == 0) { fprintf(gpFile, "Log File Closed Successfully"); } else if (i_Exit_Flag == 1) { fprintf(gpFile, "Log File Closed Erroniously"); } fclose(gpFile); gpFile = NULL; DestroyWindow(ghwnd); }
[ "hrishikeshdombe@gmail.com" ]
hrishikeshdombe@gmail.com
d43dd18aee7fabfc49952da7e954c77561f3fb90
fd3ce5a0d0a394c20527952a3406dad6c63a1a1b
/src/redispp.h
829ce9f7216ea7e20f3640b4efa4fd6c5d7f61b4
[]
no_license
fly2mars/AssistantPlus
b1476ead0793419d2b26de48ff847dc1d6cfec5d
91ac55530796a16018b0eb36ec2f97ffa8b186da
refs/heads/master
2023-07-06T11:10:11.350076
2023-06-27T14:21:51
2023-06-27T14:21:51
74,630,154
3
0
null
null
null
null
UTF-8
C++
false
false
15,385
h
#pragma once #include <string> #include <string.h> #include <stdexcept> #include <iostream> #include <memory> #include <list> #include <boost/intrusive/list.hpp> #include <boost/noncopyable.hpp> #include <boost/optional.hpp> namespace redispp { class NullReplyException : std::out_of_range { public: NullReplyException(); }; struct Command { Command(const char* cmdName, size_t numArgs); virtual ~Command(); template<typename BufferType> void execute(BufferType const& dest) { dest->write(header); } template<typename T, typename BufferType> void execute(T const& arg1, BufferType const& dest) { dest->write(header); dest->writeArg(arg1); } template<typename T1, typename T2, typename BufferType> void execute(T1 const& arg1, T2 const& arg2, BufferType const& dest) { dest->write(header); dest->writeArg(arg1); dest->writeArg(arg2); } template<typename T1, typename T2, typename T3, typename BufferType> void execute(T1 const& arg1, T2 const& arg2, T3 const& arg3, BufferType const& dest) { dest->write(header); dest->writeArg(arg1); dest->writeArg(arg2); dest->writeArg(arg3); } std::string header; }; #define DEFINE_COMMAND(name, args) \ struct name ## Command : public Command \ { \ name ## Command() \ : Command(#name, args) \ {} \ }; \ name ## Command _ ## name ## Command; enum Type { None, String, List, Set, ZSet, Hash, }; class Connection; class ClientSocket; class Buffer; typedef boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::auto_unlink> > auto_unlink_hook; class BaseReply : public auto_unlink_hook { friend class Connection; public: BaseReply() : conn(NULL) {} BaseReply(const BaseReply& other); BaseReply& operator=(const BaseReply& other); virtual ~BaseReply() {} protected: virtual void readResult() = 0; void clearPendingResults(); BaseReply(Connection* conn); mutable Connection* conn; }; typedef boost::intrusive::list<BaseReply, boost::intrusive::constant_time_size<false> > ReplyList; class Transaction; enum TransactionState { Blank, Dirty, Aborted, Committed, }; class QueuedReply : public BaseReply { friend class BaseReply; friend class Connection; friend class Transaction; public: QueuedReply() : count(0), state(Blank) {} ~QueuedReply() {} protected: virtual void readResult(); private: QueuedReply(Connection* conn) : BaseReply(conn), count(0), state(Blank) {} size_t count; TransactionState state; }; class VoidReply : public BaseReply { friend class Connection; public: VoidReply() : storedResult(false) {} ~VoidReply(); VoidReply(const VoidReply& other) : BaseReply(other), storedResult(other.storedResult) {} VoidReply& operator=(const VoidReply& other) { result(); BaseReply::operator=(other); storedResult = other.storedResult; return *this; } bool result(); operator bool() { return result(); } protected: virtual void readResult() { result(); } private: VoidReply(Connection* conn); bool storedResult; }; class BoolReply : public BaseReply { friend class Connection; public: BoolReply() : storedResult(false) {} ~BoolReply(); BoolReply(const BoolReply& other) : BaseReply(other), storedResult(other.storedResult) {} BoolReply& operator=(const BoolReply& other) { result(); BaseReply::operator=(other); storedResult = other.storedResult; return *this; } bool result(); operator bool() { return result(); } protected: virtual void readResult() { result(); } private: BoolReply(Connection* conn); bool storedResult; }; class IntReply : public BaseReply { friend class Connection; public: IntReply() : storedResult(0) {} ~IntReply(); IntReply(const IntReply& other) : BaseReply(other), storedResult(other.storedResult) {} IntReply& operator=(const IntReply& other) { result(); BaseReply::operator=(other); storedResult = other.storedResult; return *this; } int64_t result(); operator int() { return (int)result(); } protected: virtual void readResult() { result(); } private: IntReply(Connection* conn); int64_t storedResult; }; class StringReply : public BaseReply { friend class Connection; public: StringReply() {} ~StringReply(); StringReply(const StringReply& other) : BaseReply(other), storedResult(other.storedResult) {} StringReply& operator=(const StringReply& other) { result(); BaseReply::operator=(other); storedResult = other.storedResult; return *this; } const boost::optional<std::string>& result(); operator std::string() { result(); if (!storedResult) { throw NullReplyException(); } return *storedResult; } protected: virtual void readResult() { result(); } private: StringReply(Connection* conn); boost::optional<std::string> storedResult; }; class MultiBulkEnumerator : public BaseReply { friend class Connection; public: MultiBulkEnumerator() : headerDone(false), count(0) {} ~MultiBulkEnumerator(); MultiBulkEnumerator(const MultiBulkEnumerator& other) : BaseReply(other), headerDone(other.headerDone), count(other.count) { pending.splice(pending.begin(), other.pending); } MultiBulkEnumerator& operator=(const MultiBulkEnumerator& other) { if(conn && count > 0) { //assume unread data can be discarded, this is the only object that could/would have read it std::string tmp; while(next(&tmp)); } pending.clear(); BaseReply::operator=(other); headerDone = other.headerDone; count = other.count; return *this; } bool nextOptional(boost::optional<std::string> &out); bool next(std::string* out); protected: virtual void readResult() { if(conn && (!headerDone || count > 0)) { std::list<boost::optional<std::string> > readPending; boost::optional<std::string> tmp; while(nextOptional(tmp)) { readPending.push_back(tmp); } pending.splice(pending.end(), readPending); } } MultiBulkEnumerator(Connection* conn); bool headerDone; int count; mutable std::list<boost::optional<std::string> > pending; }; class Connection; class Transaction : boost::noncopyable { friend class BaseReply; public: Transaction(Connection* conn); ~Transaction(); void commit(); void abort(); private: Connection* conn; QueuedReply replies; }; class Connection { friend class BaseReply; friend class QueuedReply; friend class VoidReply; friend class BoolReply; friend class IntReply; friend class StringReply; friend class MultiBulkEnumerator; friend class Transaction; public: static const size_t kDefaultBufferSize = 4 * 1024; Connection(const std::string& host, const std::string& port, const std::string& password, bool noDelay = false, size_t bufferSize = kDefaultBufferSize); #ifndef _WIN32 Connection(const std::string& unixDomainSocket, const std::string& password, size_t bufferSize = kDefaultBufferSize); #endif ~Connection(); void quit(); VoidReply authenticate(const char* password); BoolReply exists(const std::string& name); BoolReply del(const std::string& name); Type type(const std::string& name); MultiBulkEnumerator keys(const std::string& pattern); StringReply randomKey(); VoidReply rename(const std::string& oldName, const std::string& newName); BoolReply renameNX(const std::string& oldName, const std::string& newName); IntReply dbSize(); BoolReply expire(const std::string& name, int seconds); BoolReply expireAt(const std::string& name, int timestamp); //TODO: persist IntReply ttl(const std::string& name); VoidReply select(int db); BoolReply move(const std::string& name, int db); VoidReply flushDb(); VoidReply flushAll(); VoidReply set(const std::string& name, const std::string& value); StringReply get(const std::string& name); //TODO: mget StringReply getSet(const std::string& name, const std::string& value); BoolReply setNX(const std::string& name, const std::string& value); VoidReply setEx(const std::string& name, int time, const std::string& value); //TODO: mset //TODO: msetnx IntReply incr(const std::string& name); IntReply incrBy(const std::string& name, int value); IntReply decr(const std::string& name); IntReply decrBy(const std::string& name, int value); IntReply append(const std::string& name, const std::string& value); StringReply subStr(const std::string& name, int start, int end); IntReply rpush(const std::string& key, const std::string& value); IntReply lpush(const std::string& key, const std::string& value); IntReply llen(const std::string& key); MultiBulkEnumerator lrange(const std::string& key, int start, int end); VoidReply ltrim(const std::string& key, int start, int end); StringReply lindex(const std::string& key, int index); VoidReply lset(const std::string& key, int index, const std::string& value); IntReply lrem(const std::string& key, int count, const std::string& value); StringReply lpop(const std::string& key); StringReply rpop(const std::string& key); //TODO: blpop //TODO: brpop StringReply rpopLpush(const std::string& src, const std::string& dest); BoolReply sadd(const std::string& key, const std::string& member); BoolReply srem(const std::string& key, const std::string& member); StringReply spop(const std::string& key); BoolReply smove(const std::string& src, const std::string& dest, const std::string& member); IntReply scard(const std::string& key); BoolReply sisMember(const std::string& key, const std::string& member); //TODO: sinter //TODO: sinterstore //TODO: sunion //TODO: sunionstore //TODO: sdiff //TODO: sdiffstore MultiBulkEnumerator smembers(const std::string& key); StringReply srandMember(const std::string& key); //TODO: all Z* functions BoolReply hset(const std::string& key, const std::string& field, const std::string& value); StringReply hget(const std::string& key, const std::string& field); BoolReply hsetNX(const std::string& key, const std::string& field, const std::string& value); IntReply hincrBy(const std::string& key, const std::string& field, int value); BoolReply hexists(const std::string& key, const std::string& field); BoolReply hdel(const std::string& key, const std::string& field); IntReply hlen(const std::string& key); MultiBulkEnumerator hkeys(const std::string& key); MultiBulkEnumerator hvals(const std::string& key); MultiBulkEnumerator hgetAll(const std::string& key); VoidReply save(); VoidReply bgSave(); VoidReply bgReWriteAOF(); IntReply lastSave(); void shutdown(); StringReply info(); void subscribe(const std::string& channel); void unsubscribe(const std::string& channel); void psubscribe(const std::string& channel); void punsubscribe(const std::string& channel); IntReply publish(const std::string& channel, const std::string& message); private: void readStatusCodeReply(std::string* out); std::string readStatusCodeReply(); int64_t readIntegerReply(); void readBulkReply(boost::optional<std::string> &out); boost::optional<std::string> readBulkReply(); std::auto_ptr<ClientSocket> connection; std::auto_ptr<std::iostream> ioStream; std::auto_ptr<Buffer> buffer; ReplyList outstandingReplies; Transaction* transaction; DEFINE_COMMAND(Quit, 0); DEFINE_COMMAND(Auth, 1); DEFINE_COMMAND(Exists, 1); DEFINE_COMMAND(Del, 1); DEFINE_COMMAND(Type, 1); DEFINE_COMMAND(Keys, 1); DEFINE_COMMAND(RandomKey, 0); DEFINE_COMMAND(Rename, 2); DEFINE_COMMAND(RenameNX, 2); DEFINE_COMMAND(DbSize, 0); DEFINE_COMMAND(Expire, 2); DEFINE_COMMAND(ExpireAt, 2); DEFINE_COMMAND(Persist, 1); DEFINE_COMMAND(Ttl, 1); DEFINE_COMMAND(Select, 1); DEFINE_COMMAND(Move, 2); DEFINE_COMMAND(FlushDb, 0); DEFINE_COMMAND(FlushAll, 0); DEFINE_COMMAND(Set, 2); DEFINE_COMMAND(Get, 1); DEFINE_COMMAND(GetSet, 2); DEFINE_COMMAND(SetNX, 2); DEFINE_COMMAND(SetEx, 3); DEFINE_COMMAND(Incr, 1); DEFINE_COMMAND(IncrBy, 2); DEFINE_COMMAND(Decr, 1); DEFINE_COMMAND(DecrBy, 2); DEFINE_COMMAND(Append, 2); DEFINE_COMMAND(SubStr, 3); DEFINE_COMMAND(RPush, 2); DEFINE_COMMAND(LPush, 2); DEFINE_COMMAND(LLen, 1); DEFINE_COMMAND(LRange, 3); DEFINE_COMMAND(LTrim, 3); DEFINE_COMMAND(LIndex, 2); DEFINE_COMMAND(LSet, 3); DEFINE_COMMAND(LRem, 3); DEFINE_COMMAND(LPop, 1); DEFINE_COMMAND(RPop, 1); //TODO: blpop //TODO: brpop DEFINE_COMMAND(RPopLPush, 2); //TODO: sort DEFINE_COMMAND(SAdd, 2); DEFINE_COMMAND(SRem, 2); DEFINE_COMMAND(SPop, 1); DEFINE_COMMAND(SMove, 3); DEFINE_COMMAND(SCard, 1); DEFINE_COMMAND(SIsMember, 2); //TODO: sinter //TODO: sinterstore //TODO: sunion //TODO: sunionstore //TODO: sdiff //TODO: sdiffstore DEFINE_COMMAND(SMembers, 1); DEFINE_COMMAND(SRandMember, 1); DEFINE_COMMAND(ZAdd, 2); DEFINE_COMMAND(ZRem, 2); DEFINE_COMMAND(ZIncrBy, 3); DEFINE_COMMAND(ZRank, 2); DEFINE_COMMAND(ZRevRank, 2); DEFINE_COMMAND(ZRange, 3); DEFINE_COMMAND(ZRevRange, 3); DEFINE_COMMAND(ZRangeByScore, 3); DEFINE_COMMAND(ZCount, 3); DEFINE_COMMAND(ZRemRangeByRank, 3); DEFINE_COMMAND(ZRemRangeByScore, 3); DEFINE_COMMAND(ZCard, 1); DEFINE_COMMAND(ZScore, 2); //TODO: zunionstore //TODO: zinterstore DEFINE_COMMAND(HSet, 3); DEFINE_COMMAND(HSetNX, 3); DEFINE_COMMAND(HGet, 2); //TODO: HMGet //TODO: HMSet DEFINE_COMMAND(HIncrBy, 3); DEFINE_COMMAND(HExists, 2); DEFINE_COMMAND(HDel, 2); DEFINE_COMMAND(HLen, 1); DEFINE_COMMAND(HKeys, 1); DEFINE_COMMAND(HVals, 1); DEFINE_COMMAND(HGetAll, 1); DEFINE_COMMAND(Save, 0); DEFINE_COMMAND(BgSave, 0); DEFINE_COMMAND(LastSave, 0); DEFINE_COMMAND(Shutdown, 0); DEFINE_COMMAND(BgReWriteAOF, 0); DEFINE_COMMAND(Info, 0); DEFINE_COMMAND(Subscribe, 1); DEFINE_COMMAND(Unsubscribe, 1); DEFINE_COMMAND(PSubscribe, 1); DEFINE_COMMAND(PUnsubscribe, 1); DEFINE_COMMAND(Publish, 2); //TODO: watch //TODO: unwatch DEFINE_COMMAND(Multi, 0); DEFINE_COMMAND(Exec, 0); DEFINE_COMMAND(Discard, 0); void multi(); void exec(); void discard(); }; };
[ "fly2mars@hotmail.com" ]
fly2mars@hotmail.com
bfd8cb4fd9c97f715b486e85efdef5d1d7f36823
ffdf5b81ffecef840bc2a96b76c1c483848a5f70
/JSON.h
53b565f58af60d069a6b4bef543a1ecfc9888150
[]
no_license
vbence121/SZE-MOSZE-2020-VoicePlay
e4574116137a55fda92ecb9fff4ac0adb902c6d6
d1661ff4d9a1a348da6a765de8305ed6dbdecddc
refs/heads/master
2023-01-23T20:25:28.015901
2020-12-01T15:22:52
2020-12-01T15:22:52
318,931,099
0
0
null
2020-12-06T02:07:11
2020-12-06T02:07:11
null
UTF-8
C++
false
false
2,500
h
#pragma once #include <sstream> // std::istringstream #include <map> #include <list> #include <fstream> #include <exception> #include <algorithm> #include <string> #include <iostream> #include <variant> #include <fstream> class JSON{ public: class list { std::list<std::variant<std::string, int, double>> List; public: list(std::list<std::variant<std::string, int, double>> ls) : List(ls){} auto begin(){ return List.begin(); } auto end(){ return List.end(); } friend bool operator==(const list& lh, const list& rh){ return lh.List == rh.List; } }; private: std::map<std::string, std::variant<std::string, int, double, JSON::list>> content; static std::string rFVbQ (std::string st){ // alias: returnFirstValuebetweenQuotationmarks, finds the first substd::string that sits between " marks and returns it auto fstr = st.find('"'); if (fstr == std::string::npos) return st; // if doesn't return st auto sstr = st.substr(fstr+1).find('"'); if (sstr == std::string::npos) return st; // if doesn't return st return st.substr(fstr+1,sstr); } public: JSON(){} JSON(std::map<std::string, std::variant<std::string, int, double, JSON::list>> cont) : content(cont) {} static std::map<std::string, std::variant<std::string, int, double, JSON::list>> parseFromIstr(std::stringstream& f); static JSON parseFromFile(std::string fname){ std::ifstream f(fname); std::string t,w; if (!f) throw fname+" file does not exist!" ; while (!f.eof()) { std::getline(f,t); w+=t+'\n'; } f.close(); std::stringstream istr(w); std::map<std::string, std::variant<std::string, int, double, JSON::list>> res = JSON::parseFromIstr(istr); return JSON(res); } static JSON parseFromString(std::string str){ std::stringstream f(str); std::map<std::string, std::variant<std::string, int, double, JSON::list>> res = JSON::parseFromIstr(f); return JSON(res); } JSON operator= (std::map<std::string, std::variant<std::string, int, double, JSON::list>> other) { JSON json(other); return json; } template<typename T> T get(const std::string& key){ T returner = std::get<T>(content.at(key)); return returner; } int count(const std::string& key) { if (content.count(key)) return 1; return 0; } class ParseException : std::exception{ public: ParseException() {} }; };
[ "vbence121@gmail.com" ]
vbence121@gmail.com
051f21cf7ae2aae20fe325924c6503e9a67b0ec4
b1aef802c0561f2a730ac3125c55325d9c480e45
/src/ripple/app/paths/cursor/EffectiveRate.h
06f83e5553ad1b1dab1fe5dee5b814ecc30eec8a
[]
no_license
sgy-official/sgy
d3f388cefed7cf20513c14a2a333c839aa0d66c6
8c5c356c81b24180d8763d3bbc0763f1046871ac
refs/heads/master
2021-05-19T07:08:54.121998
2020-03-31T11:08:16
2020-03-31T11:08:16
251,577,856
6
4
null
null
null
null
UTF-8
C++
false
false
462
h
#ifndef RIPPLE_APP_PATHS_CURSOR_EFFECTIVERATE_H_INCLUDED #define RIPPLE_APP_PATHS_CURSOR_EFFECTIVERATE_H_INCLUDED #include <ripple/protocol/AccountID.h> #include <ripple/protocol/Issue.h> #include <ripple/protocol/Rate.h> #include <boost/optional.hpp> namespace ripple { namespace path { Rate effectiveRate( Issue const& issue, AccountID const& account1, AccountID const& account2, boost::optional<Rate> const& rate); } } #endif
[ "sgy-official@hotmail.com" ]
sgy-official@hotmail.com
b7b69e562a51efd1b487344735b2140bc9175829
04c57f900b1ac8f390e2403f4c22812c71b73d52
/CodeBackups/Huw_and_Nath_integrate/link/DL_makeframe.cpp
524d08714919b4a6c1023595f67784823d075149
[]
no_license
auberj/ComputerNetworkB1
621418c1015f45dc26e1bbd9eb8af2b1d01dcabf
ccb041334fb1d8dbe4375f589e5b1067abcd30d5
refs/heads/master
2021-01-10T14:01:17.007422
2015-12-11T15:18:14
2015-12-11T15:18:15
45,273,675
0
0
null
null
null
null
UTF-8
C++
false
false
4,751
cpp
#include "DataLink.h" #include <stdio.h> #include <avr/io.h> #include <string.h> void setchecksum(struct frame (*vals)[FRAMECOUNT]) { int i; for(i = 0; i<FRAMECOUNT; i++) { if((*vals)[i].length[0]) { char checksumcalc[50] = ""; strcpy(checksumcalc,(*vals)[i].header); strcat(checksumcalc,(*vals)[i].control); strcat(checksumcalc,(*vals)[i].address); strcat(checksumcalc,(char*)(*vals)[i].length); //strcat(checksumcalc,(char*)(*vals)[i].header); strcat(checksumcalc,(*vals)[i].data); uint16_t crc = calccrc(checksumcalc, strlen(checksumcalc)); (*vals)[i].checksum[0] = (uint8_t)(crc>>8); (*vals)[i].checksum[1] = (uint8_t)(crc & 0xff); (*vals)[i].checksum[2] = '\0'; // char temp[30]; // sprintf(temp, "crc = %x, %x %x\n",crc, (*vals)[i].checksum[0],(*vals)[i].checksum[1]); // put_string(temp); } } } void setdata(struct frame (*vals)[FRAMECOUNT], char* Spacket) { /* vals is an array of frame structs size FRAMECOUNT, and fills the frame.data */ //put_number(strlen(Spacket)); int cnt = 0; int i, j, end; end = 0; //char temp[DATALEN]; for(i = 0; i < FRAMECOUNT-1; i++) { // int loop = DATALEN; // for(j = 0; j < DATALEN; j++) { if(i ==0 && j == 0) { (*vals)[i].data[j++] = START; //loop--; } if(Spacket[cnt] == '\0') { (*vals)[i].data[j] = END; //put_char((*vals)[i].data[j]); end = 1; j++; break; } (*vals)[i].data[j] = Spacket[cnt++]; //put_char((*vals)[i].data[j]); } // put_number(j); (*vals)[i].length[0] = j; (*vals)[i].data[j] = '\0'; if(end) { break; } //put_string((*vals)[i].data); //put_char('\n'); } } void setheader(struct frame (*vals)[FRAMECOUNT]) { int i; for(i = 0; i < FRAMECOUNT; i++) { (*vals)[i].header[0] = HEADER; (*vals)[i].header[1] = '\0'; //put_char((*vals)[i].header[0]); } } void setfooter(struct frame (*vals)[FRAMECOUNT]) { int i; for(i = 0; i < FRAMECOUNT; i++) { (*vals)[i].footer[0] = FOOTER; (*vals)[i].footer[1] = '\0'; //put_char((*vals)[i].footer[0]); } } void dataInit(struct frame (*vals)[FRAMECOUNT]) { int i; for(i = 0; i < FRAMECOUNT; i++) { (*vals)[i].length[0] = 0; (*vals)[i].length[1] = '\0'; (*vals)[i].header[1] = '\0'; (*vals)[i].footer[1] = '\0'; } } void setaddress(struct frame (*vals)[FRAMECOUNT], char address) { int i; int j; for(i = 0; i < FRAMECOUNT; i++) { if((*vals)[i].length[0]) { (*vals)[i].address[0] = THISDEVICE; (*vals)[i].address[1] = address; (*vals)[i].address[ADDRESSLEN] = '\0'; } } } void setcontrol(struct frame (*vals)[FRAMECOUNT], int ack) { int i; int j; for(i = 0; i < FRAMECOUNT; i++) { if((*vals)[i].length[0]) { for(j = 0; j < CONTROLLEN; j++) { if(!ack) { (*vals)[i].control[j] = INFOFRAME[j]; } else { (*vals)[i].control[j] = SUPEFRAME[j]; } //put_char((*vals)[i].control[j]); } (*vals)[i].control[CONTROLLEN] = '\0'; } } } int makeframe(struct frame (*data)[FRAMECOUNT], char dest, char*Spacket, int ack) { dataInit(data); setdata(data, Spacket); setheader(data); setcontrol(data, ack); setaddress(data, dest); setchecksum(data); setfooter(data); int i; int retval = 0; for(i = 0; i < FRAMECOUNT; i++) { if((*data)[i].length[0]) { // put_string("\nMAke the string: \n"); char temp[HEADERLEN + CONTROLLEN + ADDRESSLEN + LENGTHLEN + DATALEN + CHECKSUMLEN + FOOTERLEN + 10] = ""; sprintf(temp,"%s%s%s%s%s",(*data)[i].control,(*data)[i].address,(*data)[i].length,(*data)[i].data,(*data)[i].checksum); bytestuff(temp, strlen(temp)); strcpy((*data)[i].frame, (*data)[i].header); strcat((*data)[i].frame, temp); strcat((*data)[i].frame, (*data)[i].footer); // put_string((*data)[i].frame); // put_char('\n'); // put_number(strlen((*data)[i].frame)); // put_char('\n'); retval = i; } } return retval; }
[ "nathan@MATRIX.local" ]
nathan@MATRIX.local
fe593e59fbc10bf5ba0592dce692566d1e800627
d67a12628e6be9db0036143c035859c77c1bfa73
/src/mscapi/key.h
436ab60b10b54b9ccc42b41f7f6ecd01d1d02527
[ "MIT" ]
permissive
fotisl/pvpkcs11
a2f3c82b39bb96073e80f205c0fc983d14cb499d
64656e0ce1ad5c7843c73e9e973afd2ac44f0c4a
refs/heads/master
2021-01-23T09:46:17.433941
2017-09-01T19:50:21
2017-09-01T19:50:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
672
h
#pragma once #include "../stdafx.h" #include "../core/objects/private_key.h" #include "../core/objects/public_key.h" #include "ncrypt.h" #include "bcrypt.h" namespace mscapi { class CryptoKey { public: CryptoKey() {}; void Assign( Scoped<ncrypt::Key> key ); void Assign( Scoped<bcrypt::Key> key ); virtual void OnKeyAssigned(); Scoped<ncrypt::Key> nkey; Scoped<bcrypt::Key> bkey; }; class CryptoKeyPair { public: CryptoKeyPair( Scoped<core::PrivateKey> privateKey, Scoped<core::PublicKey> publicKey ); Scoped<core::PrivateKey> privateKey; Scoped<core::PublicKey> publicKey; }; }
[ "microshine@mail.ru" ]
microshine@mail.ru
38c13c6045cf65abb3ba615349bfbbb6a6e2592a
c766f6bd8459855c9f482ed8f0daa662418a6acd
/Full_dynamics_no_disturbance/full_dynamics_hovering.cpp
9b2afafea7f48c7ae24d6b232ca50cc9fef7aac0
[]
no_license
enhatem/quadrotor_mpc_controller
5ac66fd79d6a709a9dcf043637733ba68b71ea43
ab07ec00147307e906f710d541d3a466468757fb
refs/heads/main
2023-04-01T16:29:32.367411
2021-03-25T11:30:48
2021-03-25T11:30:48
351,042,134
1
0
null
null
null
null
UTF-8
C++
false
false
15,038
cpp
/* * This file is part of ACADO Toolkit. * * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization. * Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.Leuven. * Developed within the Optimization in Engineering Center (OPTEC) under * supervision of Moritz Diehl. All rights reserved. * * ACADO Toolkit is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * ACADO Toolkit 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with ACADO Toolkit; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /** * Author David Ariens, Rien Quirynen * Date 2009-2013 * http://www.acadotoolkit.org/matlab */ #include <acado_optimal_control.hpp> #include <acado_toolkit.hpp> #include <acado/utils/matlab_acado_utils.hpp> USING_NAMESPACE_ACADO mxArray* ModelFcn_1_f = NULL; mxArray* ModelFcn_1_jac = NULL; mxArray* ModelFcn_1T = NULL; mxArray* ModelFcn_1X = NULL; mxArray* ModelFcn_1XA = NULL; mxArray* ModelFcn_1U = NULL; mxArray* ModelFcn_1P = NULL; mxArray* ModelFcn_1W = NULL; mxArray* ModelFcn_1DX = NULL; unsigned int ModelFcn_1NT = 0; unsigned int ModelFcn_1NX = 0; unsigned int ModelFcn_1NXA = 0; unsigned int ModelFcn_1NU = 0; unsigned int ModelFcn_1NP = 0; unsigned int ModelFcn_1NW = 0; unsigned int ModelFcn_1NDX = 0; unsigned int jacobianNumber_1 = -1; double* f_store_1 = NULL; double* J_store_1 = NULL; void clearAllGlobals1( ){ if ( f_store_1 != NULL ){ f_store_1 = NULL; } if ( J_store_1 != NULL ){ J_store_1 = NULL; } if ( ModelFcn_1_f != NULL ){ mxDestroyArray( ModelFcn_1_f ); ModelFcn_1_f = NULL; } if ( ModelFcn_1T != NULL ){ mxDestroyArray( ModelFcn_1T ); ModelFcn_1T = NULL; } if ( ModelFcn_1X != NULL ){ mxDestroyArray( ModelFcn_1X ); ModelFcn_1X = NULL; } if ( ModelFcn_1XA != NULL ){ mxDestroyArray( ModelFcn_1XA ); ModelFcn_1XA = NULL; } if ( ModelFcn_1U != NULL ){ mxDestroyArray( ModelFcn_1U ); ModelFcn_1U = NULL; } if ( ModelFcn_1P != NULL ){ mxDestroyArray( ModelFcn_1P ); ModelFcn_1P = NULL; } if ( ModelFcn_1W != NULL ){ mxDestroyArray( ModelFcn_1W ); ModelFcn_1W = NULL; } if ( ModelFcn_1DX != NULL ){ mxDestroyArray( ModelFcn_1DX ); ModelFcn_1DX = NULL; } if ( ModelFcn_1_jac != NULL ){ mxDestroyArray( ModelFcn_1_jac ); ModelFcn_1_jac = NULL; } ModelFcn_1NT = 0; ModelFcn_1NX = 0; ModelFcn_1NXA = 0; ModelFcn_1NU = 0; ModelFcn_1NP = 0; ModelFcn_1NW = 0; ModelFcn_1NDX = 0; jacobianNumber_1 = -1; } void genericODE1( double* x, double* f, void *userData ){ unsigned int i; double* tt = mxGetPr( ModelFcn_1T ); tt[0] = x[0]; double* xx = mxGetPr( ModelFcn_1X ); for( i=0; i<ModelFcn_1NX; ++i ) xx[i] = x[i+1]; double* uu = mxGetPr( ModelFcn_1U ); for( i=0; i<ModelFcn_1NU; ++i ) uu[i] = x[i+1+ModelFcn_1NX]; double* pp = mxGetPr( ModelFcn_1P ); for( i=0; i<ModelFcn_1NP; ++i ) pp[i] = x[i+1+ModelFcn_1NX+ModelFcn_1NU]; double* ww = mxGetPr( ModelFcn_1W ); for( i=0; i<ModelFcn_1NW; ++i ) ww[i] = x[i+1+ModelFcn_1NX+ModelFcn_1NU+ModelFcn_1NP]; mxArray* FF = NULL; mxArray* argIn[] = { ModelFcn_1_f,ModelFcn_1T,ModelFcn_1X,ModelFcn_1U,ModelFcn_1P,ModelFcn_1W }; mxArray* argOut[] = { FF }; mexCallMATLAB( 1,argOut, 6,argIn,"generic_ode" ); double* ff = mxGetPr( *argOut ); for( i=0; i<ModelFcn_1NX; ++i ){ f[i] = ff[i]; } mxDestroyArray( *argOut ); } void genericJacobian1( int number, double* x, double* seed, double* f, double* df, void *userData ){ unsigned int i, j; double* ff; double* J; if (J_store_1 == NULL){ J_store_1 = (double*) calloc ((ModelFcn_1NX+ModelFcn_1NU+ModelFcn_1NP+ModelFcn_1NW)*(ModelFcn_1NX),sizeof(double)); f_store_1 = (double*) calloc (ModelFcn_1NX,sizeof(double)); } if ( (int) jacobianNumber_1 == number){ J = J_store_1; ff = f_store_1; for( i=0; i<ModelFcn_1NX; ++i ) { df[i] = 0; f[i] = 0; for (j=0; j < ModelFcn_1NX+ModelFcn_1NU+ModelFcn_1NP+ModelFcn_1NW; ++j){ df[i] += J[(j*(ModelFcn_1NX))+i]*seed[j+1]; } } for( i=0; i<ModelFcn_1NX; ++i ){ f[i] = ff[i]; } }else{ jacobianNumber_1 = number; double* tt = mxGetPr( ModelFcn_1T ); tt[0] = x[0]; double* xx = mxGetPr( ModelFcn_1X ); for( i=0; i<ModelFcn_1NX; ++i ) xx[i] = x[i+1]; double* uu = mxGetPr( ModelFcn_1U ); for( i=0; i<ModelFcn_1NU; ++i ) uu[i] = x[i+1+ModelFcn_1NX]; double* pp = mxGetPr( ModelFcn_1P ); for( i=0; i<ModelFcn_1NP; ++i ) pp[i] = x[i+1+ModelFcn_1NX+ModelFcn_1NU]; double* ww = mxGetPr( ModelFcn_1W ); for( i=0; i<ModelFcn_1NW; ++i ) ww[i] = x[i+1+ModelFcn_1NX+ModelFcn_1NU+ModelFcn_1NP]; mxArray* FF = NULL; mxArray* argIn[] = { ModelFcn_1_jac,ModelFcn_1T,ModelFcn_1X,ModelFcn_1U,ModelFcn_1P,ModelFcn_1W }; mxArray* argOut[] = { FF }; mexCallMATLAB( 1,argOut, 6,argIn,"generic_jacobian" ); unsigned int rowLen = mxGetM(*argOut); unsigned int colLen = mxGetN(*argOut); if (rowLen != ModelFcn_1NX){ mexErrMsgTxt( "ERROR: Jacobian matrix rows do not match (should be ModelFcn_1NX). " ); } if (colLen != ModelFcn_1NX+ModelFcn_1NU+ModelFcn_1NP+ModelFcn_1NW){ mexErrMsgTxt( "ERROR: Jacobian matrix columns do not match (should be ModelFcn_1NX+ModelFcn_1NU+ModelFcn_1NP+ModelFcn_1NW). " ); } J = mxGetPr( *argOut ); memcpy(J_store_1, J, (ModelFcn_1NX+ModelFcn_1NU+ModelFcn_1NP+ModelFcn_1NW)*(ModelFcn_1NX) * sizeof ( double )); for( i=0; i<ModelFcn_1NX; ++i ) { df[i] = 0; f[i] = 0; for (j=0; j < ModelFcn_1NX+ModelFcn_1NU+ModelFcn_1NP+ModelFcn_1NW; ++j){ df[i] += J[(j*(ModelFcn_1NX))+i]*seed[j+1]; } } mxArray* FF2 = NULL; mxArray* argIn2[] = { ModelFcn_1_f,ModelFcn_1T,ModelFcn_1X,ModelFcn_1U,ModelFcn_1P,ModelFcn_1W }; mxArray* argOut2[] = { FF2 }; mexCallMATLAB( 1,argOut2, 6,argIn2,"generic_ode" ); ff = mxGetPr( *argOut2 ); memcpy(f_store_1, ff, (ModelFcn_1NX) * sizeof ( double )); for( i=0; i<ModelFcn_1NX; ++i ){ f[i] = ff[i]; } mxDestroyArray( *argOut ); mxDestroyArray( *argOut2 ); } } #include <mex.h> void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { MatlabConsoleStreamBuf mybuf; RedirectStream redirect(std::cout, mybuf); clearAllStaticCounters( ); mexPrintf("\nACADO Toolkit for Matlab - Developed by David Ariens and Rien Quirynen, 2009-2013 \n"); mexPrintf("Support available at http://www.acadotoolkit.org/matlab \n \n"); if (nrhs != 0){ mexErrMsgTxt("This problem expects 0 right hand side argument(s) since you have defined 0 MexInput(s)"); } TIME autotime; DifferentialState X; DifferentialState Y; DifferentialState Z; DifferentialState Xd; DifferentialState Yd; DifferentialState Zd; DifferentialState phi; DifferentialState theta; DifferentialState psi; DifferentialState p; DifferentialState q; DifferentialState r; Control T; Control M1; Control M2; Control M3; Disturbance W; Function acadodata_f2; acadodata_f2 << X; acadodata_f2 << Y; acadodata_f2 << Z; acadodata_f2 << T; DMatrix acadodata_M1; acadodata_M1.read( "full_dynamics_hovering_data_acadodata_M1.txt" ); DVector acadodata_v1(4); acadodata_v1(0) = 0; acadodata_v1(1) = 0; acadodata_v1(2) = 0; acadodata_v1(3) = 0; DVector acadodata_v2(4); acadodata_v2(0) = 0; acadodata_v2(1) = 0; acadodata_v2(2) = 0; acadodata_v2(3) = 0; DMatrix acadodata_M2; acadodata_M2.read( "full_dynamics_hovering_data_acadodata_M2.txt" ); DMatrix acadodata_M3; acadodata_M3.read( "full_dynamics_hovering_data_acadodata_M3.txt" ); DVector acadodata_v3(12); acadodata_v3(0) = 0; acadodata_v3(1) = 0; acadodata_v3(2) = -3.000000E-01; acadodata_v3(3) = 0; acadodata_v3(4) = 0; acadodata_v3(5) = 0; acadodata_v3(6) = 0; acadodata_v3(7) = 0; acadodata_v3(8) = 0; acadodata_v3(9) = 0; acadodata_v3(10) = 0; acadodata_v3(11) = 0; ModelFcn_1T = mxCreateDoubleMatrix( 1, 1,mxREAL ); ModelFcn_1X = mxCreateDoubleMatrix( 12, 1,mxREAL ); ModelFcn_1XA = mxCreateDoubleMatrix( 0, 1,mxREAL ); ModelFcn_1DX = mxCreateDoubleMatrix( 12, 1,mxREAL ); ModelFcn_1U = mxCreateDoubleMatrix( 4, 1,mxREAL ); ModelFcn_1P = mxCreateDoubleMatrix( 0, 1,mxREAL ); ModelFcn_1W = mxCreateDoubleMatrix( 1, 1,mxREAL ); ModelFcn_1NT = 1; ModelFcn_1NX = 12; ModelFcn_1NXA = 0; ModelFcn_1NDX = 12; ModelFcn_1NP = 0; ModelFcn_1NU = 4; ModelFcn_1NW = 1; DifferentialEquation acadodata_f1; ModelFcn_1_f = mxCreateString("ode"); IntermediateState setc_is_1(18); setc_is_1(0) = autotime; setc_is_1(1) = X; setc_is_1(2) = Y; setc_is_1(3) = Z; setc_is_1(4) = Xd; setc_is_1(5) = Yd; setc_is_1(6) = Zd; setc_is_1(7) = phi; setc_is_1(8) = theta; setc_is_1(9) = psi; setc_is_1(10) = p; setc_is_1(11) = q; setc_is_1(12) = r; setc_is_1(13) = T; setc_is_1(14) = M1; setc_is_1(15) = M2; setc_is_1(16) = M3; setc_is_1(17) = W; ModelFcn_1_jac = NULL; CFunction cLinkModel_1( ModelFcn_1NX, genericODE1 ); acadodata_f1 << cLinkModel_1(setc_is_1); OCP ocp1(0, 1, 25); ocp1.minimizeLSQ(acadodata_M1, acadodata_f2, acadodata_v2); ocp1.subjectTo(acadodata_f1); ocp1.subjectTo(0.00000000000000000000e+00 <= T <= 1.05947999999999997733e+00); ocp1.subjectTo(W == 0.00000000000000000000e+00); OutputFcn acadodata_f3; DynamicSystem dynamicsystem1( acadodata_f1,acadodata_f3 ); Process process2( dynamicsystem1,INT_RK45 ); process2.setProcessDisturbance( acadodata_M2 ); RealTimeAlgorithm algo1(ocp1, 0.5); algo1.set( MAX_NUM_ITERATIONS, 2 ); algo1.set( INTEGRATOR_TYPE, INT_RK45 ); algo1.set( INTEGRATOR_TOLERANCE, 1.000000E-05 ); algo1.set( ABSOLUTE_TOLERANCE, 1.000000E-04 ); algo1.set( MAX_NUM_INTEGRATOR_STEPS, 1000000 ); PeriodicReferenceTrajectory referencetrajectory(acadodata_M3); Controller controller3( algo1,referencetrajectory ); SimulationEnvironment algo2(0, 6, process2, controller3); algo2.init(acadodata_v3); returnValue returnvalue = algo2.run(); VariablesGrid out_processout; VariablesGrid out_feedbackcontrol; VariablesGrid out_feedbackparameter; VariablesGrid out_states; VariablesGrid out_algstates; algo2.getSampledProcessOutput(out_processout); algo2.getProcessDifferentialStates(out_states); algo2.getFeedbackControl(out_feedbackcontrol); const char* outputFieldNames[] = {"STATES_SAMPLED", "CONTROLS", "PARAMETERS", "STATES", "ALGEBRAICSTATES", "CONVERGENCE_ACHIEVED"}; plhs[0] = mxCreateStructMatrix( 1,1,6,outputFieldNames ); mxArray *OutSS = NULL; double *outSS = NULL; OutSS = mxCreateDoubleMatrix( out_processout.getNumPoints(),1+out_processout.getNumValues(),mxREAL ); outSS = mxGetPr( OutSS ); for( int i=0; i<out_processout.getNumPoints(); ++i ){ outSS[0*out_processout.getNumPoints() + i] = out_processout.getTime(i); for( int j=0; j<out_processout.getNumValues(); ++j ){ outSS[(1+j)*out_processout.getNumPoints() + i] = out_processout(i, j); } } mxSetField( plhs[0],0,"STATES_SAMPLED",OutSS ); mxArray *OutS = NULL; double *outS = NULL; OutS = mxCreateDoubleMatrix( out_states.getNumPoints(),1+out_states.getNumValues(),mxREAL ); outS = mxGetPr( OutS ); for( int i=0; i<out_states.getNumPoints(); ++i ){ outS[0*out_states.getNumPoints() + i] = out_states.getTime(i); for( int j=0; j<out_states.getNumValues(); ++j ){ outS[(1+j)*out_states.getNumPoints() + i] = out_states(i, j); } } mxSetField( plhs[0],0,"STATES",OutS ); mxArray *OutC = NULL; double *outC = NULL; OutC = mxCreateDoubleMatrix( out_feedbackcontrol.getNumPoints(),1+out_feedbackcontrol.getNumValues(),mxREAL ); outC = mxGetPr( OutC ); for( int i=0; i<out_feedbackcontrol.getNumPoints(); ++i ){ outC[0*out_feedbackcontrol.getNumPoints() + i] = out_feedbackcontrol.getTime(i); for( int j=0; j<out_feedbackcontrol.getNumValues(); ++j ){ outC[(1+j)*out_feedbackcontrol.getNumPoints() + i] = out_feedbackcontrol(i, j); } } mxSetField( plhs[0],0,"CONTROLS",OutC ); mxArray *OutP = NULL; double *outP = NULL; OutP = mxCreateDoubleMatrix( out_feedbackparameter.getNumPoints(),1+out_feedbackparameter.getNumValues(),mxREAL ); outP = mxGetPr( OutP ); for( int i=0; i<out_feedbackparameter.getNumPoints(); ++i ){ outP[0*out_feedbackparameter.getNumPoints() + i] = out_feedbackparameter.getTime(i); for( int j=0; j<out_feedbackparameter.getNumValues(); ++j ){ outP[(1+j)*out_feedbackparameter.getNumPoints() + i] = out_feedbackparameter(i, j); } } mxSetField( plhs[0],0,"PARAMETERS",OutP ); mxArray *OutZ = NULL; double *outZ = NULL; OutZ = mxCreateDoubleMatrix( out_algstates.getNumPoints(),1+out_algstates.getNumValues(),mxREAL ); outZ = mxGetPr( OutZ ); for( int i=0; i<out_algstates.getNumPoints(); ++i ){ outZ[0*out_algstates.getNumPoints() + i] = out_algstates.getTime(i); for( int j=0; j<out_algstates.getNumValues(); ++j ){ outZ[(1+j)*out_algstates.getNumPoints() + i] = out_algstates(i, j); } } mxSetField( plhs[0],0,"ALGEBRAICSTATES",OutZ ); mxArray *OutConv = NULL; if ( returnvalue == SUCCESSFUL_RETURN ) { OutConv = mxCreateDoubleScalar( 1 ); }else{ OutConv = mxCreateDoubleScalar( 0 ); } mxSetField( plhs[0],0,"CONVERGENCE_ACHIEVED",OutConv ); clearAllGlobals1( ); clearAllStaticCounters( ); }
[ "e.na.hatem@gmail.com" ]
e.na.hatem@gmail.com
698f7606aadca48981a0a64d8417b2debca1ef5e
510dd9d3b96c600a3b1f0aaa2e4ab0e4a851b57d
/src/test/multisig_tests.cpp
b78a56941b95e930291034fb808b1b1a816d3d76
[ "MIT" ]
permissive
lifetioncoin/lifetioncoin
e55c25e7b3f1be95e6c42c72d3a179c4d9cada58
566b7bf2268eecc712c708d90f05f85b97d7c2dc
refs/heads/master
2023-02-05T23:00:28.313716
2020-12-24T15:40:14
2020-12-24T15:40:14
319,767,838
0
0
null
null
null
null
UTF-8
C++
false
false
11,951
cpp
// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "key.h" #include "keystore.h" #include "policy/policy.h" #include "script/script.h" #include "script/script_error.h" #include "script/interpreter.h" #include "script/sign.h" #include "uint256.h" #include "test/test_lifetioncoin.h" #ifdef ENABLE_WALLET #include "wallet/wallet_ismine.h" #endif #include <boost/foreach.hpp> #include <boost/test/unit_test.hpp> using namespace std; typedef vector<unsigned char> valtype; BOOST_FIXTURE_TEST_SUITE(multisig_tests, BasicTestingSetup) CScript sign_multisig(CScript scriptPubKey, vector<CKey> keys, CTransaction transaction, int whichIn) { uint256 hash = SignatureHash(scriptPubKey, transaction, whichIn, SIGHASH_ALL); CScript result; result << OP_0; // CHECKMULTISIG bug workaround BOOST_FOREACH(const CKey &key, keys) { vector<unsigned char> vchSig; BOOST_CHECK(key.Sign(hash, vchSig)); vchSig.push_back((unsigned char)SIGHASH_ALL); result << vchSig; } return result; } BOOST_AUTO_TEST_CASE(multisig_verify) { unsigned int flags = SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC; ScriptError err; CKey key[4]; for (int i = 0; i < 4; i++) key[i].MakeNewKey(true); CScript a_and_b; a_and_b << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; CScript a_or_b; a_or_b << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; CScript escrow; escrow << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << OP_3 << OP_CHECKMULTISIG; CMutableTransaction txFrom; // Funding transaction txFrom.vout.resize(3); txFrom.vout[0].scriptPubKey = a_and_b; txFrom.vout[1].scriptPubKey = a_or_b; txFrom.vout[2].scriptPubKey = escrow; CMutableTransaction txTo[3]; // Spending transaction for (int i = 0; i < 3; i++) { txTo[i].vin.resize(1); txTo[i].vout.resize(1); txTo[i].vin[0].prevout.n = i; txTo[i].vin[0].prevout.hash = txFrom.GetHash(); txTo[i].vout[0].nValue = 1; } vector<CKey> keys; CScript s; // Test a AND b: keys.assign(1,key[0]); keys.push_back(key[1]); s = sign_multisig(a_and_b, keys, txTo[0], 0); BOOST_CHECK(VerifyScript(s, a_and_b, flags, MutableTransactionSignatureChecker(&txTo[0], 0), &err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); for (int i = 0; i < 4; i++) { keys.assign(1,key[i]); s = sign_multisig(a_and_b, keys, txTo[0], 0); BOOST_CHECK_MESSAGE(!VerifyScript(s, a_and_b, flags, MutableTransactionSignatureChecker(&txTo[0], 0), &err), strprintf("a&b 1: %d", i)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_INVALID_STACK_OPERATION, ScriptErrorString(err)); keys.assign(1,key[1]); keys.push_back(key[i]); s = sign_multisig(a_and_b, keys, txTo[0], 0); BOOST_CHECK_MESSAGE(!VerifyScript(s, a_and_b, flags, MutableTransactionSignatureChecker(&txTo[0], 0), &err), strprintf("a&b 2: %d", i)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err)); } // Test a OR b: for (int i = 0; i < 4; i++) { keys.assign(1,key[i]); s = sign_multisig(a_or_b, keys, txTo[1], 0); if (i == 0 || i == 1) { BOOST_CHECK_MESSAGE(VerifyScript(s, a_or_b, flags, MutableTransactionSignatureChecker(&txTo[1], 0), &err), strprintf("a|b: %d", i)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); } else { BOOST_CHECK_MESSAGE(!VerifyScript(s, a_or_b, flags, MutableTransactionSignatureChecker(&txTo[1], 0), &err), strprintf("a|b: %d", i)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err)); } } s.clear(); s << OP_0 << OP_1; BOOST_CHECK(!VerifyScript(s, a_or_b, flags, MutableTransactionSignatureChecker(&txTo[1], 0), &err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_SIG_DER, ScriptErrorString(err)); for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) { keys.assign(1,key[i]); keys.push_back(key[j]); s = sign_multisig(escrow, keys, txTo[2], 0); if (i < j && i < 3 && j < 3) { BOOST_CHECK_MESSAGE(VerifyScript(s, escrow, flags, MutableTransactionSignatureChecker(&txTo[2], 0), &err), strprintf("escrow 1: %d %d", i, j)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); } else { BOOST_CHECK_MESSAGE(!VerifyScript(s, escrow, flags, MutableTransactionSignatureChecker(&txTo[2], 0), &err), strprintf("escrow 2: %d %d", i, j)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err)); } } } BOOST_AUTO_TEST_CASE(multisig_IsStandard) { CKey key[4]; for (int i = 0; i < 4; i++) key[i].MakeNewKey(true); txnouttype whichType; CScript a_and_b; a_and_b << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; BOOST_CHECK(::IsStandard(a_and_b, whichType)); CScript a_or_b; a_or_b << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; BOOST_CHECK(::IsStandard(a_or_b, whichType)); CScript escrow; escrow << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << OP_3 << OP_CHECKMULTISIG; BOOST_CHECK(::IsStandard(escrow, whichType)); CScript one_of_four; one_of_four << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << ToByteVector(key[3].GetPubKey()) << OP_4 << OP_CHECKMULTISIG; BOOST_CHECK(!::IsStandard(one_of_four, whichType)); CScript malformed[6]; malformed[0] << OP_3 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; malformed[1] << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_3 << OP_CHECKMULTISIG; malformed[2] << OP_0 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; malformed[3] << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_0 << OP_CHECKMULTISIG; malformed[4] << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_CHECKMULTISIG; malformed[5] << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()); for (int i = 0; i < 6; i++) BOOST_CHECK(!::IsStandard(malformed[i], whichType)); } BOOST_AUTO_TEST_CASE(multisig_Solver1) { // Tests Solver() that returns lists of keys that are // required to satisfy a ScriptPubKey // // Also tests IsMine() and ExtractDestination() // // Note: ExtractDestination for the multisignature transactions // always returns false for this release, even if you have // one key that would satisfy an (a|b) or 2-of-3 keys needed // to spend an escrow transaction. // CBasicKeyStore keystore, emptykeystore, partialkeystore; CKey key[3]; CTxDestination keyaddr[3]; for (int i = 0; i < 3; i++) { key[i].MakeNewKey(true); keystore.AddKey(key[i]); keyaddr[i] = key[i].GetPubKey().GetID(); } partialkeystore.AddKey(key[0]); { vector<valtype> solutions; txnouttype whichType; CScript s; s << ToByteVector(key[0].GetPubKey()) << OP_CHECKSIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(solutions.size() == 1); CTxDestination addr; BOOST_CHECK(ExtractDestination(s, addr)); BOOST_CHECK(addr == keyaddr[0]); #ifdef ENABLE_WALLET BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s)); #endif } { vector<valtype> solutions; txnouttype whichType; CScript s; s << OP_DUP << OP_HASH160 << ToByteVector(key[0].GetPubKey().GetID()) << OP_EQUALVERIFY << OP_CHECKSIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(solutions.size() == 1); CTxDestination addr; BOOST_CHECK(ExtractDestination(s, addr)); BOOST_CHECK(addr == keyaddr[0]); #ifdef ENABLE_WALLET BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s)); #endif } { vector<valtype> solutions; txnouttype whichType; CScript s; s << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK_EQUAL(solutions.size(), 4U); CTxDestination addr; BOOST_CHECK(!ExtractDestination(s, addr)); #ifdef ENABLE_WALLET BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s)); BOOST_CHECK(!IsMine(partialkeystore, s)); #endif } { vector<valtype> solutions; txnouttype whichType; CScript s; s << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK_EQUAL(solutions.size(), 4U); vector<CTxDestination> addrs; int nRequired; BOOST_CHECK(ExtractDestinations(s, whichType, addrs, nRequired)); BOOST_CHECK(addrs[0] == keyaddr[0]); BOOST_CHECK(addrs[1] == keyaddr[1]); BOOST_CHECK(nRequired == 1); #ifdef ENABLE_WALLET BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s)); BOOST_CHECK(!IsMine(partialkeystore, s)); #endif } { vector<valtype> solutions; txnouttype whichType; CScript s; s << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << OP_3 << OP_CHECKMULTISIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(solutions.size() == 5); } } BOOST_AUTO_TEST_CASE(multisig_Sign) { // Test SignSignature() (and therefore the version of Solver() that signs transactions) CBasicKeyStore keystore; CKey key[4]; for (int i = 0; i < 4; i++) { key[i].MakeNewKey(true); keystore.AddKey(key[i]); } CScript a_and_b; a_and_b << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; CScript a_or_b; a_or_b << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; CScript escrow; escrow << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << OP_3 << OP_CHECKMULTISIG; CMutableTransaction txFrom; // Funding transaction txFrom.vout.resize(3); txFrom.vout[0].scriptPubKey = a_and_b; txFrom.vout[1].scriptPubKey = a_or_b; txFrom.vout[2].scriptPubKey = escrow; CMutableTransaction txTo[3]; // Spending transaction for (int i = 0; i < 3; i++) { txTo[i].vin.resize(1); txTo[i].vout.resize(1); txTo[i].vin[0].prevout.n = i; txTo[i].vin[0].prevout.hash = txFrom.GetHash(); txTo[i].vout[0].nValue = 1; } for (int i = 0; i < 3; i++) { BOOST_CHECK_MESSAGE(SignSignature(keystore, txFrom, txTo[i], 0), strprintf("SignSignature %d", i)); } } BOOST_AUTO_TEST_SUITE_END()
[ "david@lifetioncoin.org" ]
david@lifetioncoin.org
3355ca7dce4d493d27a43785b59529e42a29a1fc
679f63f8b8a6531015769141e8fe9cb924a442e1
/tensorflow/hotspot/gold_code/dump_py_training_data.cpp
1f896954e39eb3b8ab73ba42b6b273302d40cd85
[]
no_license
csgardn2/rnn_accelerator
fabb0d569c3b9df38a02070b809e17287b61e4dd
16575a38fbe725a754694ab4032e17c319a7a9e3
refs/heads/master
2021-01-18T05:47:34.352350
2017-04-23T14:58:51
2017-04-23T14:58:51
68,337,908
1
0
null
null
null
null
UTF-8
C++
false
false
10,539
cpp
/// \file /// File Name: dump_training_data.cpp \n /// Date created: Wed Jan 18 2017 \n /// Engineers: Conor Gardner \n /// Special Compile Instructions: --std=c++11 \n /// Compiler: g++ \n /// Target OS: Ubuntu Linux 16.04 \n /// Target architecture: x86 64-bit \n */ #include <fstream> #include <iostream> #include <string> /// \brief Open (overwrite) a python files to dump training data to and write /// out the prologue of the files. /// \return true on success and false otherwise bool open_py_training_data ( /// [in] The name of a file to open and overwrite with a python array of /// training data where each training point is a set of 9 pixels from /// source_matrix_temperature used to compute the corresponding output /// pixel. This will also be the name of the python array written to this /// file. Use only alphanumeric characters and underscores. const std::string& source_name, /// [in] The name of a file to open and overwrite with a python array of /// training data where each training point is a single pixel from /// destination_matrix_temperature. This will also be the name of the /// python array written to this file. Use only alphanumeric characters and /// underscores. const std::string& destination_name, /// [in] The number of pixels in a single row of /// source_matrix_temperature and destination_matrix_temperature unsigned width, /// [in] The number of pixels in a single column of /// source_matrix_temperature and destination_matrix_temperature unsigned height, /// [in] The number of time steps (grids) you are planning to dump. This /// is usually the number of iterations in a simulation unsigned num_time_steps ){ /// Open file for training data std::string source_filename = source_name + ".py"; std::ofstream source_file(source_filename.c_str()); if (!source_file.good()) { std::cerr << "Error. Failed to open \"" << source_filename << "\" for writing.\n"; return false; } // Open file for training outputs std::string destination_filename = destination_name + ".py"; std::ofstream destination_file(destination_filename.c_str()); if (!destination_file.good()) { std::cerr << "Error. Failed to open \"" << destination_filename << "\" for writing.\n"; return false; } unsigned linear_size = width * height; // Write the headers of the training files source_file << "# Training data generated by tracing rodinia_3.1/cuda/hotspot.cu\n" "# This is a 2D array of input temperature tiles at different\n" "# time steps. The first dimension indexes an entire temperature\n" "# grid at a particular time. The next dimension indexes a set of\n" "# 9 input pixels within a single time step.\n" "# The corresponding output pixels are saved in \"" << destination_filename << "\"\n\n# " << source_name <<"[num_time_steps][pixels_per_grid]\n" << "num_time_steps = " << num_time_steps << "\npixels_per_grid = " << linear_size << "\nsource_filename = \"" << source_filename << "\"\ndestination_filename = \"" << destination_filename << "\"\n" << source_name << "[num_time_steps][pixels_per_grid][9] = [\n"; // destination_file // << "# Training data generated by tracing rodinia_3.1/cuda/hotspot.cu\n" // "# Each element in this array consists of a single output pixel\n" // "# that should be used as a training input for a neural net.\n" // "# The training inputs can be found in \"" // << destination_filename // << "\"\n" // << destination_name // << "_size = " // << linear_size // << "\n" // << destination_name // << " = [\n"; return true; } /// \brief Open (append) a python files to dump training data to and write /// out the epilogue of the files. /// \return true on success and false otherwise bool close_py_training_data ( /// [in] The name of a file to open and overwrite with a python array of /// training data where each training point is a set of 9 pixels from /// source_matrix_temperature used to compute the corresponding output /// pixel. This will also be the name of the python array written to this /// file. Use only alphanumeric characters and underscores. const std::string& source_name, /// [in] The name of a file to open and overwrite with a python array of /// training data where each training point is a single pixel from /// destination_matrix_temperature. This will also be the name of the /// python array written to this file. Use only alphanumeric characters and /// underscores. const std::string& destination_name ){ /// Open file for training data std::string source_filename = source_name + ".py"; std::ofstream source_file(source_filename.c_str(), std::ios_base::app); if (!source_file.good()) { std::cerr << "Error. Failed to open \"" << source_filename << "\" for writing.\n"; return false; } // Open file for training outputs std::string destination_filename = destination_name + ".py"; std::ofstream destination_file(destination_filename.c_str(), std::ios_base::app); if (!destination_file.good()) { std::cerr << "Error. Failed to open \"" << destination_filename << "\" for writing.\n"; return false; } // Close Python arrays source_file << "]\n"; destination_file << "]\n"; return true; } /// \brief Create a log of each 3x3 input pixel and corresponding output pixel /// as a python array to be consumed by tensorflow. Python files are opened /// in append mode. /// See hotspot.cu::calculate_temp /// \return The number of training elements written (aka the number of numbers /// written to the destinaion file). unsigned dump_py_training_data ( /// [in] Row-major array of grid-points used as an input to the temperature /// calculator const float* source_temperature_matrix, /// [in] Row-major array of grid points which represents one time step after /// source_matrix_temperature generated by const float* destination_temperature_matrix, /// [in] The number of pixels in a single row of /// source_matrix_temperature and destination_matrix_temperature unsigned width, /// [in] The number of pixels in a single column of /// source_matrix_temperature and destination_matrix_temperature unsigned height, /// [in] The name of a file to open and overwrite with a python array of /// training data where each training point is a set of 9 pixels from /// source_matrix_temperature used to compute the corresponding output /// pixel. This will also be the name of the python array written to this /// file. Use only alphanumeric characters and underscores. const std::string& source_name, /// [in] The name of a file to open and overwrite with a python array of /// training data where each training point is a single pixel from /// destination_matrix_temperature. This will also be the name of the /// python array written to this file. Use only alphanumeric characters and /// underscores. const std::string& destination_name ){ /// Open file for training inputs std::string source_filename = source_name + ".py"; std::ofstream source_file(source_filename.c_str(), std::ios_base::app); if (!source_file.good()) { std::cerr << "Error. Failed to open \"" << source_filename << "\" for writing.\n"; return 0; } // Open file for training outputs std::string destination_filename = destination_name + ".py"; std::ofstream destination_file(destination_filename.c_str(), std::ios_base::app); if (!destination_file.good()) { std::cerr << "Error. Failed to open \"" << destination_filename << "\" for writing.\n"; return 0; } // We will ignore border pixels for similicity. Abort if the image contains // only border pixels. if (width < 2 || height < 2) return 0; source_file << "[\n"; destination_file << "[\n"; // Ignore border pixels for simplicity unsigned bound_x = width - 1; unsigned last_x = width - 2; unsigned last_y = height - 2; for (unsigned iy = 1, bound_y = height - 1; iy < bound_y; iy++) { unsigned offset = iy * width; const float* source_row_above = source_temperature_matrix + (offset - width); const float* source_row_locus = source_temperature_matrix + offset; const float* source_row_below = source_temperature_matrix + (offset + width); const float* destination_row = destination_temperature_matrix + offset; for (unsigned ix = 1; ix < bound_x; ix++) { source_file << '[' << source_row_above[ix - 1] << ", " << source_row_above[ix] << ", " << source_row_above[ix + 1] << ", " << source_row_locus[ix - 1] << ", " << source_row_locus[ix] << ", " << source_row_locus[ix + 1] << ", " << source_row_below[ix - 1] << ", " << source_row_below[ix] << ", " << source_row_below[ix + 1] << ']'; destination_file << destination_row[ix]; // This is really inefficient to put this check inside the loop // feel free to hoist it out of the loop if you're bored. if (ix != last_x || iy != last_y) { source_file << ','; destination_file << ','; } source_file << '\n'; destination_file << '\n'; } } source_file << ']'; destination_file << ']'; // Return the number of training elements written return (width - 2) * (height - 2); }
[ "cgardner65536@yahoo.com" ]
cgardner65536@yahoo.com
3f2dcbefc90f8b31e47b1834749d806d68d970c7
5ac691580c49d8cf494d5b98c342bb11f3ff6514
/AtCoder/abc166/abc166_e.cpp
91fb7bc1018b6759fc285c752f5148f7d076d9ae
[]
no_license
sweatpotato13/Algorithm-Solving
e68411a4f430d0517df4ae63fc70d1a014d8b3ba
b2f8cbb914866d2055727b9872f65d7d270ba31b
refs/heads/master
2023-03-29T23:44:53.814519
2023-03-21T23:09:59
2023-03-21T23:09:59
253,355,531
3
0
null
null
null
null
UTF-8
C++
false
false
694
cpp
#pragma warning(disable : 4996) #include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<ld, ld> pld; // https://atcoder.jp/contests/abc166/tasks/abc166_e int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); ll ans = 0; ll n; cin >> n; vector<ll> v(n+1); for(int i = 1;i<=n;i++) cin >> v[i]; map<ll,ll> m; for(int i = 1;i<=n;i++){ if(m[i-v[i]] != 0) ans += m[i-v[i]]; if(m[i+v[i]] != 0) m[i+v[i]] += 1; else{ m[i+v[i]] = 1; } } cout << ans; return 0; }
[ "sweatpotato13@gmail.com" ]
sweatpotato13@gmail.com
8e7f16b293655f6e50af8eb90f94d4b6c0b56136
9a3b9d80afd88e1fa9a24303877d6e130ce22702
/src/Providers/UNIXProviders/SoftwareElementComponent/UNIX_SoftwareElementComponent_TRU64.hxx
003165ca53d9f3f2fe94bfeafce92f7d25066b00
[ "MIT" ]
permissive
brunolauze/openpegasus-providers
3244b76d075bc66a77e4ed135893437a66dd769f
f24c56acab2c4c210a8d165bb499cd1b3a12f222
refs/heads/master
2020-04-17T04:27:14.970917
2015-01-04T22:08:09
2015-01-04T22:08:09
19,707,296
0
0
null
null
null
null
UTF-8
C++
false
false
1,833
hxx
//%LICENSE//////////////////////////////////////////////////////////////// // // Licensed to The Open Group (TOG) under one or more contributor license // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with // this work for additional information regarding copyright ownership. // Each contributor licenses this file to you under the OpenPegasus Open // Source License; you may not use this file except in compliance with the // License. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // ////////////////////////////////////////////////////////////////////////// // //%///////////////////////////////////////////////////////////////////////// #ifdef PEGASUS_OS_TRU64 #ifndef __UNIX_SOFTWAREELEMENTCOMPONENT_PRIVATE_H #define __UNIX_SOFTWAREELEMENTCOMPONENT_PRIVATE_H #endif #endif
[ "brunolauze@msn.com" ]
brunolauze@msn.com
f8aa011904ea8a57da08f01f5e10ab5d60804766
2c7799abde03e575ddcb0e8903d2a0e7a3a6bc1b
/src/Native/libcryptonote/cryptonote_basic/account.cpp
dd875402f5c42d28a757b8b12c2b076b94238ca4
[ "MIT" ]
permissive
DecisiveDesign/miningcore-cp
76de5aa27ccfb1544121bed8176cf0f3a7616811
21546c544fcbfbcf2f5d7da39dbb5c2aed894736
refs/heads/master
2021-04-26T21:52:12.313310
2018-03-15T02:57:32
2018-03-15T02:57:32
124,168,547
0
0
MIT
2018-03-09T03:36:37
2018-03-07T02:41:55
C
UTF-8
C++
false
false
5,686
cpp
// Copyright (c) 2014-2017, The Monero Project // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, are // permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other // materials provided with the distribution. // // 3. Neither the name of the copyright holder nor the names of its contributors may be // used to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers #include <fstream> #include "include_base_utils.h" #include "account.h" #include "warnings.h" #include "crypto/crypto.h" extern "C" { #include "crypto/keccak.h" } #include "cryptonote_basic_impl.h" #include "cryptonote_format_utils.h" #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "account" using namespace std; DISABLE_VS_WARNINGS(4244 4345) namespace cryptonote { //----------------------------------------------------------------- account_base::account_base() { set_null(); } //----------------------------------------------------------------- void account_base::set_null() { m_keys = account_keys(); } //----------------------------------------------------------------- void account_base::forget_spend_key() { m_keys.m_spend_secret_key = crypto::secret_key(); } //----------------------------------------------------------------- crypto::secret_key account_base::generate(const crypto::secret_key& recovery_key, bool recover, bool two_random) { crypto::secret_key first = generate_keys(m_keys.m_account_address.m_spend_public_key, m_keys.m_spend_secret_key, recovery_key, recover); // rng for generating second set of keys is hash of first rng. means only one set of electrum-style words needed for recovery crypto::secret_key second; keccak((uint8_t *)&m_keys.m_spend_secret_key, sizeof(crypto::secret_key), (uint8_t *)&second, sizeof(crypto::secret_key)); generate_keys(m_keys.m_account_address.m_view_public_key, m_keys.m_view_secret_key, second, two_random ? false : true); struct tm timestamp = {0}; timestamp.tm_year = 2014 - 1900; // year 2014 timestamp.tm_mon = 6 - 1; // month june timestamp.tm_mday = 8; // 8th of june timestamp.tm_hour = 0; timestamp.tm_min = 0; timestamp.tm_sec = 0; if (recover) { m_creation_timestamp = mktime(&timestamp); if (m_creation_timestamp == (uint64_t)-1) // failure m_creation_timestamp = 0; // lowest value } else { m_creation_timestamp = time(NULL); } return first; } //----------------------------------------------------------------- void account_base::create_from_keys(const cryptonote::account_public_address& address, const crypto::secret_key& spendkey, const crypto::secret_key& viewkey) { m_keys.m_account_address = address; m_keys.m_spend_secret_key = spendkey; m_keys.m_view_secret_key = viewkey; struct tm timestamp = {0}; timestamp.tm_year = 2014 - 1900; // year 2014 timestamp.tm_mon = 4 - 1; // month april timestamp.tm_mday = 15; // 15th of april timestamp.tm_hour = 0; timestamp.tm_min = 0; timestamp.tm_sec = 0; m_creation_timestamp = mktime(&timestamp); if (m_creation_timestamp == (uint64_t)-1) // failure m_creation_timestamp = 0; // lowest value } //----------------------------------------------------------------- void account_base::create_from_viewkey(const cryptonote::account_public_address& address, const crypto::secret_key& viewkey) { crypto::secret_key fake; memset(&fake, 0, sizeof(fake)); create_from_keys(address, fake, viewkey); } //----------------------------------------------------------------- const account_keys& account_base::get_keys() const { return m_keys; } //----------------------------------------------------------------- std::string account_base::get_public_address_str(bool testnet) const { //TODO: change this code into base 58 return get_account_address_as_str(testnet, m_keys.m_account_address); } //----------------------------------------------------------------- std::string account_base::get_public_integrated_address_str(const crypto::hash8 &payment_id, bool testnet) const { //TODO: change this code into base 58 return get_account_integrated_address_as_str(testnet, m_keys.m_account_address, payment_id); } //----------------------------------------------------------------- }
[ "oliver@weichhold.com" ]
oliver@weichhold.com
1b23f1f7162b9cf13a4ba44bef525f54c54ac441
746162035bf4802803baa339e397181c9ee4cc2a
/dmoz-0.1/textgarden/TGLibSample/stdafx.cpp
4dd8770477fe07e21867742bd53a0b5c10a9ab9a
[]
no_license
edgeflip/dmoz
648a1e1d07aa143d306fc07efaf94349ae3dead6
990d848174c538d72d7f84917a385c46237a8143
refs/heads/master
2021-01-17T18:28:50.378701
2014-01-09T21:39:29
2014-01-09T21:39:29
15,776,307
0
0
null
null
null
null
UTF-8
C++
false
false
290
cpp
// stdafx.cpp : source file that includes just the standard includes // TGLibSample.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file
[ "f4nt@f4ntasmic.com" ]
f4nt@f4ntasmic.com
44834b060028461b02f881d83f98c9f2fa5b49f2
79e713886872eba5931ec152197708f36cc58ed9
/ConnectionImpl.cpp
ee7cc7c45cf53043db2c974e129c96755af7fe08
[]
no_license
hoodwolf/Infraelly
1f1be6a8dde0af8bbe79aea8c730fca827c10974
08f295c60bffd2684b74fab0d91dd9a51982e261
refs/heads/master
2021-01-18T03:00:01.253623
2013-04-30T01:13:51
2013-04-30T01:13:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,656
cpp
/*-----------------------------------------------------------------------------\ | ____ | | __ / __ \ /\ /\ | | /_/ / / \/ / / / / | | __ ____ / /_ ____ ____ ____ / / / / | | / / / __ \ / ___\ / __ \ / __ \ / __ \ / / / / /\ /\| | / / / / \ \ / / / / \/ / / \ \ / ____/ / / / / / / / /| | / /_ / / / / / / / / \ \__/ /_ \ \___ / /_ / /_ \ \/ / | | \__/ \/ \/ \/ \/ \______/ \____/ \__/ \__/ \ / | | / / | | ______________________________________________________________________/ / | |/ ____________________________________________________________________/ | |\__/ | | | | | | Infraelly MMORPG | | Copyright (C) 2007-2010 Tony Huynh aka insanepotato | | | | Visit: http://sourceforge.net/projects/infraelly/ | | | | License: (LGPL) | | This is free software; you can redistribute it and/or | | modify it under the terms of the GNU Library General Public | | License as published by the Free Software Foundation; either | | version 2 of the License, or (at your option) any later version. | | | | This 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 | | Library General Public License for more details. | | | | You should have received a copy of the GNU Library General Public | | License along with this library; if not, write to the Free | | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | | | Tony Huynh | | tony.huynh1991@gmail.com | | | L-----------------------------------------------------------------------------*/ #include "ConnectionImpl.hpp" namespace inp{ Connection::ConnectionImpl::ConnectionImpl() : dataAccess(SDL_CreateMutex()), refCount(0), group(NULL), userSocket(NULL), peer(NULL), active(0), connectTime(0), createdSet(0), id("NONE") {} //destroy mutex Connection::ConnectionImpl::~ConnectionImpl(){ SDL_DestroyMutex(dataAccess); } }
[ "vikingdude394@yahoo.com" ]
vikingdude394@yahoo.com
001931ca19d50ee159e1c037db6f4583945b0fa8
df3f3095b1d9976e84b4d6186c03809fac7b9c57
/08 Repeat/Ex_06/src/ofApp.cpp
2b17614efc725838f5b3741a1b05dededb992f5b
[]
no_license
Komat/openFrameworks-A-Programming-Handbook-for-Visual-Designers-and-Artists
11f54180e04232ed14d46a2af8bad31f95dc9f8d
b7ffddb024f644466d0bc40a1b328f9655c7164f
refs/heads/master
2021-01-20T21:15:26.467044
2016-08-01T09:45:47
2016-08-01T09:45:47
64,309,105
0
0
null
null
null
null
UTF-8
C++
false
false
1,739
cpp
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup(){ ofSetColor(0); } //-------------------------------------------------------------- void ofApp::update(){ } //-------------------------------------------------------------- void ofApp::draw(){ ofSetLineWidth(1); for (int x = -16; x < 100; x += 10) { ofLine(x, 0, x+15, 50); } ofSetLineWidth(4); for (int x = -8; x < 100; x += 10) { ofLine(x, 50, x+15, 100); } } //-------------------------------------------------------------- void ofApp::keyPressed(int key){ } //-------------------------------------------------------------- void ofApp::keyReleased(int key){ } //-------------------------------------------------------------- void ofApp::mouseMoved(int x, int y ){ } //-------------------------------------------------------------- void ofApp::mouseDragged(int x, int y, int button){ } //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ } //-------------------------------------------------------------- void ofApp::mouseReleased(int x, int y, int button){ } //-------------------------------------------------------------- void ofApp::mouseEntered(int x, int y){ } //-------------------------------------------------------------- void ofApp::mouseExited(int x, int y){ } //-------------------------------------------------------------- void ofApp::windowResized(int w, int h){ } //-------------------------------------------------------------- void ofApp::gotMessage(ofMessage msg){ } //-------------------------------------------------------------- void ofApp::dragEvent(ofDragInfo dragInfo){ }
[ "takayuki.komatsu@didi.jp" ]
takayuki.komatsu@didi.jp
e34623b5ed1b5af072642247d573eb7bb785f971
c25ff766b0cdf5e8749a4b344bb30f9c835d204b
/Temp/StagingArea/Data/il2cppOutput/Il2CppCompilerCalculateTypeValues_4Table.cpp
ca124d72eba5e21b82d0525366d08a6d7e7574e6
[]
no_license
liuxinglu/unity_demo1
160a6c21584a98fc8c764010dd7dfffc063f533f
2150cce2913146c6dfd39f2dba4c0e26c84f7825
refs/heads/master
2021-07-13T15:22:02.480052
2017-10-11T10:12:44
2017-10-11T10:12:44
106,400,680
0
0
null
null
null
null
UTF-8
C++
false
false
140,513
cpp
#include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <cstring> #include <string.h> #include <stdio.h> #include <cmath> #include <limits> #include <assert.h> #include <stdint.h> #include "class-internals.h" #include "codegen/il2cpp-codegen.h" #include "object-internals.h" // System.IntPtr[] struct IntPtrU5BU5D_t3274416346; // System.String struct String_t; // System.Collections.IDictionary struct IDictionary_t2155452954; // System.Runtime.Remoting.Messaging.IMessageSink struct IMessageSink_t703538957; // System.Runtime.Remoting.Contexts.SynchronizationAttribute struct SynchronizationAttribute_t411119687; // System.Runtime.Remoting.Contexts.IDynamicProperty struct IDynamicProperty_t2501141871; // System.Runtime.Remoting.Contexts.IDynamicMessageSink struct IDynamicMessageSink_t1486157708; // System.Collections.ArrayList struct ArrayList_t2438777478; // System.Collections.Hashtable struct Hashtable_t2491480603; // System.Reflection.MethodInfo struct MethodInfo_t; // System.Runtime.Remoting.Activation.IActivator struct IActivator_t3435595057; // System.Object[] struct ObjectU5BU5D_t769195566; // System.Type[] struct TypeU5BU5D_t3074309185; // System.Reflection.MethodBase struct MethodBase_t995967996; // System.Runtime.Remoting.Messaging.LogicalCallContext struct LogicalCallContext_t2351273423; // System.Collections.Generic.Dictionary`2<System.String,System.Int32> struct Dictionary_2_t2512102020; // System.Threading.Timer struct Timer_t1791731092; // System.Runtime.Remoting.ServerIdentity struct ServerIdentity_t2406396366; // System.Runtime.Remoting.Contexts.CrossContextChannel struct CrossContextChannel_t3170213951; // System.Collections.IList struct IList_t1272884294; // System.Runtime.Remoting.Contexts.Context struct Context_t2330603731; // System.Int32[] struct Int32U5BU5D_t916272174; // System.Void struct Void_t380066806; // System.Type struct Type_t; // System.Char[] struct CharU5BU5D_t2644401608; // System.Threading.WaitHandle struct WaitHandle_t3530316433; // System.Threading.ExecutionContext struct ExecutionContext_t1961146903; // System.Runtime.Remoting.Messaging.MonoMethodMessage struct MonoMethodMessage_t1289019874; // System.Runtime.Remoting.Messaging.IMessageCtrl struct IMessageCtrl_t2552050356; // System.Runtime.Remoting.Messaging.IMessage struct IMessage_t1026337998; // System.Runtime.Remoting.Lifetime.LeaseManager struct LeaseManager_t1090072238; // System.Threading.Mutex struct Mutex_t4287421805; // System.Threading.Thread struct Thread_t3626738102; // System.Runtime.Remoting.Contexts.DynamicPropertyCollection struct DynamicPropertyCollection_t3079317807; // System.Runtime.Remoting.Contexts.ContextCallbackObject struct ContextCallbackObject_t4236601005; #ifndef RUNTIMEOBJECT_H #define RUNTIMEOBJECT_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Object #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // RUNTIMEOBJECT_H #ifndef EXCEPTION_T3830270800_H #define EXCEPTION_T3830270800_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Exception struct Exception_t3830270800 : public RuntimeObject { public: // System.IntPtr[] System.Exception::trace_ips IntPtrU5BU5D_t3274416346* ___trace_ips_0; // System.Exception System.Exception::inner_exception Exception_t3830270800 * ___inner_exception_1; // System.String System.Exception::message String_t* ___message_2; // System.String System.Exception::help_link String_t* ___help_link_3; // System.String System.Exception::class_name String_t* ___class_name_4; // System.String System.Exception::stack_trace String_t* ___stack_trace_5; // System.String System.Exception::_remoteStackTraceString String_t* ____remoteStackTraceString_6; // System.Int32 System.Exception::remote_stack_index int32_t ___remote_stack_index_7; // System.Int32 System.Exception::hresult int32_t ___hresult_8; // System.String System.Exception::source String_t* ___source_9; // System.Collections.IDictionary System.Exception::_data RuntimeObject* ____data_10; public: inline static int32_t get_offset_of_trace_ips_0() { return static_cast<int32_t>(offsetof(Exception_t3830270800, ___trace_ips_0)); } inline IntPtrU5BU5D_t3274416346* get_trace_ips_0() const { return ___trace_ips_0; } inline IntPtrU5BU5D_t3274416346** get_address_of_trace_ips_0() { return &___trace_ips_0; } inline void set_trace_ips_0(IntPtrU5BU5D_t3274416346* value) { ___trace_ips_0 = value; Il2CppCodeGenWriteBarrier((&___trace_ips_0), value); } inline static int32_t get_offset_of_inner_exception_1() { return static_cast<int32_t>(offsetof(Exception_t3830270800, ___inner_exception_1)); } inline Exception_t3830270800 * get_inner_exception_1() const { return ___inner_exception_1; } inline Exception_t3830270800 ** get_address_of_inner_exception_1() { return &___inner_exception_1; } inline void set_inner_exception_1(Exception_t3830270800 * value) { ___inner_exception_1 = value; Il2CppCodeGenWriteBarrier((&___inner_exception_1), value); } inline static int32_t get_offset_of_message_2() { return static_cast<int32_t>(offsetof(Exception_t3830270800, ___message_2)); } inline String_t* get_message_2() const { return ___message_2; } inline String_t** get_address_of_message_2() { return &___message_2; } inline void set_message_2(String_t* value) { ___message_2 = value; Il2CppCodeGenWriteBarrier((&___message_2), value); } inline static int32_t get_offset_of_help_link_3() { return static_cast<int32_t>(offsetof(Exception_t3830270800, ___help_link_3)); } inline String_t* get_help_link_3() const { return ___help_link_3; } inline String_t** get_address_of_help_link_3() { return &___help_link_3; } inline void set_help_link_3(String_t* value) { ___help_link_3 = value; Il2CppCodeGenWriteBarrier((&___help_link_3), value); } inline static int32_t get_offset_of_class_name_4() { return static_cast<int32_t>(offsetof(Exception_t3830270800, ___class_name_4)); } inline String_t* get_class_name_4() const { return ___class_name_4; } inline String_t** get_address_of_class_name_4() { return &___class_name_4; } inline void set_class_name_4(String_t* value) { ___class_name_4 = value; Il2CppCodeGenWriteBarrier((&___class_name_4), value); } inline static int32_t get_offset_of_stack_trace_5() { return static_cast<int32_t>(offsetof(Exception_t3830270800, ___stack_trace_5)); } inline String_t* get_stack_trace_5() const { return ___stack_trace_5; } inline String_t** get_address_of_stack_trace_5() { return &___stack_trace_5; } inline void set_stack_trace_5(String_t* value) { ___stack_trace_5 = value; Il2CppCodeGenWriteBarrier((&___stack_trace_5), value); } inline static int32_t get_offset_of__remoteStackTraceString_6() { return static_cast<int32_t>(offsetof(Exception_t3830270800, ____remoteStackTraceString_6)); } inline String_t* get__remoteStackTraceString_6() const { return ____remoteStackTraceString_6; } inline String_t** get_address_of__remoteStackTraceString_6() { return &____remoteStackTraceString_6; } inline void set__remoteStackTraceString_6(String_t* value) { ____remoteStackTraceString_6 = value; Il2CppCodeGenWriteBarrier((&____remoteStackTraceString_6), value); } inline static int32_t get_offset_of_remote_stack_index_7() { return static_cast<int32_t>(offsetof(Exception_t3830270800, ___remote_stack_index_7)); } inline int32_t get_remote_stack_index_7() const { return ___remote_stack_index_7; } inline int32_t* get_address_of_remote_stack_index_7() { return &___remote_stack_index_7; } inline void set_remote_stack_index_7(int32_t value) { ___remote_stack_index_7 = value; } inline static int32_t get_offset_of_hresult_8() { return static_cast<int32_t>(offsetof(Exception_t3830270800, ___hresult_8)); } inline int32_t get_hresult_8() const { return ___hresult_8; } inline int32_t* get_address_of_hresult_8() { return &___hresult_8; } inline void set_hresult_8(int32_t value) { ___hresult_8 = value; } inline static int32_t get_offset_of_source_9() { return static_cast<int32_t>(offsetof(Exception_t3830270800, ___source_9)); } inline String_t* get_source_9() const { return ___source_9; } inline String_t** get_address_of_source_9() { return &___source_9; } inline void set_source_9(String_t* value) { ___source_9 = value; Il2CppCodeGenWriteBarrier((&___source_9), value); } inline static int32_t get_offset_of__data_10() { return static_cast<int32_t>(offsetof(Exception_t3830270800, ____data_10)); } inline RuntimeObject* get__data_10() const { return ____data_10; } inline RuntimeObject** get_address_of__data_10() { return &____data_10; } inline void set__data_10(RuntimeObject* value) { ____data_10 = value; Il2CppCodeGenWriteBarrier((&____data_10), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // EXCEPTION_T3830270800_H #ifndef SYNCHRONIZEDCLIENTCONTEXTSINK_T1571413438_H #define SYNCHRONIZEDCLIENTCONTEXTSINK_T1571413438_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.SynchronizedClientContextSink struct SynchronizedClientContextSink_t1571413438 : public RuntimeObject { public: // System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Contexts.SynchronizedClientContextSink::_next RuntimeObject* ____next_0; // System.Runtime.Remoting.Contexts.SynchronizationAttribute System.Runtime.Remoting.Contexts.SynchronizedClientContextSink::_att SynchronizationAttribute_t411119687 * ____att_1; public: inline static int32_t get_offset_of__next_0() { return static_cast<int32_t>(offsetof(SynchronizedClientContextSink_t1571413438, ____next_0)); } inline RuntimeObject* get__next_0() const { return ____next_0; } inline RuntimeObject** get_address_of__next_0() { return &____next_0; } inline void set__next_0(RuntimeObject* value) { ____next_0 = value; Il2CppCodeGenWriteBarrier((&____next_0), value); } inline static int32_t get_offset_of__att_1() { return static_cast<int32_t>(offsetof(SynchronizedClientContextSink_t1571413438, ____att_1)); } inline SynchronizationAttribute_t411119687 * get__att_1() const { return ____att_1; } inline SynchronizationAttribute_t411119687 ** get_address_of__att_1() { return &____att_1; } inline void set__att_1(SynchronizationAttribute_t411119687 * value) { ____att_1 = value; Il2CppCodeGenWriteBarrier((&____att_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SYNCHRONIZEDCLIENTCONTEXTSINK_T1571413438_H #ifndef CROSSCONTEXTCHANNEL_T3170213951_H #define CROSSCONTEXTCHANNEL_T3170213951_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.CrossContextChannel struct CrossContextChannel_t3170213951 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CROSSCONTEXTCHANNEL_T3170213951_H #ifndef MARSHAL_T1877682222_H #define MARSHAL_T1877682222_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.Marshal struct Marshal_t1877682222 : public RuntimeObject { public: public: }; struct Marshal_t1877682222_StaticFields { public: // System.Int32 System.Runtime.InteropServices.Marshal::SystemMaxDBCSCharSize int32_t ___SystemMaxDBCSCharSize_0; // System.Int32 System.Runtime.InteropServices.Marshal::SystemDefaultCharSize int32_t ___SystemDefaultCharSize_1; public: inline static int32_t get_offset_of_SystemMaxDBCSCharSize_0() { return static_cast<int32_t>(offsetof(Marshal_t1877682222_StaticFields, ___SystemMaxDBCSCharSize_0)); } inline int32_t get_SystemMaxDBCSCharSize_0() const { return ___SystemMaxDBCSCharSize_0; } inline int32_t* get_address_of_SystemMaxDBCSCharSize_0() { return &___SystemMaxDBCSCharSize_0; } inline void set_SystemMaxDBCSCharSize_0(int32_t value) { ___SystemMaxDBCSCharSize_0 = value; } inline static int32_t get_offset_of_SystemDefaultCharSize_1() { return static_cast<int32_t>(offsetof(Marshal_t1877682222_StaticFields, ___SystemDefaultCharSize_1)); } inline int32_t get_SystemDefaultCharSize_1() const { return ___SystemDefaultCharSize_1; } inline int32_t* get_address_of_SystemDefaultCharSize_1() { return &___SystemDefaultCharSize_1; } inline void set_SystemDefaultCharSize_1(int32_t value) { ___SystemDefaultCharSize_1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // MARSHAL_T1877682222_H #ifndef DYNAMICPROPERTYREG_T2204871467_H #define DYNAMICPROPERTYREG_T2204871467_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.DynamicPropertyCollection/DynamicPropertyReg struct DynamicPropertyReg_t2204871467 : public RuntimeObject { public: // System.Runtime.Remoting.Contexts.IDynamicProperty System.Runtime.Remoting.Contexts.DynamicPropertyCollection/DynamicPropertyReg::Property RuntimeObject* ___Property_0; // System.Runtime.Remoting.Contexts.IDynamicMessageSink System.Runtime.Remoting.Contexts.DynamicPropertyCollection/DynamicPropertyReg::Sink RuntimeObject* ___Sink_1; public: inline static int32_t get_offset_of_Property_0() { return static_cast<int32_t>(offsetof(DynamicPropertyReg_t2204871467, ___Property_0)); } inline RuntimeObject* get_Property_0() const { return ___Property_0; } inline RuntimeObject** get_address_of_Property_0() { return &___Property_0; } inline void set_Property_0(RuntimeObject* value) { ___Property_0 = value; Il2CppCodeGenWriteBarrier((&___Property_0), value); } inline static int32_t get_offset_of_Sink_1() { return static_cast<int32_t>(offsetof(DynamicPropertyReg_t2204871467, ___Sink_1)); } inline RuntimeObject* get_Sink_1() const { return ___Sink_1; } inline RuntimeObject** get_address_of_Sink_1() { return &___Sink_1; } inline void set_Sink_1(RuntimeObject* value) { ___Sink_1 = value; Il2CppCodeGenWriteBarrier((&___Sink_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // DYNAMICPROPERTYREG_T2204871467_H #ifndef DYNAMICPROPERTYCOLLECTION_T3079317807_H #define DYNAMICPROPERTYCOLLECTION_T3079317807_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.DynamicPropertyCollection struct DynamicPropertyCollection_t3079317807 : public RuntimeObject { public: // System.Collections.ArrayList System.Runtime.Remoting.Contexts.DynamicPropertyCollection::_properties ArrayList_t2438777478 * ____properties_0; public: inline static int32_t get_offset_of__properties_0() { return static_cast<int32_t>(offsetof(DynamicPropertyCollection_t3079317807, ____properties_0)); } inline ArrayList_t2438777478 * get__properties_0() const { return ____properties_0; } inline ArrayList_t2438777478 ** get_address_of__properties_0() { return &____properties_0; } inline void set__properties_0(ArrayList_t2438777478 * value) { ____properties_0 = value; Il2CppCodeGenWriteBarrier((&____properties_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // DYNAMICPROPERTYCOLLECTION_T3079317807_H #ifndef SINKPROVIDERDATA_T3487717147_H #define SINKPROVIDERDATA_T3487717147_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Channels.SinkProviderData struct SinkProviderData_t3487717147 : public RuntimeObject { public: // System.String System.Runtime.Remoting.Channels.SinkProviderData::sinkName String_t* ___sinkName_0; // System.Collections.ArrayList System.Runtime.Remoting.Channels.SinkProviderData::children ArrayList_t2438777478 * ___children_1; // System.Collections.Hashtable System.Runtime.Remoting.Channels.SinkProviderData::properties Hashtable_t2491480603 * ___properties_2; public: inline static int32_t get_offset_of_sinkName_0() { return static_cast<int32_t>(offsetof(SinkProviderData_t3487717147, ___sinkName_0)); } inline String_t* get_sinkName_0() const { return ___sinkName_0; } inline String_t** get_address_of_sinkName_0() { return &___sinkName_0; } inline void set_sinkName_0(String_t* value) { ___sinkName_0 = value; Il2CppCodeGenWriteBarrier((&___sinkName_0), value); } inline static int32_t get_offset_of_children_1() { return static_cast<int32_t>(offsetof(SinkProviderData_t3487717147, ___children_1)); } inline ArrayList_t2438777478 * get_children_1() const { return ___children_1; } inline ArrayList_t2438777478 ** get_address_of_children_1() { return &___children_1; } inline void set_children_1(ArrayList_t2438777478 * value) { ___children_1 = value; Il2CppCodeGenWriteBarrier((&___children_1), value); } inline static int32_t get_offset_of_properties_2() { return static_cast<int32_t>(offsetof(SinkProviderData_t3487717147, ___properties_2)); } inline Hashtable_t2491480603 * get_properties_2() const { return ___properties_2; } inline Hashtable_t2491480603 ** get_address_of_properties_2() { return &___properties_2; } inline void set_properties_2(Hashtable_t2491480603 * value) { ___properties_2 = value; Il2CppCodeGenWriteBarrier((&___properties_2), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SINKPROVIDERDATA_T3487717147_H #ifndef CROSSAPPDOMAINSINK_T407920545_H #define CROSSAPPDOMAINSINK_T407920545_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Channels.CrossAppDomainSink struct CrossAppDomainSink_t407920545 : public RuntimeObject { public: // System.Int32 System.Runtime.Remoting.Channels.CrossAppDomainSink::_domainID int32_t ____domainID_2; public: inline static int32_t get_offset_of__domainID_2() { return static_cast<int32_t>(offsetof(CrossAppDomainSink_t407920545, ____domainID_2)); } inline int32_t get__domainID_2() const { return ____domainID_2; } inline int32_t* get_address_of__domainID_2() { return &____domainID_2; } inline void set__domainID_2(int32_t value) { ____domainID_2 = value; } }; struct CrossAppDomainSink_t407920545_StaticFields { public: // System.Collections.Hashtable System.Runtime.Remoting.Channels.CrossAppDomainSink::s_sinks Hashtable_t2491480603 * ___s_sinks_0; // System.Reflection.MethodInfo System.Runtime.Remoting.Channels.CrossAppDomainSink::processMessageMethod MethodInfo_t * ___processMessageMethod_1; public: inline static int32_t get_offset_of_s_sinks_0() { return static_cast<int32_t>(offsetof(CrossAppDomainSink_t407920545_StaticFields, ___s_sinks_0)); } inline Hashtable_t2491480603 * get_s_sinks_0() const { return ___s_sinks_0; } inline Hashtable_t2491480603 ** get_address_of_s_sinks_0() { return &___s_sinks_0; } inline void set_s_sinks_0(Hashtable_t2491480603 * value) { ___s_sinks_0 = value; Il2CppCodeGenWriteBarrier((&___s_sinks_0), value); } inline static int32_t get_offset_of_processMessageMethod_1() { return static_cast<int32_t>(offsetof(CrossAppDomainSink_t407920545_StaticFields, ___processMessageMethod_1)); } inline MethodInfo_t * get_processMessageMethod_1() const { return ___processMessageMethod_1; } inline MethodInfo_t ** get_address_of_processMessageMethod_1() { return &___processMessageMethod_1; } inline void set_processMessageMethod_1(MethodInfo_t * value) { ___processMessageMethod_1 = value; Il2CppCodeGenWriteBarrier((&___processMessageMethod_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CROSSAPPDOMAINSINK_T407920545_H #ifndef CROSSAPPDOMAINCHANNEL_T426527630_H #define CROSSAPPDOMAINCHANNEL_T426527630_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Channels.CrossAppDomainChannel struct CrossAppDomainChannel_t426527630 : public RuntimeObject { public: public: }; struct CrossAppDomainChannel_t426527630_StaticFields { public: // System.Object System.Runtime.Remoting.Channels.CrossAppDomainChannel::s_lock RuntimeObject * ___s_lock_0; public: inline static int32_t get_offset_of_s_lock_0() { return static_cast<int32_t>(offsetof(CrossAppDomainChannel_t426527630_StaticFields, ___s_lock_0)); } inline RuntimeObject * get_s_lock_0() const { return ___s_lock_0; } inline RuntimeObject ** get_address_of_s_lock_0() { return &___s_lock_0; } inline void set_s_lock_0(RuntimeObject * value) { ___s_lock_0 = value; Il2CppCodeGenWriteBarrier((&___s_lock_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CROSSAPPDOMAINCHANNEL_T426527630_H #ifndef CROSSAPPDOMAINDATA_T574484588_H #define CROSSAPPDOMAINDATA_T574484588_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Channels.CrossAppDomainData struct CrossAppDomainData_t574484588 : public RuntimeObject { public: // System.Object System.Runtime.Remoting.Channels.CrossAppDomainData::_ContextID RuntimeObject * ____ContextID_0; // System.Int32 System.Runtime.Remoting.Channels.CrossAppDomainData::_DomainID int32_t ____DomainID_1; // System.String System.Runtime.Remoting.Channels.CrossAppDomainData::_processGuid String_t* ____processGuid_2; public: inline static int32_t get_offset_of__ContextID_0() { return static_cast<int32_t>(offsetof(CrossAppDomainData_t574484588, ____ContextID_0)); } inline RuntimeObject * get__ContextID_0() const { return ____ContextID_0; } inline RuntimeObject ** get_address_of__ContextID_0() { return &____ContextID_0; } inline void set__ContextID_0(RuntimeObject * value) { ____ContextID_0 = value; Il2CppCodeGenWriteBarrier((&____ContextID_0), value); } inline static int32_t get_offset_of__DomainID_1() { return static_cast<int32_t>(offsetof(CrossAppDomainData_t574484588, ____DomainID_1)); } inline int32_t get__DomainID_1() const { return ____DomainID_1; } inline int32_t* get_address_of__DomainID_1() { return &____DomainID_1; } inline void set__DomainID_1(int32_t value) { ____DomainID_1 = value; } inline static int32_t get_offset_of__processGuid_2() { return static_cast<int32_t>(offsetof(CrossAppDomainData_t574484588, ____processGuid_2)); } inline String_t* get__processGuid_2() const { return ____processGuid_2; } inline String_t** get_address_of__processGuid_2() { return &____processGuid_2; } inline void set__processGuid_2(String_t* value) { ____processGuid_2 = value; Il2CppCodeGenWriteBarrier((&____processGuid_2), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CROSSAPPDOMAINDATA_T574484588_H #ifndef ACTIVATIONSERVICES_T2214633935_H #define ACTIVATIONSERVICES_T2214633935_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Activation.ActivationServices struct ActivationServices_t2214633935 : public RuntimeObject { public: public: }; struct ActivationServices_t2214633935_StaticFields { public: // System.Runtime.Remoting.Activation.IActivator System.Runtime.Remoting.Activation.ActivationServices::_constructionActivator RuntimeObject* ____constructionActivator_0; public: inline static int32_t get_offset_of__constructionActivator_0() { return static_cast<int32_t>(offsetof(ActivationServices_t2214633935_StaticFields, ____constructionActivator_0)); } inline RuntimeObject* get__constructionActivator_0() const { return ____constructionActivator_0; } inline RuntimeObject** get_address_of__constructionActivator_0() { return &____constructionActivator_0; } inline void set__constructionActivator_0(RuntimeObject* value) { ____constructionActivator_0 = value; Il2CppCodeGenWriteBarrier((&____constructionActivator_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ACTIVATIONSERVICES_T2214633935_H #ifndef APPDOMAINLEVELACTIVATOR_T2561784236_H #define APPDOMAINLEVELACTIVATOR_T2561784236_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Activation.AppDomainLevelActivator struct AppDomainLevelActivator_t2561784236 : public RuntimeObject { public: // System.String System.Runtime.Remoting.Activation.AppDomainLevelActivator::_activationUrl String_t* ____activationUrl_0; // System.Runtime.Remoting.Activation.IActivator System.Runtime.Remoting.Activation.AppDomainLevelActivator::_next RuntimeObject* ____next_1; public: inline static int32_t get_offset_of__activationUrl_0() { return static_cast<int32_t>(offsetof(AppDomainLevelActivator_t2561784236, ____activationUrl_0)); } inline String_t* get__activationUrl_0() const { return ____activationUrl_0; } inline String_t** get_address_of__activationUrl_0() { return &____activationUrl_0; } inline void set__activationUrl_0(String_t* value) { ____activationUrl_0 = value; Il2CppCodeGenWriteBarrier((&____activationUrl_0), value); } inline static int32_t get_offset_of__next_1() { return static_cast<int32_t>(offsetof(AppDomainLevelActivator_t2561784236, ____next_1)); } inline RuntimeObject* get__next_1() const { return ____next_1; } inline RuntimeObject** get_address_of__next_1() { return &____next_1; } inline void set__next_1(RuntimeObject* value) { ____next_1 = value; Il2CppCodeGenWriteBarrier((&____next_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // APPDOMAINLEVELACTIVATOR_T2561784236_H #ifndef CONSTRUCTIONLEVELACTIVATOR_T1090983229_H #define CONSTRUCTIONLEVELACTIVATOR_T1090983229_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Activation.ConstructionLevelActivator struct ConstructionLevelActivator_t1090983229 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONSTRUCTIONLEVELACTIVATOR_T1090983229_H #ifndef CONTEXTLEVELACTIVATOR_T3826340110_H #define CONTEXTLEVELACTIVATOR_T3826340110_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Activation.ContextLevelActivator struct ContextLevelActivator_t3826340110 : public RuntimeObject { public: // System.Runtime.Remoting.Activation.IActivator System.Runtime.Remoting.Activation.ContextLevelActivator::m_NextActivator RuntimeObject* ___m_NextActivator_0; public: inline static int32_t get_offset_of_m_NextActivator_0() { return static_cast<int32_t>(offsetof(ContextLevelActivator_t3826340110, ___m_NextActivator_0)); } inline RuntimeObject* get_m_NextActivator_0() const { return ___m_NextActivator_0; } inline RuntimeObject** get_address_of_m_NextActivator_0() { return &___m_NextActivator_0; } inline void set_m_NextActivator_0(RuntimeObject* value) { ___m_NextActivator_0 = value; Il2CppCodeGenWriteBarrier((&___m_NextActivator_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONTEXTLEVELACTIVATOR_T3826340110_H #ifndef METHODCALL_T3237794944_H #define METHODCALL_T3237794944_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.MethodCall struct MethodCall_t3237794944 : public RuntimeObject { public: // System.String System.Runtime.Remoting.Messaging.MethodCall::_uri String_t* ____uri_0; // System.String System.Runtime.Remoting.Messaging.MethodCall::_typeName String_t* ____typeName_1; // System.String System.Runtime.Remoting.Messaging.MethodCall::_methodName String_t* ____methodName_2; // System.Object[] System.Runtime.Remoting.Messaging.MethodCall::_args ObjectU5BU5D_t769195566* ____args_3; // System.Type[] System.Runtime.Remoting.Messaging.MethodCall::_methodSignature TypeU5BU5D_t3074309185* ____methodSignature_4; // System.Reflection.MethodBase System.Runtime.Remoting.Messaging.MethodCall::_methodBase MethodBase_t995967996 * ____methodBase_5; // System.Runtime.Remoting.Messaging.LogicalCallContext System.Runtime.Remoting.Messaging.MethodCall::_callContext LogicalCallContext_t2351273423 * ____callContext_6; // System.Type[] System.Runtime.Remoting.Messaging.MethodCall::_genericArguments TypeU5BU5D_t3074309185* ____genericArguments_7; // System.Collections.IDictionary System.Runtime.Remoting.Messaging.MethodCall::ExternalProperties RuntimeObject* ___ExternalProperties_8; // System.Collections.IDictionary System.Runtime.Remoting.Messaging.MethodCall::InternalProperties RuntimeObject* ___InternalProperties_9; public: inline static int32_t get_offset_of__uri_0() { return static_cast<int32_t>(offsetof(MethodCall_t3237794944, ____uri_0)); } inline String_t* get__uri_0() const { return ____uri_0; } inline String_t** get_address_of__uri_0() { return &____uri_0; } inline void set__uri_0(String_t* value) { ____uri_0 = value; Il2CppCodeGenWriteBarrier((&____uri_0), value); } inline static int32_t get_offset_of__typeName_1() { return static_cast<int32_t>(offsetof(MethodCall_t3237794944, ____typeName_1)); } inline String_t* get__typeName_1() const { return ____typeName_1; } inline String_t** get_address_of__typeName_1() { return &____typeName_1; } inline void set__typeName_1(String_t* value) { ____typeName_1 = value; Il2CppCodeGenWriteBarrier((&____typeName_1), value); } inline static int32_t get_offset_of__methodName_2() { return static_cast<int32_t>(offsetof(MethodCall_t3237794944, ____methodName_2)); } inline String_t* get__methodName_2() const { return ____methodName_2; } inline String_t** get_address_of__methodName_2() { return &____methodName_2; } inline void set__methodName_2(String_t* value) { ____methodName_2 = value; Il2CppCodeGenWriteBarrier((&____methodName_2), value); } inline static int32_t get_offset_of__args_3() { return static_cast<int32_t>(offsetof(MethodCall_t3237794944, ____args_3)); } inline ObjectU5BU5D_t769195566* get__args_3() const { return ____args_3; } inline ObjectU5BU5D_t769195566** get_address_of__args_3() { return &____args_3; } inline void set__args_3(ObjectU5BU5D_t769195566* value) { ____args_3 = value; Il2CppCodeGenWriteBarrier((&____args_3), value); } inline static int32_t get_offset_of__methodSignature_4() { return static_cast<int32_t>(offsetof(MethodCall_t3237794944, ____methodSignature_4)); } inline TypeU5BU5D_t3074309185* get__methodSignature_4() const { return ____methodSignature_4; } inline TypeU5BU5D_t3074309185** get_address_of__methodSignature_4() { return &____methodSignature_4; } inline void set__methodSignature_4(TypeU5BU5D_t3074309185* value) { ____methodSignature_4 = value; Il2CppCodeGenWriteBarrier((&____methodSignature_4), value); } inline static int32_t get_offset_of__methodBase_5() { return static_cast<int32_t>(offsetof(MethodCall_t3237794944, ____methodBase_5)); } inline MethodBase_t995967996 * get__methodBase_5() const { return ____methodBase_5; } inline MethodBase_t995967996 ** get_address_of__methodBase_5() { return &____methodBase_5; } inline void set__methodBase_5(MethodBase_t995967996 * value) { ____methodBase_5 = value; Il2CppCodeGenWriteBarrier((&____methodBase_5), value); } inline static int32_t get_offset_of__callContext_6() { return static_cast<int32_t>(offsetof(MethodCall_t3237794944, ____callContext_6)); } inline LogicalCallContext_t2351273423 * get__callContext_6() const { return ____callContext_6; } inline LogicalCallContext_t2351273423 ** get_address_of__callContext_6() { return &____callContext_6; } inline void set__callContext_6(LogicalCallContext_t2351273423 * value) { ____callContext_6 = value; Il2CppCodeGenWriteBarrier((&____callContext_6), value); } inline static int32_t get_offset_of__genericArguments_7() { return static_cast<int32_t>(offsetof(MethodCall_t3237794944, ____genericArguments_7)); } inline TypeU5BU5D_t3074309185* get__genericArguments_7() const { return ____genericArguments_7; } inline TypeU5BU5D_t3074309185** get_address_of__genericArguments_7() { return &____genericArguments_7; } inline void set__genericArguments_7(TypeU5BU5D_t3074309185* value) { ____genericArguments_7 = value; Il2CppCodeGenWriteBarrier((&____genericArguments_7), value); } inline static int32_t get_offset_of_ExternalProperties_8() { return static_cast<int32_t>(offsetof(MethodCall_t3237794944, ___ExternalProperties_8)); } inline RuntimeObject* get_ExternalProperties_8() const { return ___ExternalProperties_8; } inline RuntimeObject** get_address_of_ExternalProperties_8() { return &___ExternalProperties_8; } inline void set_ExternalProperties_8(RuntimeObject* value) { ___ExternalProperties_8 = value; Il2CppCodeGenWriteBarrier((&___ExternalProperties_8), value); } inline static int32_t get_offset_of_InternalProperties_9() { return static_cast<int32_t>(offsetof(MethodCall_t3237794944, ___InternalProperties_9)); } inline RuntimeObject* get_InternalProperties_9() const { return ___InternalProperties_9; } inline RuntimeObject** get_address_of_InternalProperties_9() { return &___InternalProperties_9; } inline void set_InternalProperties_9(RuntimeObject* value) { ___InternalProperties_9 = value; Il2CppCodeGenWriteBarrier((&___InternalProperties_9), value); } }; struct MethodCall_t3237794944_StaticFields { public: // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Runtime.Remoting.Messaging.MethodCall::<>f__switch$map1F Dictionary_2_t2512102020 * ___U3CU3Ef__switchU24map1F_10; public: inline static int32_t get_offset_of_U3CU3Ef__switchU24map1F_10() { return static_cast<int32_t>(offsetof(MethodCall_t3237794944_StaticFields, ___U3CU3Ef__switchU24map1F_10)); } inline Dictionary_2_t2512102020 * get_U3CU3Ef__switchU24map1F_10() const { return ___U3CU3Ef__switchU24map1F_10; } inline Dictionary_2_t2512102020 ** get_address_of_U3CU3Ef__switchU24map1F_10() { return &___U3CU3Ef__switchU24map1F_10; } inline void set_U3CU3Ef__switchU24map1F_10(Dictionary_2_t2512102020 * value) { ___U3CU3Ef__switchU24map1F_10 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map1F_10), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // METHODCALL_T3237794944_H #ifndef SYNCHRONIZEDSERVERCONTEXTSINK_T3945465521_H #define SYNCHRONIZEDSERVERCONTEXTSINK_T3945465521_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.SynchronizedServerContextSink struct SynchronizedServerContextSink_t3945465521 : public RuntimeObject { public: // System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Contexts.SynchronizedServerContextSink::_next RuntimeObject* ____next_0; // System.Runtime.Remoting.Contexts.SynchronizationAttribute System.Runtime.Remoting.Contexts.SynchronizedServerContextSink::_att SynchronizationAttribute_t411119687 * ____att_1; public: inline static int32_t get_offset_of__next_0() { return static_cast<int32_t>(offsetof(SynchronizedServerContextSink_t3945465521, ____next_0)); } inline RuntimeObject* get__next_0() const { return ____next_0; } inline RuntimeObject** get_address_of__next_0() { return &____next_0; } inline void set__next_0(RuntimeObject* value) { ____next_0 = value; Il2CppCodeGenWriteBarrier((&____next_0), value); } inline static int32_t get_offset_of__att_1() { return static_cast<int32_t>(offsetof(SynchronizedServerContextSink_t3945465521, ____att_1)); } inline SynchronizationAttribute_t411119687 * get__att_1() const { return ____att_1; } inline SynchronizationAttribute_t411119687 ** get_address_of__att_1() { return &____att_1; } inline void set__att_1(SynchronizationAttribute_t411119687 * value) { ____att_1 = value; Il2CppCodeGenWriteBarrier((&____att_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SYNCHRONIZEDSERVERCONTEXTSINK_T3945465521_H #ifndef LEASEMANAGER_T1090072238_H #define LEASEMANAGER_T1090072238_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Lifetime.LeaseManager struct LeaseManager_t1090072238 : public RuntimeObject { public: // System.Collections.ArrayList System.Runtime.Remoting.Lifetime.LeaseManager::_objects ArrayList_t2438777478 * ____objects_0; // System.Threading.Timer System.Runtime.Remoting.Lifetime.LeaseManager::_timer Timer_t1791731092 * ____timer_1; public: inline static int32_t get_offset_of__objects_0() { return static_cast<int32_t>(offsetof(LeaseManager_t1090072238, ____objects_0)); } inline ArrayList_t2438777478 * get__objects_0() const { return ____objects_0; } inline ArrayList_t2438777478 ** get_address_of__objects_0() { return &____objects_0; } inline void set__objects_0(ArrayList_t2438777478 * value) { ____objects_0 = value; Il2CppCodeGenWriteBarrier((&____objects_0), value); } inline static int32_t get_offset_of__timer_1() { return static_cast<int32_t>(offsetof(LeaseManager_t1090072238, ____timer_1)); } inline Timer_t1791731092 * get__timer_1() const { return ____timer_1; } inline Timer_t1791731092 ** get_address_of__timer_1() { return &____timer_1; } inline void set__timer_1(Timer_t1791731092 * value) { ____timer_1 = value; Il2CppCodeGenWriteBarrier((&____timer_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // LEASEMANAGER_T1090072238_H #ifndef ERRORWRAPPER_T673454179_H #define ERRORWRAPPER_T673454179_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.ErrorWrapper struct ErrorWrapper_t673454179 : public RuntimeObject { public: // System.Int32 System.Runtime.InteropServices.ErrorWrapper::errorCode int32_t ___errorCode_0; public: inline static int32_t get_offset_of_errorCode_0() { return static_cast<int32_t>(offsetof(ErrorWrapper_t673454179, ___errorCode_0)); } inline int32_t get_errorCode_0() const { return ___errorCode_0; } inline int32_t* get_address_of_errorCode_0() { return &___errorCode_0; } inline void set_errorCode_0(int32_t value) { ___errorCode_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ERRORWRAPPER_T673454179_H #ifndef LEASESINK_T3634806523_H #define LEASESINK_T3634806523_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Lifetime.LeaseSink struct LeaseSink_t3634806523 : public RuntimeObject { public: // System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Lifetime.LeaseSink::_nextSink RuntimeObject* ____nextSink_0; public: inline static int32_t get_offset_of__nextSink_0() { return static_cast<int32_t>(offsetof(LeaseSink_t3634806523, ____nextSink_0)); } inline RuntimeObject* get__nextSink_0() const { return ____nextSink_0; } inline RuntimeObject** get_address_of__nextSink_0() { return &____nextSink_0; } inline void set__nextSink_0(RuntimeObject* value) { ____nextSink_0 = value; Il2CppCodeGenWriteBarrier((&____nextSink_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // LEASESINK_T3634806523_H #ifndef ISVOLATILE_T2833933470_H #define ISVOLATILE_T2833933470_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.CompilerServices.IsVolatile struct IsVolatile_t2833933470 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ISVOLATILE_T2833933470_H #ifndef MARSHALBYREFOBJECT_T933609709_H #define MARSHALBYREFOBJECT_T933609709_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.MarshalByRefObject struct MarshalByRefObject_t933609709 : public RuntimeObject { public: // System.Runtime.Remoting.ServerIdentity System.MarshalByRefObject::_identity ServerIdentity_t2406396366 * ____identity_0; public: inline static int32_t get_offset_of__identity_0() { return static_cast<int32_t>(offsetof(MarshalByRefObject_t933609709, ____identity_0)); } inline ServerIdentity_t2406396366 * get__identity_0() const { return ____identity_0; } inline ServerIdentity_t2406396366 ** get_address_of__identity_0() { return &____identity_0; } inline void set__identity_0(ServerIdentity_t2406396366 * value) { ____identity_0 = value; Il2CppCodeGenWriteBarrier((&____identity_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // MARSHALBYREFOBJECT_T933609709_H #ifndef CRITICALFINALIZEROBJECT_T2986371778_H #define CRITICALFINALIZEROBJECT_T2986371778_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.ConstrainedExecution.CriticalFinalizerObject struct CriticalFinalizerObject_t2986371778 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CRITICALFINALIZEROBJECT_T2986371778_H #ifndef CHANNELSERVICES_T3115903791_H #define CHANNELSERVICES_T3115903791_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Channels.ChannelServices struct ChannelServices_t3115903791 : public RuntimeObject { public: public: }; struct ChannelServices_t3115903791_StaticFields { public: // System.Collections.ArrayList System.Runtime.Remoting.Channels.ChannelServices::registeredChannels ArrayList_t2438777478 * ___registeredChannels_0; // System.Collections.ArrayList System.Runtime.Remoting.Channels.ChannelServices::delayedClientChannels ArrayList_t2438777478 * ___delayedClientChannels_1; // System.Runtime.Remoting.Contexts.CrossContextChannel System.Runtime.Remoting.Channels.ChannelServices::_crossContextSink CrossContextChannel_t3170213951 * ____crossContextSink_2; // System.String System.Runtime.Remoting.Channels.ChannelServices::CrossContextUrl String_t* ___CrossContextUrl_3; // System.Collections.IList System.Runtime.Remoting.Channels.ChannelServices::oldStartModeTypes RuntimeObject* ___oldStartModeTypes_4; public: inline static int32_t get_offset_of_registeredChannels_0() { return static_cast<int32_t>(offsetof(ChannelServices_t3115903791_StaticFields, ___registeredChannels_0)); } inline ArrayList_t2438777478 * get_registeredChannels_0() const { return ___registeredChannels_0; } inline ArrayList_t2438777478 ** get_address_of_registeredChannels_0() { return &___registeredChannels_0; } inline void set_registeredChannels_0(ArrayList_t2438777478 * value) { ___registeredChannels_0 = value; Il2CppCodeGenWriteBarrier((&___registeredChannels_0), value); } inline static int32_t get_offset_of_delayedClientChannels_1() { return static_cast<int32_t>(offsetof(ChannelServices_t3115903791_StaticFields, ___delayedClientChannels_1)); } inline ArrayList_t2438777478 * get_delayedClientChannels_1() const { return ___delayedClientChannels_1; } inline ArrayList_t2438777478 ** get_address_of_delayedClientChannels_1() { return &___delayedClientChannels_1; } inline void set_delayedClientChannels_1(ArrayList_t2438777478 * value) { ___delayedClientChannels_1 = value; Il2CppCodeGenWriteBarrier((&___delayedClientChannels_1), value); } inline static int32_t get_offset_of__crossContextSink_2() { return static_cast<int32_t>(offsetof(ChannelServices_t3115903791_StaticFields, ____crossContextSink_2)); } inline CrossContextChannel_t3170213951 * get__crossContextSink_2() const { return ____crossContextSink_2; } inline CrossContextChannel_t3170213951 ** get_address_of__crossContextSink_2() { return &____crossContextSink_2; } inline void set__crossContextSink_2(CrossContextChannel_t3170213951 * value) { ____crossContextSink_2 = value; Il2CppCodeGenWriteBarrier((&____crossContextSink_2), value); } inline static int32_t get_offset_of_CrossContextUrl_3() { return static_cast<int32_t>(offsetof(ChannelServices_t3115903791_StaticFields, ___CrossContextUrl_3)); } inline String_t* get_CrossContextUrl_3() const { return ___CrossContextUrl_3; } inline String_t** get_address_of_CrossContextUrl_3() { return &___CrossContextUrl_3; } inline void set_CrossContextUrl_3(String_t* value) { ___CrossContextUrl_3 = value; Il2CppCodeGenWriteBarrier((&___CrossContextUrl_3), value); } inline static int32_t get_offset_of_oldStartModeTypes_4() { return static_cast<int32_t>(offsetof(ChannelServices_t3115903791_StaticFields, ___oldStartModeTypes_4)); } inline RuntimeObject* get_oldStartModeTypes_4() const { return ___oldStartModeTypes_4; } inline RuntimeObject** get_address_of_oldStartModeTypes_4() { return &___oldStartModeTypes_4; } inline void set_oldStartModeTypes_4(RuntimeObject* value) { ___oldStartModeTypes_4 = value; Il2CppCodeGenWriteBarrier((&___oldStartModeTypes_4), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CHANNELSERVICES_T3115903791_H #ifndef VALUETYPE_T3345440224_H #define VALUETYPE_T3345440224_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.ValueType struct ValueType_t3345440224 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif // Native definition for P/Invoke marshalling of System.ValueType struct ValueType_t3345440224_marshaled_pinvoke { }; // Native definition for COM marshalling of System.ValueType struct ValueType_t3345440224_marshaled_com { }; #endif // VALUETYPE_T3345440224_H #ifndef ACTIVATIONARGUMENTS_T2207697357_H #define ACTIVATIONARGUMENTS_T2207697357_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Hosting.ActivationArguments struct ActivationArguments_t2207697357 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ACTIVATIONARGUMENTS_T2207697357_H #ifndef ATTRIBUTE_T3079708014_H #define ATTRIBUTE_T3079708014_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Attribute struct Attribute_t3079708014 : public RuntimeObject { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ATTRIBUTE_T3079708014_H #ifndef CLIENTCONTEXTTERMINATORSINK_T1720067768_H #define CLIENTCONTEXTTERMINATORSINK_T1720067768_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.ClientContextTerminatorSink struct ClientContextTerminatorSink_t1720067768 : public RuntimeObject { public: // System.Runtime.Remoting.Contexts.Context System.Runtime.Remoting.Messaging.ClientContextTerminatorSink::_context Context_t2330603731 * ____context_0; public: inline static int32_t get_offset_of__context_0() { return static_cast<int32_t>(offsetof(ClientContextTerminatorSink_t1720067768, ____context_0)); } inline Context_t2330603731 * get__context_0() const { return ____context_0; } inline Context_t2330603731 ** get_address_of__context_0() { return &____context_0; } inline void set__context_0(Context_t2330603731 * value) { ____context_0 = value; Il2CppCodeGenWriteBarrier((&____context_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CLIENTCONTEXTTERMINATORSINK_T1720067768_H #ifndef ARGINFO_T4039207888_H #define ARGINFO_T4039207888_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.ArgInfo struct ArgInfo_t4039207888 : public RuntimeObject { public: // System.Int32[] System.Runtime.Remoting.Messaging.ArgInfo::_paramMap Int32U5BU5D_t916272174* ____paramMap_0; // System.Int32 System.Runtime.Remoting.Messaging.ArgInfo::_inoutArgCount int32_t ____inoutArgCount_1; // System.Reflection.MethodBase System.Runtime.Remoting.Messaging.ArgInfo::_method MethodBase_t995967996 * ____method_2; public: inline static int32_t get_offset_of__paramMap_0() { return static_cast<int32_t>(offsetof(ArgInfo_t4039207888, ____paramMap_0)); } inline Int32U5BU5D_t916272174* get__paramMap_0() const { return ____paramMap_0; } inline Int32U5BU5D_t916272174** get_address_of__paramMap_0() { return &____paramMap_0; } inline void set__paramMap_0(Int32U5BU5D_t916272174* value) { ____paramMap_0 = value; Il2CppCodeGenWriteBarrier((&____paramMap_0), value); } inline static int32_t get_offset_of__inoutArgCount_1() { return static_cast<int32_t>(offsetof(ArgInfo_t4039207888, ____inoutArgCount_1)); } inline int32_t get__inoutArgCount_1() const { return ____inoutArgCount_1; } inline int32_t* get_address_of__inoutArgCount_1() { return &____inoutArgCount_1; } inline void set__inoutArgCount_1(int32_t value) { ____inoutArgCount_1 = value; } inline static int32_t get_offset_of__method_2() { return static_cast<int32_t>(offsetof(ArgInfo_t4039207888, ____method_2)); } inline MethodBase_t995967996 * get__method_2() const { return ____method_2; } inline MethodBase_t995967996 ** get_address_of__method_2() { return &____method_2; } inline void set__method_2(MethodBase_t995967996 * value) { ____method_2 = value; Il2CppCodeGenWriteBarrier((&____method_2), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ARGINFO_T4039207888_H #ifndef CHANNELINFO_T1189328240_H #define CHANNELINFO_T1189328240_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.ChannelInfo struct ChannelInfo_t1189328240 : public RuntimeObject { public: // System.Object[] System.Runtime.Remoting.ChannelInfo::channelData ObjectU5BU5D_t769195566* ___channelData_0; public: inline static int32_t get_offset_of_channelData_0() { return static_cast<int32_t>(offsetof(ChannelInfo_t1189328240, ___channelData_0)); } inline ObjectU5BU5D_t769195566* get_channelData_0() const { return ___channelData_0; } inline ObjectU5BU5D_t769195566** get_address_of_channelData_0() { return &___channelData_0; } inline void set_channelData_0(ObjectU5BU5D_t769195566* value) { ___channelData_0 = value; Il2CppCodeGenWriteBarrier((&___channelData_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CHANNELINFO_T1189328240_H #ifndef SYSTEMEXCEPTION_T3102250335_H #define SYSTEMEXCEPTION_T3102250335_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.SystemException struct SystemException_t3102250335 : public Exception_t3830270800 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SYSTEMEXCEPTION_T3102250335_H #ifndef CONTEXTATTRIBUTE_T2427099027_H #define CONTEXTATTRIBUTE_T2427099027_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.ContextAttribute struct ContextAttribute_t2427099027 : public Attribute_t3079708014 { public: // System.String System.Runtime.Remoting.Contexts.ContextAttribute::AttributeName String_t* ___AttributeName_0; public: inline static int32_t get_offset_of_AttributeName_0() { return static_cast<int32_t>(offsetof(ContextAttribute_t2427099027, ___AttributeName_0)); } inline String_t* get_AttributeName_0() const { return ___AttributeName_0; } inline String_t** get_address_of_AttributeName_0() { return &___AttributeName_0; } inline void set_AttributeName_0(String_t* value) { ___AttributeName_0 = value; Il2CppCodeGenWriteBarrier((&___AttributeName_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONTEXTATTRIBUTE_T2427099027_H #ifndef INTPTR_T_H #define INTPTR_T_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.IntPtr struct IntPtr_t { public: // System.Void* System.IntPtr::m_value void* ___m_value_0; public: inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(IntPtr_t, ___m_value_0)); } inline void* get_m_value_0() const { return ___m_value_0; } inline void** get_address_of_m_value_0() { return &___m_value_0; } inline void set_m_value_0(void* value) { ___m_value_0 = value; } }; struct IntPtr_t_StaticFields { public: // System.IntPtr System.IntPtr::Zero IntPtr_t ___Zero_1; public: inline static int32_t get_offset_of_Zero_1() { return static_cast<int32_t>(offsetof(IntPtr_t_StaticFields, ___Zero_1)); } inline IntPtr_t get_Zero_1() const { return ___Zero_1; } inline IntPtr_t* get_address_of_Zero_1() { return &___Zero_1; } inline void set_Zero_1(IntPtr_t value) { ___Zero_1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // INTPTR_T_H #ifndef CONSTRUCTIONCALL_T2325625229_H #define CONSTRUCTIONCALL_T2325625229_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.ConstructionCall struct ConstructionCall_t2325625229 : public MethodCall_t3237794944 { public: // System.Runtime.Remoting.Activation.IActivator System.Runtime.Remoting.Messaging.ConstructionCall::_activator RuntimeObject* ____activator_11; // System.Object[] System.Runtime.Remoting.Messaging.ConstructionCall::_activationAttributes ObjectU5BU5D_t769195566* ____activationAttributes_12; // System.Collections.IList System.Runtime.Remoting.Messaging.ConstructionCall::_contextProperties RuntimeObject* ____contextProperties_13; // System.Type System.Runtime.Remoting.Messaging.ConstructionCall::_activationType Type_t * ____activationType_14; // System.String System.Runtime.Remoting.Messaging.ConstructionCall::_activationTypeName String_t* ____activationTypeName_15; // System.Boolean System.Runtime.Remoting.Messaging.ConstructionCall::_isContextOk bool ____isContextOk_16; public: inline static int32_t get_offset_of__activator_11() { return static_cast<int32_t>(offsetof(ConstructionCall_t2325625229, ____activator_11)); } inline RuntimeObject* get__activator_11() const { return ____activator_11; } inline RuntimeObject** get_address_of__activator_11() { return &____activator_11; } inline void set__activator_11(RuntimeObject* value) { ____activator_11 = value; Il2CppCodeGenWriteBarrier((&____activator_11), value); } inline static int32_t get_offset_of__activationAttributes_12() { return static_cast<int32_t>(offsetof(ConstructionCall_t2325625229, ____activationAttributes_12)); } inline ObjectU5BU5D_t769195566* get__activationAttributes_12() const { return ____activationAttributes_12; } inline ObjectU5BU5D_t769195566** get_address_of__activationAttributes_12() { return &____activationAttributes_12; } inline void set__activationAttributes_12(ObjectU5BU5D_t769195566* value) { ____activationAttributes_12 = value; Il2CppCodeGenWriteBarrier((&____activationAttributes_12), value); } inline static int32_t get_offset_of__contextProperties_13() { return static_cast<int32_t>(offsetof(ConstructionCall_t2325625229, ____contextProperties_13)); } inline RuntimeObject* get__contextProperties_13() const { return ____contextProperties_13; } inline RuntimeObject** get_address_of__contextProperties_13() { return &____contextProperties_13; } inline void set__contextProperties_13(RuntimeObject* value) { ____contextProperties_13 = value; Il2CppCodeGenWriteBarrier((&____contextProperties_13), value); } inline static int32_t get_offset_of__activationType_14() { return static_cast<int32_t>(offsetof(ConstructionCall_t2325625229, ____activationType_14)); } inline Type_t * get__activationType_14() const { return ____activationType_14; } inline Type_t ** get_address_of__activationType_14() { return &____activationType_14; } inline void set__activationType_14(Type_t * value) { ____activationType_14 = value; Il2CppCodeGenWriteBarrier((&____activationType_14), value); } inline static int32_t get_offset_of__activationTypeName_15() { return static_cast<int32_t>(offsetof(ConstructionCall_t2325625229, ____activationTypeName_15)); } inline String_t* get__activationTypeName_15() const { return ____activationTypeName_15; } inline String_t** get_address_of__activationTypeName_15() { return &____activationTypeName_15; } inline void set__activationTypeName_15(String_t* value) { ____activationTypeName_15 = value; Il2CppCodeGenWriteBarrier((&____activationTypeName_15), value); } inline static int32_t get_offset_of__isContextOk_16() { return static_cast<int32_t>(offsetof(ConstructionCall_t2325625229, ____isContextOk_16)); } inline bool get__isContextOk_16() const { return ____isContextOk_16; } inline bool* get_address_of__isContextOk_16() { return &____isContextOk_16; } inline void set__isContextOk_16(bool value) { ____isContextOk_16 = value; } }; struct ConstructionCall_t2325625229_StaticFields { public: // System.Collections.Generic.Dictionary`2<System.String,System.Int32> System.Runtime.Remoting.Messaging.ConstructionCall::<>f__switch$map20 Dictionary_2_t2512102020 * ___U3CU3Ef__switchU24map20_17; public: inline static int32_t get_offset_of_U3CU3Ef__switchU24map20_17() { return static_cast<int32_t>(offsetof(ConstructionCall_t2325625229_StaticFields, ___U3CU3Ef__switchU24map20_17)); } inline Dictionary_2_t2512102020 * get_U3CU3Ef__switchU24map20_17() const { return ___U3CU3Ef__switchU24map20_17; } inline Dictionary_2_t2512102020 ** get_address_of_U3CU3Ef__switchU24map20_17() { return &___U3CU3Ef__switchU24map20_17; } inline void set_U3CU3Ef__switchU24map20_17(Dictionary_2_t2512102020 * value) { ___U3CU3Ef__switchU24map20_17 = value; Il2CppCodeGenWriteBarrier((&___U3CU3Ef__switchU24map20_17), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONSTRUCTIONCALL_T2325625229_H #ifndef UINTPTR_T_H #define UINTPTR_T_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.UIntPtr struct UIntPtr_t { public: // System.Void* System.UIntPtr::_pointer void* ____pointer_1; public: inline static int32_t get_offset_of__pointer_1() { return static_cast<int32_t>(offsetof(UIntPtr_t, ____pointer_1)); } inline void* get__pointer_1() const { return ____pointer_1; } inline void** get_address_of__pointer_1() { return &____pointer_1; } inline void set__pointer_1(void* value) { ____pointer_1 = value; } }; struct UIntPtr_t_StaticFields { public: // System.UIntPtr System.UIntPtr::Zero UIntPtr_t ___Zero_0; public: inline static int32_t get_offset_of_Zero_0() { return static_cast<int32_t>(offsetof(UIntPtr_t_StaticFields, ___Zero_0)); } inline UIntPtr_t get_Zero_0() const { return ___Zero_0; } inline UIntPtr_t * get_address_of_Zero_0() { return &___Zero_0; } inline void set_Zero_0(UIntPtr_t value) { ___Zero_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // UINTPTR_T_H #ifndef CONTEXTBOUNDOBJECT_T3045825805_H #define CONTEXTBOUNDOBJECT_T3045825805_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.ContextBoundObject struct ContextBoundObject_t3045825805 : public MarshalByRefObject_t933609709 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONTEXTBOUNDOBJECT_T3045825805_H #ifndef TIMESPAN_T840839857_H #define TIMESPAN_T840839857_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.TimeSpan struct TimeSpan_t840839857 { public: // System.Int64 System.TimeSpan::_ticks int64_t ____ticks_3; public: inline static int32_t get_offset_of__ticks_3() { return static_cast<int32_t>(offsetof(TimeSpan_t840839857, ____ticks_3)); } inline int64_t get__ticks_3() const { return ____ticks_3; } inline int64_t* get_address_of__ticks_3() { return &____ticks_3; } inline void set__ticks_3(int64_t value) { ____ticks_3 = value; } }; struct TimeSpan_t840839857_StaticFields { public: // System.TimeSpan System.TimeSpan::MaxValue TimeSpan_t840839857 ___MaxValue_0; // System.TimeSpan System.TimeSpan::MinValue TimeSpan_t840839857 ___MinValue_1; // System.TimeSpan System.TimeSpan::Zero TimeSpan_t840839857 ___Zero_2; public: inline static int32_t get_offset_of_MaxValue_0() { return static_cast<int32_t>(offsetof(TimeSpan_t840839857_StaticFields, ___MaxValue_0)); } inline TimeSpan_t840839857 get_MaxValue_0() const { return ___MaxValue_0; } inline TimeSpan_t840839857 * get_address_of_MaxValue_0() { return &___MaxValue_0; } inline void set_MaxValue_0(TimeSpan_t840839857 value) { ___MaxValue_0 = value; } inline static int32_t get_offset_of_MinValue_1() { return static_cast<int32_t>(offsetof(TimeSpan_t840839857_StaticFields, ___MinValue_1)); } inline TimeSpan_t840839857 get_MinValue_1() const { return ___MinValue_1; } inline TimeSpan_t840839857 * get_address_of_MinValue_1() { return &___MinValue_1; } inline void set_MinValue_1(TimeSpan_t840839857 value) { ___MinValue_1 = value; } inline static int32_t get_offset_of_Zero_2() { return static_cast<int32_t>(offsetof(TimeSpan_t840839857_StaticFields, ___Zero_2)); } inline TimeSpan_t840839857 get_Zero_2() const { return ___Zero_2; } inline TimeSpan_t840839857 * get_address_of_Zero_2() { return &___Zero_2; } inline void set_Zero_2(TimeSpan_t840839857 value) { ___Zero_2 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // TIMESPAN_T840839857_H #ifndef ENUM_T1530692393_H #define ENUM_T1530692393_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Enum struct Enum_t1530692393 : public ValueType_t3345440224 { public: public: }; struct Enum_t1530692393_StaticFields { public: // System.Char[] System.Enum::split_char CharU5BU5D_t2644401608* ___split_char_0; public: inline static int32_t get_offset_of_split_char_0() { return static_cast<int32_t>(offsetof(Enum_t1530692393_StaticFields, ___split_char_0)); } inline CharU5BU5D_t2644401608* get_split_char_0() const { return ___split_char_0; } inline CharU5BU5D_t2644401608** get_address_of_split_char_0() { return &___split_char_0; } inline void set_split_char_0(CharU5BU5D_t2644401608* value) { ___split_char_0 = value; Il2CppCodeGenWriteBarrier((&___split_char_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif // Native definition for P/Invoke marshalling of System.Enum struct Enum_t1530692393_marshaled_pinvoke { }; // Native definition for COM marshalling of System.Enum struct Enum_t1530692393_marshaled_com { }; #endif // ENUM_T1530692393_H #ifndef REMOTEACTIVATOR_T211973416_H #define REMOTEACTIVATOR_T211973416_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Activation.RemoteActivator struct RemoteActivator_t211973416 : public MarshalByRefObject_t933609709 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // REMOTEACTIVATOR_T211973416_H #ifndef DISPIDATTRIBUTE_T2048450649_H #define DISPIDATTRIBUTE_T2048450649_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.DispIdAttribute struct DispIdAttribute_t2048450649 : public Attribute_t3079708014 { public: // System.Int32 System.Runtime.InteropServices.DispIdAttribute::id int32_t ___id_0; public: inline static int32_t get_offset_of_id_0() { return static_cast<int32_t>(offsetof(DispIdAttribute_t2048450649, ___id_0)); } inline int32_t get_id_0() const { return ___id_0; } inline int32_t* get_address_of_id_0() { return &___id_0; } inline void set_id_0(int32_t value) { ___id_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // DISPIDATTRIBUTE_T2048450649_H #ifndef TYPELIBVERSIONATTRIBUTE_T2491756700_H #define TYPELIBVERSIONATTRIBUTE_T2491756700_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.TypeLibVersionAttribute struct TypeLibVersionAttribute_t2491756700 : public Attribute_t3079708014 { public: // System.Int32 System.Runtime.InteropServices.TypeLibVersionAttribute::major int32_t ___major_0; // System.Int32 System.Runtime.InteropServices.TypeLibVersionAttribute::minor int32_t ___minor_1; public: inline static int32_t get_offset_of_major_0() { return static_cast<int32_t>(offsetof(TypeLibVersionAttribute_t2491756700, ___major_0)); } inline int32_t get_major_0() const { return ___major_0; } inline int32_t* get_address_of_major_0() { return &___major_0; } inline void set_major_0(int32_t value) { ___major_0 = value; } inline static int32_t get_offset_of_minor_1() { return static_cast<int32_t>(offsetof(TypeLibVersionAttribute_t2491756700, ___minor_1)); } inline int32_t get_minor_1() const { return ___minor_1; } inline int32_t* get_address_of_minor_1() { return &___minor_1; } inline void set_minor_1(int32_t value) { ___minor_1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // TYPELIBVERSIONATTRIBUTE_T2491756700_H #ifndef TYPELIBIMPORTCLASSATTRIBUTE_T3102149076_H #define TYPELIBIMPORTCLASSATTRIBUTE_T3102149076_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.TypeLibImportClassAttribute struct TypeLibImportClassAttribute_t3102149076 : public Attribute_t3079708014 { public: // System.String System.Runtime.InteropServices.TypeLibImportClassAttribute::_importClass String_t* ____importClass_0; public: inline static int32_t get_offset_of__importClass_0() { return static_cast<int32_t>(offsetof(TypeLibImportClassAttribute_t3102149076, ____importClass_0)); } inline String_t* get__importClass_0() const { return ____importClass_0; } inline String_t** get_address_of__importClass_0() { return &____importClass_0; } inline void set__importClass_0(String_t* value) { ____importClass_0 = value; Il2CppCodeGenWriteBarrier((&____importClass_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // TYPELIBIMPORTCLASSATTRIBUTE_T3102149076_H #ifndef STRINGFREEZINGATTRIBUTE_T156983079_H #define STRINGFREEZINGATTRIBUTE_T156983079_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.CompilerServices.StringFreezingAttribute struct StringFreezingAttribute_t156983079 : public Attribute_t3079708014 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // STRINGFREEZINGATTRIBUTE_T156983079_H #ifndef COMDEFAULTINTERFACEATTRIBUTE_T1827578934_H #define COMDEFAULTINTERFACEATTRIBUTE_T1827578934_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.ComDefaultInterfaceAttribute struct ComDefaultInterfaceAttribute_t1827578934 : public Attribute_t3079708014 { public: // System.Type System.Runtime.InteropServices.ComDefaultInterfaceAttribute::_type Type_t * ____type_0; public: inline static int32_t get_offset_of__type_0() { return static_cast<int32_t>(offsetof(ComDefaultInterfaceAttribute_t1827578934, ____type_0)); } inline Type_t * get__type_0() const { return ____type_0; } inline Type_t ** get_address_of__type_0() { return &____type_0; } inline void set__type_0(Type_t * value) { ____type_0 = value; Il2CppCodeGenWriteBarrier((&____type_0), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // COMDEFAULTINTERFACEATTRIBUTE_T1827578934_H #ifndef PRESERVESIGATTRIBUTE_T1970273383_H #define PRESERVESIGATTRIBUTE_T1970273383_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.PreserveSigAttribute struct PreserveSigAttribute_t1970273383 : public Attribute_t3079708014 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // PRESERVESIGATTRIBUTE_T1970273383_H #ifndef GCHANDLE_T2835010403_H #define GCHANDLE_T2835010403_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.GCHandle struct GCHandle_t2835010403 { public: // System.Int32 System.Runtime.InteropServices.GCHandle::handle int32_t ___handle_0; public: inline static int32_t get_offset_of_handle_0() { return static_cast<int32_t>(offsetof(GCHandle_t2835010403, ___handle_0)); } inline int32_t get_handle_0() const { return ___handle_0; } inline int32_t* get_address_of_handle_0() { return &___handle_0; } inline void set_handle_0(int32_t value) { ___handle_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // GCHANDLE_T2835010403_H #ifndef COMCOMPATIBLEVERSIONATTRIBUTE_T3291056560_H #define COMCOMPATIBLEVERSIONATTRIBUTE_T3291056560_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.ComCompatibleVersionAttribute struct ComCompatibleVersionAttribute_t3291056560 : public Attribute_t3079708014 { public: // System.Int32 System.Runtime.InteropServices.ComCompatibleVersionAttribute::major int32_t ___major_0; // System.Int32 System.Runtime.InteropServices.ComCompatibleVersionAttribute::minor int32_t ___minor_1; // System.Int32 System.Runtime.InteropServices.ComCompatibleVersionAttribute::build int32_t ___build_2; // System.Int32 System.Runtime.InteropServices.ComCompatibleVersionAttribute::revision int32_t ___revision_3; public: inline static int32_t get_offset_of_major_0() { return static_cast<int32_t>(offsetof(ComCompatibleVersionAttribute_t3291056560, ___major_0)); } inline int32_t get_major_0() const { return ___major_0; } inline int32_t* get_address_of_major_0() { return &___major_0; } inline void set_major_0(int32_t value) { ___major_0 = value; } inline static int32_t get_offset_of_minor_1() { return static_cast<int32_t>(offsetof(ComCompatibleVersionAttribute_t3291056560, ___minor_1)); } inline int32_t get_minor_1() const { return ___minor_1; } inline int32_t* get_address_of_minor_1() { return &___minor_1; } inline void set_minor_1(int32_t value) { ___minor_1 = value; } inline static int32_t get_offset_of_build_2() { return static_cast<int32_t>(offsetof(ComCompatibleVersionAttribute_t3291056560, ___build_2)); } inline int32_t get_build_2() const { return ___build_2; } inline int32_t* get_address_of_build_2() { return &___build_2; } inline void set_build_2(int32_t value) { ___build_2 = value; } inline static int32_t get_offset_of_revision_3() { return static_cast<int32_t>(offsetof(ComCompatibleVersionAttribute_t3291056560, ___revision_3)); } inline int32_t get_revision_3() const { return ___revision_3; } inline int32_t* get_address_of_revision_3() { return &___revision_3; } inline void set_revision_3(int32_t value) { ___revision_3 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // COMCOMPATIBLEVERSIONATTRIBUTE_T3291056560_H #ifndef UNMANAGEDTYPE_T1898932253_H #define UNMANAGEDTYPE_T1898932253_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.UnmanagedType struct UnmanagedType_t1898932253 { public: // System.Int32 System.Runtime.InteropServices.UnmanagedType::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(UnmanagedType_t1898932253, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // UNMANAGEDTYPE_T1898932253_H #ifndef CLASSINTERFACETYPE_T2994377095_H #define CLASSINTERFACETYPE_T2994377095_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.ClassInterfaceType struct ClassInterfaceType_t2994377095 { public: // System.Int32 System.Runtime.InteropServices.ClassInterfaceType::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(ClassInterfaceType_t2994377095, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CLASSINTERFACETYPE_T2994377095_H #ifndef CALLINGCONVENTION_T1014109383_H #define CALLINGCONVENTION_T1014109383_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.CallingConvention struct CallingConvention_t1014109383 { public: // System.Int32 System.Runtime.InteropServices.CallingConvention::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(CallingConvention_t1014109383, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CALLINGCONVENTION_T1014109383_H #ifndef ASYNCRESULT_T3008645073_H #define ASYNCRESULT_T3008645073_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.AsyncResult struct AsyncResult_t3008645073 : public RuntimeObject { public: // System.Object System.Runtime.Remoting.Messaging.AsyncResult::async_state RuntimeObject * ___async_state_0; // System.Threading.WaitHandle System.Runtime.Remoting.Messaging.AsyncResult::handle WaitHandle_t3530316433 * ___handle_1; // System.Object System.Runtime.Remoting.Messaging.AsyncResult::async_delegate RuntimeObject * ___async_delegate_2; // System.IntPtr System.Runtime.Remoting.Messaging.AsyncResult::data IntPtr_t ___data_3; // System.Object System.Runtime.Remoting.Messaging.AsyncResult::object_data RuntimeObject * ___object_data_4; // System.Boolean System.Runtime.Remoting.Messaging.AsyncResult::sync_completed bool ___sync_completed_5; // System.Boolean System.Runtime.Remoting.Messaging.AsyncResult::completed bool ___completed_6; // System.Boolean System.Runtime.Remoting.Messaging.AsyncResult::endinvoke_called bool ___endinvoke_called_7; // System.Object System.Runtime.Remoting.Messaging.AsyncResult::async_callback RuntimeObject * ___async_callback_8; // System.Threading.ExecutionContext System.Runtime.Remoting.Messaging.AsyncResult::current ExecutionContext_t1961146903 * ___current_9; // System.Threading.ExecutionContext System.Runtime.Remoting.Messaging.AsyncResult::original ExecutionContext_t1961146903 * ___original_10; // System.Int32 System.Runtime.Remoting.Messaging.AsyncResult::gchandle int32_t ___gchandle_11; // System.Runtime.Remoting.Messaging.MonoMethodMessage System.Runtime.Remoting.Messaging.AsyncResult::call_message MonoMethodMessage_t1289019874 * ___call_message_12; // System.Runtime.Remoting.Messaging.IMessageCtrl System.Runtime.Remoting.Messaging.AsyncResult::message_ctrl RuntimeObject* ___message_ctrl_13; // System.Runtime.Remoting.Messaging.IMessage System.Runtime.Remoting.Messaging.AsyncResult::reply_message RuntimeObject* ___reply_message_14; public: inline static int32_t get_offset_of_async_state_0() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___async_state_0)); } inline RuntimeObject * get_async_state_0() const { return ___async_state_0; } inline RuntimeObject ** get_address_of_async_state_0() { return &___async_state_0; } inline void set_async_state_0(RuntimeObject * value) { ___async_state_0 = value; Il2CppCodeGenWriteBarrier((&___async_state_0), value); } inline static int32_t get_offset_of_handle_1() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___handle_1)); } inline WaitHandle_t3530316433 * get_handle_1() const { return ___handle_1; } inline WaitHandle_t3530316433 ** get_address_of_handle_1() { return &___handle_1; } inline void set_handle_1(WaitHandle_t3530316433 * value) { ___handle_1 = value; Il2CppCodeGenWriteBarrier((&___handle_1), value); } inline static int32_t get_offset_of_async_delegate_2() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___async_delegate_2)); } inline RuntimeObject * get_async_delegate_2() const { return ___async_delegate_2; } inline RuntimeObject ** get_address_of_async_delegate_2() { return &___async_delegate_2; } inline void set_async_delegate_2(RuntimeObject * value) { ___async_delegate_2 = value; Il2CppCodeGenWriteBarrier((&___async_delegate_2), value); } inline static int32_t get_offset_of_data_3() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___data_3)); } inline IntPtr_t get_data_3() const { return ___data_3; } inline IntPtr_t* get_address_of_data_3() { return &___data_3; } inline void set_data_3(IntPtr_t value) { ___data_3 = value; } inline static int32_t get_offset_of_object_data_4() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___object_data_4)); } inline RuntimeObject * get_object_data_4() const { return ___object_data_4; } inline RuntimeObject ** get_address_of_object_data_4() { return &___object_data_4; } inline void set_object_data_4(RuntimeObject * value) { ___object_data_4 = value; Il2CppCodeGenWriteBarrier((&___object_data_4), value); } inline static int32_t get_offset_of_sync_completed_5() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___sync_completed_5)); } inline bool get_sync_completed_5() const { return ___sync_completed_5; } inline bool* get_address_of_sync_completed_5() { return &___sync_completed_5; } inline void set_sync_completed_5(bool value) { ___sync_completed_5 = value; } inline static int32_t get_offset_of_completed_6() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___completed_6)); } inline bool get_completed_6() const { return ___completed_6; } inline bool* get_address_of_completed_6() { return &___completed_6; } inline void set_completed_6(bool value) { ___completed_6 = value; } inline static int32_t get_offset_of_endinvoke_called_7() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___endinvoke_called_7)); } inline bool get_endinvoke_called_7() const { return ___endinvoke_called_7; } inline bool* get_address_of_endinvoke_called_7() { return &___endinvoke_called_7; } inline void set_endinvoke_called_7(bool value) { ___endinvoke_called_7 = value; } inline static int32_t get_offset_of_async_callback_8() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___async_callback_8)); } inline RuntimeObject * get_async_callback_8() const { return ___async_callback_8; } inline RuntimeObject ** get_address_of_async_callback_8() { return &___async_callback_8; } inline void set_async_callback_8(RuntimeObject * value) { ___async_callback_8 = value; Il2CppCodeGenWriteBarrier((&___async_callback_8), value); } inline static int32_t get_offset_of_current_9() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___current_9)); } inline ExecutionContext_t1961146903 * get_current_9() const { return ___current_9; } inline ExecutionContext_t1961146903 ** get_address_of_current_9() { return &___current_9; } inline void set_current_9(ExecutionContext_t1961146903 * value) { ___current_9 = value; Il2CppCodeGenWriteBarrier((&___current_9), value); } inline static int32_t get_offset_of_original_10() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___original_10)); } inline ExecutionContext_t1961146903 * get_original_10() const { return ___original_10; } inline ExecutionContext_t1961146903 ** get_address_of_original_10() { return &___original_10; } inline void set_original_10(ExecutionContext_t1961146903 * value) { ___original_10 = value; Il2CppCodeGenWriteBarrier((&___original_10), value); } inline static int32_t get_offset_of_gchandle_11() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___gchandle_11)); } inline int32_t get_gchandle_11() const { return ___gchandle_11; } inline int32_t* get_address_of_gchandle_11() { return &___gchandle_11; } inline void set_gchandle_11(int32_t value) { ___gchandle_11 = value; } inline static int32_t get_offset_of_call_message_12() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___call_message_12)); } inline MonoMethodMessage_t1289019874 * get_call_message_12() const { return ___call_message_12; } inline MonoMethodMessage_t1289019874 ** get_address_of_call_message_12() { return &___call_message_12; } inline void set_call_message_12(MonoMethodMessage_t1289019874 * value) { ___call_message_12 = value; Il2CppCodeGenWriteBarrier((&___call_message_12), value); } inline static int32_t get_offset_of_message_ctrl_13() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___message_ctrl_13)); } inline RuntimeObject* get_message_ctrl_13() const { return ___message_ctrl_13; } inline RuntimeObject** get_address_of_message_ctrl_13() { return &___message_ctrl_13; } inline void set_message_ctrl_13(RuntimeObject* value) { ___message_ctrl_13 = value; Il2CppCodeGenWriteBarrier((&___message_ctrl_13), value); } inline static int32_t get_offset_of_reply_message_14() { return static_cast<int32_t>(offsetof(AsyncResult_t3008645073, ___reply_message_14)); } inline RuntimeObject* get_reply_message_14() const { return ___reply_message_14; } inline RuntimeObject** get_address_of_reply_message_14() { return &___reply_message_14; } inline void set_reply_message_14(RuntimeObject* value) { ___reply_message_14 = value; Il2CppCodeGenWriteBarrier((&___reply_message_14), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ASYNCRESULT_T3008645073_H #ifndef CONSISTENCY_T1542326778_H #define CONSISTENCY_T1542326778_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.ConstrainedExecution.Consistency struct Consistency_t1542326778 { public: // System.Int32 System.Runtime.ConstrainedExecution.Consistency::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Consistency_t1542326778, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONSISTENCY_T1542326778_H #ifndef CER_T492585041_H #define CER_T492585041_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.ConstrainedExecution.Cer struct Cer_t492585041 { public: // System.Int32 System.Runtime.ConstrainedExecution.Cer::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Cer_t492585041, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CER_T492585041_H #ifndef LOADHINT_T3195656583_H #define LOADHINT_T3195656583_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.CompilerServices.LoadHint struct LoadHint_t3195656583 { public: // System.Int32 System.Runtime.CompilerServices.LoadHint::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(LoadHint_t3195656583, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // LOADHINT_T3195656583_H #ifndef CHARSET_T2018390796_H #define CHARSET_T2018390796_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.CharSet struct CharSet_t2018390796 { public: // System.Int32 System.Runtime.InteropServices.CharSet::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(CharSet_t2018390796, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CHARSET_T2018390796_H #ifndef COMINTERFACETYPE_T3828477597_H #define COMINTERFACETYPE_T3828477597_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.ComInterfaceType struct ComInterfaceType_t3828477597 { public: // System.Int32 System.Runtime.InteropServices.ComInterfaceType::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(ComInterfaceType_t3828477597, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // COMINTERFACETYPE_T3828477597_H #ifndef ARGINFOTYPE_T687995025_H #define ARGINFOTYPE_T687995025_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Messaging.ArgInfoType struct ArgInfoType_t687995025 { public: // System.Byte System.Runtime.Remoting.Messaging.ArgInfoType::value__ uint8_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(ArgInfoType_t687995025, ___value___1)); } inline uint8_t get_value___1() const { return ___value___1; } inline uint8_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(uint8_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // ARGINFOTYPE_T687995025_H #ifndef LIFETIMESERVICES_T1712433763_H #define LIFETIMESERVICES_T1712433763_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Lifetime.LifetimeServices struct LifetimeServices_t1712433763 : public RuntimeObject { public: public: }; struct LifetimeServices_t1712433763_StaticFields { public: // System.TimeSpan System.Runtime.Remoting.Lifetime.LifetimeServices::_leaseManagerPollTime TimeSpan_t840839857 ____leaseManagerPollTime_0; // System.TimeSpan System.Runtime.Remoting.Lifetime.LifetimeServices::_leaseTime TimeSpan_t840839857 ____leaseTime_1; // System.TimeSpan System.Runtime.Remoting.Lifetime.LifetimeServices::_renewOnCallTime TimeSpan_t840839857 ____renewOnCallTime_2; // System.TimeSpan System.Runtime.Remoting.Lifetime.LifetimeServices::_sponsorshipTimeout TimeSpan_t840839857 ____sponsorshipTimeout_3; // System.Runtime.Remoting.Lifetime.LeaseManager System.Runtime.Remoting.Lifetime.LifetimeServices::_leaseManager LeaseManager_t1090072238 * ____leaseManager_4; public: inline static int32_t get_offset_of__leaseManagerPollTime_0() { return static_cast<int32_t>(offsetof(LifetimeServices_t1712433763_StaticFields, ____leaseManagerPollTime_0)); } inline TimeSpan_t840839857 get__leaseManagerPollTime_0() const { return ____leaseManagerPollTime_0; } inline TimeSpan_t840839857 * get_address_of__leaseManagerPollTime_0() { return &____leaseManagerPollTime_0; } inline void set__leaseManagerPollTime_0(TimeSpan_t840839857 value) { ____leaseManagerPollTime_0 = value; } inline static int32_t get_offset_of__leaseTime_1() { return static_cast<int32_t>(offsetof(LifetimeServices_t1712433763_StaticFields, ____leaseTime_1)); } inline TimeSpan_t840839857 get__leaseTime_1() const { return ____leaseTime_1; } inline TimeSpan_t840839857 * get_address_of__leaseTime_1() { return &____leaseTime_1; } inline void set__leaseTime_1(TimeSpan_t840839857 value) { ____leaseTime_1 = value; } inline static int32_t get_offset_of__renewOnCallTime_2() { return static_cast<int32_t>(offsetof(LifetimeServices_t1712433763_StaticFields, ____renewOnCallTime_2)); } inline TimeSpan_t840839857 get__renewOnCallTime_2() const { return ____renewOnCallTime_2; } inline TimeSpan_t840839857 * get_address_of__renewOnCallTime_2() { return &____renewOnCallTime_2; } inline void set__renewOnCallTime_2(TimeSpan_t840839857 value) { ____renewOnCallTime_2 = value; } inline static int32_t get_offset_of__sponsorshipTimeout_3() { return static_cast<int32_t>(offsetof(LifetimeServices_t1712433763_StaticFields, ____sponsorshipTimeout_3)); } inline TimeSpan_t840839857 get__sponsorshipTimeout_3() const { return ____sponsorshipTimeout_3; } inline TimeSpan_t840839857 * get_address_of__sponsorshipTimeout_3() { return &____sponsorshipTimeout_3; } inline void set__sponsorshipTimeout_3(TimeSpan_t840839857 value) { ____sponsorshipTimeout_3 = value; } inline static int32_t get_offset_of__leaseManager_4() { return static_cast<int32_t>(offsetof(LifetimeServices_t1712433763_StaticFields, ____leaseManager_4)); } inline LeaseManager_t1090072238 * get__leaseManager_4() const { return ____leaseManager_4; } inline LeaseManager_t1090072238 ** get_address_of__leaseManager_4() { return &____leaseManager_4; } inline void set__leaseManager_4(LeaseManager_t1090072238 * value) { ____leaseManager_4 = value; Il2CppCodeGenWriteBarrier((&____leaseManager_4), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // LIFETIMESERVICES_T1712433763_H #ifndef EXTERNALEXCEPTION_T2731287062_H #define EXTERNALEXCEPTION_T2731287062_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.ExternalException struct ExternalException_t2731287062 : public SystemException_t3102250335 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // EXTERNALEXCEPTION_T2731287062_H #ifndef GCHANDLETYPE_T2285338652_H #define GCHANDLETYPE_T2285338652_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.GCHandleType struct GCHandleType_t2285338652 { public: // System.Int32 System.Runtime.InteropServices.GCHandleType::value__ int32_t ___value___1; public: inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(GCHandleType_t2285338652, ___value___1)); } inline int32_t get_value___1() const { return ___value___1; } inline int32_t* get_address_of_value___1() { return &___value___1; } inline void set_value___1(int32_t value) { ___value___1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // GCHANDLETYPE_T2285338652_H #ifndef SYNCHRONIZATIONATTRIBUTE_T411119687_H #define SYNCHRONIZATIONATTRIBUTE_T411119687_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.SynchronizationAttribute struct SynchronizationAttribute_t411119687 : public ContextAttribute_t2427099027 { public: // System.Boolean System.Runtime.Remoting.Contexts.SynchronizationAttribute::_bReEntrant bool ____bReEntrant_1; // System.Int32 System.Runtime.Remoting.Contexts.SynchronizationAttribute::_flavor int32_t ____flavor_2; // System.Int32 System.Runtime.Remoting.Contexts.SynchronizationAttribute::_lockCount int32_t ____lockCount_3; // System.Threading.Mutex System.Runtime.Remoting.Contexts.SynchronizationAttribute::_mutex Mutex_t4287421805 * ____mutex_4; // System.Threading.Thread System.Runtime.Remoting.Contexts.SynchronizationAttribute::_ownerThread Thread_t3626738102 * ____ownerThread_5; public: inline static int32_t get_offset_of__bReEntrant_1() { return static_cast<int32_t>(offsetof(SynchronizationAttribute_t411119687, ____bReEntrant_1)); } inline bool get__bReEntrant_1() const { return ____bReEntrant_1; } inline bool* get_address_of__bReEntrant_1() { return &____bReEntrant_1; } inline void set__bReEntrant_1(bool value) { ____bReEntrant_1 = value; } inline static int32_t get_offset_of__flavor_2() { return static_cast<int32_t>(offsetof(SynchronizationAttribute_t411119687, ____flavor_2)); } inline int32_t get__flavor_2() const { return ____flavor_2; } inline int32_t* get_address_of__flavor_2() { return &____flavor_2; } inline void set__flavor_2(int32_t value) { ____flavor_2 = value; } inline static int32_t get_offset_of__lockCount_3() { return static_cast<int32_t>(offsetof(SynchronizationAttribute_t411119687, ____lockCount_3)); } inline int32_t get__lockCount_3() const { return ____lockCount_3; } inline int32_t* get_address_of__lockCount_3() { return &____lockCount_3; } inline void set__lockCount_3(int32_t value) { ____lockCount_3 = value; } inline static int32_t get_offset_of__mutex_4() { return static_cast<int32_t>(offsetof(SynchronizationAttribute_t411119687, ____mutex_4)); } inline Mutex_t4287421805 * get__mutex_4() const { return ____mutex_4; } inline Mutex_t4287421805 ** get_address_of__mutex_4() { return &____mutex_4; } inline void set__mutex_4(Mutex_t4287421805 * value) { ____mutex_4 = value; Il2CppCodeGenWriteBarrier((&____mutex_4), value); } inline static int32_t get_offset_of__ownerThread_5() { return static_cast<int32_t>(offsetof(SynchronizationAttribute_t411119687, ____ownerThread_5)); } inline Thread_t3626738102 * get__ownerThread_5() const { return ____ownerThread_5; } inline Thread_t3626738102 ** get_address_of__ownerThread_5() { return &____ownerThread_5; } inline void set__ownerThread_5(Thread_t3626738102 * value) { ____ownerThread_5 = value; Il2CppCodeGenWriteBarrier((&____ownerThread_5), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SYNCHRONIZATIONATTRIBUTE_T411119687_H #ifndef MARSHALDIRECTIVEEXCEPTION_T1726941138_H #define MARSHALDIRECTIVEEXCEPTION_T1726941138_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.MarshalDirectiveException struct MarshalDirectiveException_t1726941138 : public SystemException_t3102250335 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // MARSHALDIRECTIVEEXCEPTION_T1726941138_H #ifndef CONTEXTCALLBACKOBJECT_T4236601005_H #define CONTEXTCALLBACKOBJECT_T4236601005_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.ContextCallbackObject struct ContextCallbackObject_t4236601005 : public ContextBoundObject_t3045825805 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONTEXTCALLBACKOBJECT_T4236601005_H #ifndef SAFEHANDLE_T1168232028_H #define SAFEHANDLE_T1168232028_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.SafeHandle struct SafeHandle_t1168232028 : public CriticalFinalizerObject_t2986371778 { public: // System.IntPtr System.Runtime.InteropServices.SafeHandle::handle IntPtr_t ___handle_0; // System.IntPtr System.Runtime.InteropServices.SafeHandle::invalid_handle_value IntPtr_t ___invalid_handle_value_1; // System.Int32 System.Runtime.InteropServices.SafeHandle::refcount int32_t ___refcount_2; // System.Boolean System.Runtime.InteropServices.SafeHandle::owns_handle bool ___owns_handle_3; public: inline static int32_t get_offset_of_handle_0() { return static_cast<int32_t>(offsetof(SafeHandle_t1168232028, ___handle_0)); } inline IntPtr_t get_handle_0() const { return ___handle_0; } inline IntPtr_t* get_address_of_handle_0() { return &___handle_0; } inline void set_handle_0(IntPtr_t value) { ___handle_0 = value; } inline static int32_t get_offset_of_invalid_handle_value_1() { return static_cast<int32_t>(offsetof(SafeHandle_t1168232028, ___invalid_handle_value_1)); } inline IntPtr_t get_invalid_handle_value_1() const { return ___invalid_handle_value_1; } inline IntPtr_t* get_address_of_invalid_handle_value_1() { return &___invalid_handle_value_1; } inline void set_invalid_handle_value_1(IntPtr_t value) { ___invalid_handle_value_1 = value; } inline static int32_t get_offset_of_refcount_2() { return static_cast<int32_t>(offsetof(SafeHandle_t1168232028, ___refcount_2)); } inline int32_t get_refcount_2() const { return ___refcount_2; } inline int32_t* get_address_of_refcount_2() { return &___refcount_2; } inline void set_refcount_2(int32_t value) { ___refcount_2 = value; } inline static int32_t get_offset_of_owns_handle_3() { return static_cast<int32_t>(offsetof(SafeHandle_t1168232028, ___owns_handle_3)); } inline bool get_owns_handle_3() const { return ___owns_handle_3; } inline bool* get_address_of_owns_handle_3() { return &___owns_handle_3; } inline void set_owns_handle_3(bool value) { ___owns_handle_3 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // SAFEHANDLE_T1168232028_H #ifndef CONTEXT_T2330603731_H #define CONTEXT_T2330603731_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Contexts.Context struct Context_t2330603731 : public RuntimeObject { public: // System.Int32 System.Runtime.Remoting.Contexts.Context::domain_id int32_t ___domain_id_0; // System.Int32 System.Runtime.Remoting.Contexts.Context::context_id int32_t ___context_id_1; // System.UIntPtr System.Runtime.Remoting.Contexts.Context::static_data UIntPtr_t ___static_data_2; // System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Contexts.Context::server_context_sink_chain RuntimeObject* ___server_context_sink_chain_4; // System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Contexts.Context::client_context_sink_chain RuntimeObject* ___client_context_sink_chain_5; // System.Object[] System.Runtime.Remoting.Contexts.Context::datastore ObjectU5BU5D_t769195566* ___datastore_6; // System.Collections.ArrayList System.Runtime.Remoting.Contexts.Context::context_properties ArrayList_t2438777478 * ___context_properties_7; // System.Boolean System.Runtime.Remoting.Contexts.Context::frozen bool ___frozen_8; // System.Runtime.Remoting.Contexts.DynamicPropertyCollection System.Runtime.Remoting.Contexts.Context::context_dynamic_properties DynamicPropertyCollection_t3079317807 * ___context_dynamic_properties_12; // System.Runtime.Remoting.Contexts.ContextCallbackObject System.Runtime.Remoting.Contexts.Context::callback_object ContextCallbackObject_t4236601005 * ___callback_object_13; public: inline static int32_t get_offset_of_domain_id_0() { return static_cast<int32_t>(offsetof(Context_t2330603731, ___domain_id_0)); } inline int32_t get_domain_id_0() const { return ___domain_id_0; } inline int32_t* get_address_of_domain_id_0() { return &___domain_id_0; } inline void set_domain_id_0(int32_t value) { ___domain_id_0 = value; } inline static int32_t get_offset_of_context_id_1() { return static_cast<int32_t>(offsetof(Context_t2330603731, ___context_id_1)); } inline int32_t get_context_id_1() const { return ___context_id_1; } inline int32_t* get_address_of_context_id_1() { return &___context_id_1; } inline void set_context_id_1(int32_t value) { ___context_id_1 = value; } inline static int32_t get_offset_of_static_data_2() { return static_cast<int32_t>(offsetof(Context_t2330603731, ___static_data_2)); } inline UIntPtr_t get_static_data_2() const { return ___static_data_2; } inline UIntPtr_t * get_address_of_static_data_2() { return &___static_data_2; } inline void set_static_data_2(UIntPtr_t value) { ___static_data_2 = value; } inline static int32_t get_offset_of_server_context_sink_chain_4() { return static_cast<int32_t>(offsetof(Context_t2330603731, ___server_context_sink_chain_4)); } inline RuntimeObject* get_server_context_sink_chain_4() const { return ___server_context_sink_chain_4; } inline RuntimeObject** get_address_of_server_context_sink_chain_4() { return &___server_context_sink_chain_4; } inline void set_server_context_sink_chain_4(RuntimeObject* value) { ___server_context_sink_chain_4 = value; Il2CppCodeGenWriteBarrier((&___server_context_sink_chain_4), value); } inline static int32_t get_offset_of_client_context_sink_chain_5() { return static_cast<int32_t>(offsetof(Context_t2330603731, ___client_context_sink_chain_5)); } inline RuntimeObject* get_client_context_sink_chain_5() const { return ___client_context_sink_chain_5; } inline RuntimeObject** get_address_of_client_context_sink_chain_5() { return &___client_context_sink_chain_5; } inline void set_client_context_sink_chain_5(RuntimeObject* value) { ___client_context_sink_chain_5 = value; Il2CppCodeGenWriteBarrier((&___client_context_sink_chain_5), value); } inline static int32_t get_offset_of_datastore_6() { return static_cast<int32_t>(offsetof(Context_t2330603731, ___datastore_6)); } inline ObjectU5BU5D_t769195566* get_datastore_6() const { return ___datastore_6; } inline ObjectU5BU5D_t769195566** get_address_of_datastore_6() { return &___datastore_6; } inline void set_datastore_6(ObjectU5BU5D_t769195566* value) { ___datastore_6 = value; Il2CppCodeGenWriteBarrier((&___datastore_6), value); } inline static int32_t get_offset_of_context_properties_7() { return static_cast<int32_t>(offsetof(Context_t2330603731, ___context_properties_7)); } inline ArrayList_t2438777478 * get_context_properties_7() const { return ___context_properties_7; } inline ArrayList_t2438777478 ** get_address_of_context_properties_7() { return &___context_properties_7; } inline void set_context_properties_7(ArrayList_t2438777478 * value) { ___context_properties_7 = value; Il2CppCodeGenWriteBarrier((&___context_properties_7), value); } inline static int32_t get_offset_of_frozen_8() { return static_cast<int32_t>(offsetof(Context_t2330603731, ___frozen_8)); } inline bool get_frozen_8() const { return ___frozen_8; } inline bool* get_address_of_frozen_8() { return &___frozen_8; } inline void set_frozen_8(bool value) { ___frozen_8 = value; } inline static int32_t get_offset_of_context_dynamic_properties_12() { return static_cast<int32_t>(offsetof(Context_t2330603731, ___context_dynamic_properties_12)); } inline DynamicPropertyCollection_t3079317807 * get_context_dynamic_properties_12() const { return ___context_dynamic_properties_12; } inline DynamicPropertyCollection_t3079317807 ** get_address_of_context_dynamic_properties_12() { return &___context_dynamic_properties_12; } inline void set_context_dynamic_properties_12(DynamicPropertyCollection_t3079317807 * value) { ___context_dynamic_properties_12 = value; Il2CppCodeGenWriteBarrier((&___context_dynamic_properties_12), value); } inline static int32_t get_offset_of_callback_object_13() { return static_cast<int32_t>(offsetof(Context_t2330603731, ___callback_object_13)); } inline ContextCallbackObject_t4236601005 * get_callback_object_13() const { return ___callback_object_13; } inline ContextCallbackObject_t4236601005 ** get_address_of_callback_object_13() { return &___callback_object_13; } inline void set_callback_object_13(ContextCallbackObject_t4236601005 * value) { ___callback_object_13 = value; Il2CppCodeGenWriteBarrier((&___callback_object_13), value); } }; struct Context_t2330603731_StaticFields { public: // System.Runtime.Remoting.Messaging.IMessageSink System.Runtime.Remoting.Contexts.Context::default_server_context_sink RuntimeObject* ___default_server_context_sink_3; // System.Int32 System.Runtime.Remoting.Contexts.Context::global_count int32_t ___global_count_9; // System.Collections.Hashtable System.Runtime.Remoting.Contexts.Context::namedSlots Hashtable_t2491480603 * ___namedSlots_10; // System.Runtime.Remoting.Contexts.DynamicPropertyCollection System.Runtime.Remoting.Contexts.Context::global_dynamic_properties DynamicPropertyCollection_t3079317807 * ___global_dynamic_properties_11; public: inline static int32_t get_offset_of_default_server_context_sink_3() { return static_cast<int32_t>(offsetof(Context_t2330603731_StaticFields, ___default_server_context_sink_3)); } inline RuntimeObject* get_default_server_context_sink_3() const { return ___default_server_context_sink_3; } inline RuntimeObject** get_address_of_default_server_context_sink_3() { return &___default_server_context_sink_3; } inline void set_default_server_context_sink_3(RuntimeObject* value) { ___default_server_context_sink_3 = value; Il2CppCodeGenWriteBarrier((&___default_server_context_sink_3), value); } inline static int32_t get_offset_of_global_count_9() { return static_cast<int32_t>(offsetof(Context_t2330603731_StaticFields, ___global_count_9)); } inline int32_t get_global_count_9() const { return ___global_count_9; } inline int32_t* get_address_of_global_count_9() { return &___global_count_9; } inline void set_global_count_9(int32_t value) { ___global_count_9 = value; } inline static int32_t get_offset_of_namedSlots_10() { return static_cast<int32_t>(offsetof(Context_t2330603731_StaticFields, ___namedSlots_10)); } inline Hashtable_t2491480603 * get_namedSlots_10() const { return ___namedSlots_10; } inline Hashtable_t2491480603 ** get_address_of_namedSlots_10() { return &___namedSlots_10; } inline void set_namedSlots_10(Hashtable_t2491480603 * value) { ___namedSlots_10 = value; Il2CppCodeGenWriteBarrier((&___namedSlots_10), value); } inline static int32_t get_offset_of_global_dynamic_properties_11() { return static_cast<int32_t>(offsetof(Context_t2330603731_StaticFields, ___global_dynamic_properties_11)); } inline DynamicPropertyCollection_t3079317807 * get_global_dynamic_properties_11() const { return ___global_dynamic_properties_11; } inline DynamicPropertyCollection_t3079317807 ** get_address_of_global_dynamic_properties_11() { return &___global_dynamic_properties_11; } inline void set_global_dynamic_properties_11(DynamicPropertyCollection_t3079317807 * value) { ___global_dynamic_properties_11 = value; Il2CppCodeGenWriteBarrier((&___global_dynamic_properties_11), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CONTEXT_T2330603731_H #ifndef URLATTRIBUTE_T4190378784_H #define URLATTRIBUTE_T4190378784_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.Remoting.Activation.UrlAttribute struct UrlAttribute_t4190378784 : public ContextAttribute_t2427099027 { public: // System.String System.Runtime.Remoting.Activation.UrlAttribute::url String_t* ___url_1; public: inline static int32_t get_offset_of_url_1() { return static_cast<int32_t>(offsetof(UrlAttribute_t4190378784, ___url_1)); } inline String_t* get_url_1() const { return ___url_1; } inline String_t** get_address_of_url_1() { return &___url_1; } inline void set_url_1(String_t* value) { ___url_1 = value; Il2CppCodeGenWriteBarrier((&___url_1), value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // URLATTRIBUTE_T4190378784_H #ifndef CLASSINTERFACEATTRIBUTE_T3789267740_H #define CLASSINTERFACEATTRIBUTE_T3789267740_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.ClassInterfaceAttribute struct ClassInterfaceAttribute_t3789267740 : public Attribute_t3079708014 { public: // System.Runtime.InteropServices.ClassInterfaceType System.Runtime.InteropServices.ClassInterfaceAttribute::ciType int32_t ___ciType_0; public: inline static int32_t get_offset_of_ciType_0() { return static_cast<int32_t>(offsetof(ClassInterfaceAttribute_t3789267740, ___ciType_0)); } inline int32_t get_ciType_0() const { return ___ciType_0; } inline int32_t* get_address_of_ciType_0() { return &___ciType_0; } inline void set_ciType_0(int32_t value) { ___ciType_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // CLASSINTERFACEATTRIBUTE_T3789267740_H #ifndef INTERFACETYPEATTRIBUTE_T525722447_H #define INTERFACETYPEATTRIBUTE_T525722447_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.InterfaceTypeAttribute struct InterfaceTypeAttribute_t525722447 : public Attribute_t3079708014 { public: // System.Runtime.InteropServices.ComInterfaceType System.Runtime.InteropServices.InterfaceTypeAttribute::intType int32_t ___intType_0; public: inline static int32_t get_offset_of_intType_0() { return static_cast<int32_t>(offsetof(InterfaceTypeAttribute_t525722447, ___intType_0)); } inline int32_t get_intType_0() const { return ___intType_0; } inline int32_t* get_address_of_intType_0() { return &___intType_0; } inline void set_intType_0(int32_t value) { ___intType_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // INTERFACETYPEATTRIBUTE_T525722447_H #ifndef COMEXCEPTION_T1552067361_H #define COMEXCEPTION_T1552067361_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.COMException struct COMException_t1552067361 : public ExternalException_t2731287062 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // COMEXCEPTION_T1552067361_H #ifndef RELIABILITYCONTRACTATTRIBUTE_T294746602_H #define RELIABILITYCONTRACTATTRIBUTE_T294746602_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.ConstrainedExecution.ReliabilityContractAttribute struct ReliabilityContractAttribute_t294746602 : public Attribute_t3079708014 { public: // System.Runtime.ConstrainedExecution.Consistency System.Runtime.ConstrainedExecution.ReliabilityContractAttribute::consistency int32_t ___consistency_0; // System.Runtime.ConstrainedExecution.Cer System.Runtime.ConstrainedExecution.ReliabilityContractAttribute::cer int32_t ___cer_1; public: inline static int32_t get_offset_of_consistency_0() { return static_cast<int32_t>(offsetof(ReliabilityContractAttribute_t294746602, ___consistency_0)); } inline int32_t get_consistency_0() const { return ___consistency_0; } inline int32_t* get_address_of_consistency_0() { return &___consistency_0; } inline void set_consistency_0(int32_t value) { ___consistency_0 = value; } inline static int32_t get_offset_of_cer_1() { return static_cast<int32_t>(offsetof(ReliabilityContractAttribute_t294746602, ___cer_1)); } inline int32_t get_cer_1() const { return ___cer_1; } inline int32_t* get_address_of_cer_1() { return &___cer_1; } inline void set_cer_1(int32_t value) { ___cer_1 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // RELIABILITYCONTRACTATTRIBUTE_T294746602_H #ifndef UNMANAGEDFUNCTIONPOINTERATTRIBUTE_T3342047714_H #define UNMANAGEDFUNCTIONPOINTERATTRIBUTE_T3342047714_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute struct UnmanagedFunctionPointerAttribute_t3342047714 : public Attribute_t3079708014 { public: // System.Runtime.InteropServices.CallingConvention System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute::call_conv int32_t ___call_conv_0; public: inline static int32_t get_offset_of_call_conv_0() { return static_cast<int32_t>(offsetof(UnmanagedFunctionPointerAttribute_t3342047714, ___call_conv_0)); } inline int32_t get_call_conv_0() const { return ___call_conv_0; } inline int32_t* get_address_of_call_conv_0() { return &___call_conv_0; } inline void set_call_conv_0(int32_t value) { ___call_conv_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // UNMANAGEDFUNCTIONPOINTERATTRIBUTE_T3342047714_H #ifndef DEFAULTDEPENDENCYATTRIBUTE_T1184161752_H #define DEFAULTDEPENDENCYATTRIBUTE_T1184161752_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Runtime.CompilerServices.DefaultDependencyAttribute struct DefaultDependencyAttribute_t1184161752 : public Attribute_t3079708014 { public: // System.Runtime.CompilerServices.LoadHint System.Runtime.CompilerServices.DefaultDependencyAttribute::hint int32_t ___hint_0; public: inline static int32_t get_offset_of_hint_0() { return static_cast<int32_t>(offsetof(DefaultDependencyAttribute_t1184161752, ___hint_0)); } inline int32_t get_hint_0() const { return ___hint_0; } inline int32_t* get_address_of_hint_0() { return &___hint_0; } inline void set_hint_0(int32_t value) { ___hint_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif #endif // DEFAULTDEPENDENCYATTRIBUTE_T1184161752_H #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize400 = { sizeof (DefaultDependencyAttribute_t1184161752), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable400[1] = { DefaultDependencyAttribute_t1184161752::get_offset_of_hint_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize401 = { sizeof (IsVolatile_t2833933470), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize402 = { sizeof (LoadHint_t3195656583)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable402[4] = { LoadHint_t3195656583::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize403 = { sizeof (StringFreezingAttribute_t156983079), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize404 = { sizeof (Cer_t492585041)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable404[4] = { Cer_t492585041::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize405 = { sizeof (Consistency_t1542326778)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable405[5] = { Consistency_t1542326778::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize406 = { sizeof (CriticalFinalizerObject_t2986371778), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize407 = { sizeof (ReliabilityContractAttribute_t294746602), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable407[2] = { ReliabilityContractAttribute_t294746602::get_offset_of_consistency_0(), ReliabilityContractAttribute_t294746602::get_offset_of_cer_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize408 = { sizeof (ActivationArguments_t2207697357), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize409 = { sizeof (COMException_t1552067361), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize410 = { sizeof (CallingConvention_t1014109383)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable410[6] = { CallingConvention_t1014109383::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize411 = { sizeof (CharSet_t2018390796)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable411[5] = { CharSet_t2018390796::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize412 = { sizeof (ClassInterfaceAttribute_t3789267740), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable412[1] = { ClassInterfaceAttribute_t3789267740::get_offset_of_ciType_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize413 = { sizeof (ClassInterfaceType_t2994377095)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable413[4] = { ClassInterfaceType_t2994377095::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize414 = { sizeof (ComCompatibleVersionAttribute_t3291056560), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable414[4] = { ComCompatibleVersionAttribute_t3291056560::get_offset_of_major_0(), ComCompatibleVersionAttribute_t3291056560::get_offset_of_minor_1(), ComCompatibleVersionAttribute_t3291056560::get_offset_of_build_2(), ComCompatibleVersionAttribute_t3291056560::get_offset_of_revision_3(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize415 = { sizeof (ComDefaultInterfaceAttribute_t1827578934), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable415[1] = { ComDefaultInterfaceAttribute_t1827578934::get_offset_of__type_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize416 = { sizeof (ComInterfaceType_t3828477597)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable416[4] = { ComInterfaceType_t3828477597::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize417 = { sizeof (DispIdAttribute_t2048450649), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable417[1] = { DispIdAttribute_t2048450649::get_offset_of_id_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize418 = { sizeof (ErrorWrapper_t673454179), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable418[1] = { ErrorWrapper_t673454179::get_offset_of_errorCode_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize419 = { sizeof (ExternalException_t2731287062), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize420 = { sizeof (GCHandle_t2835010403)+ sizeof (RuntimeObject), sizeof(GCHandle_t2835010403 ), 0, 0 }; extern const int32_t g_FieldOffsetTable420[1] = { GCHandle_t2835010403::get_offset_of_handle_0() + static_cast<int32_t>(sizeof(RuntimeObject)), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize421 = { sizeof (GCHandleType_t2285338652)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable421[5] = { GCHandleType_t2285338652::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize422 = { sizeof (InterfaceTypeAttribute_t525722447), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable422[1] = { InterfaceTypeAttribute_t525722447::get_offset_of_intType_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize423 = { sizeof (Marshal_t1877682222), -1, sizeof(Marshal_t1877682222_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable423[2] = { Marshal_t1877682222_StaticFields::get_offset_of_SystemMaxDBCSCharSize_0(), Marshal_t1877682222_StaticFields::get_offset_of_SystemDefaultCharSize_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize424 = { sizeof (MarshalDirectiveException_t1726941138), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable424[1] = { 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize425 = { sizeof (PreserveSigAttribute_t1970273383), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize426 = { sizeof (SafeHandle_t1168232028), sizeof(void*), 0, 0 }; extern const int32_t g_FieldOffsetTable426[4] = { SafeHandle_t1168232028::get_offset_of_handle_0(), SafeHandle_t1168232028::get_offset_of_invalid_handle_value_1(), SafeHandle_t1168232028::get_offset_of_refcount_2(), SafeHandle_t1168232028::get_offset_of_owns_handle_3(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize427 = { sizeof (TypeLibImportClassAttribute_t3102149076), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable427[1] = { TypeLibImportClassAttribute_t3102149076::get_offset_of__importClass_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize428 = { sizeof (TypeLibVersionAttribute_t2491756700), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable428[2] = { TypeLibVersionAttribute_t2491756700::get_offset_of_major_0(), TypeLibVersionAttribute_t2491756700::get_offset_of_minor_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize429 = { sizeof (UnmanagedFunctionPointerAttribute_t3342047714), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable429[1] = { UnmanagedFunctionPointerAttribute_t3342047714::get_offset_of_call_conv_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize430 = { sizeof (UnmanagedType_t1898932253)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 }; extern const int32_t g_FieldOffsetTable430[36] = { UnmanagedType_t1898932253::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize431 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize432 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize433 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize434 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize435 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize436 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize437 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize438 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize439 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize440 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize441 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize442 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize443 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize444 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize445 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize446 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize447 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize448 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize449 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize450 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize451 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize452 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize453 = { sizeof (ActivationServices_t2214633935), -1, sizeof(ActivationServices_t2214633935_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable453[1] = { ActivationServices_t2214633935_StaticFields::get_offset_of__constructionActivator_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize454 = { sizeof (AppDomainLevelActivator_t2561784236), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable454[2] = { AppDomainLevelActivator_t2561784236::get_offset_of__activationUrl_0(), AppDomainLevelActivator_t2561784236::get_offset_of__next_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize455 = { sizeof (ConstructionLevelActivator_t1090983229), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize456 = { sizeof (ContextLevelActivator_t3826340110), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable456[1] = { ContextLevelActivator_t3826340110::get_offset_of_m_NextActivator_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize457 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize458 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize459 = { sizeof (RemoteActivator_t211973416), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize460 = { sizeof (UrlAttribute_t4190378784), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable460[1] = { UrlAttribute_t4190378784::get_offset_of_url_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize461 = { sizeof (ChannelInfo_t1189328240), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable461[1] = { ChannelInfo_t1189328240::get_offset_of_channelData_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize462 = { sizeof (ChannelServices_t3115903791), -1, sizeof(ChannelServices_t3115903791_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable462[5] = { ChannelServices_t3115903791_StaticFields::get_offset_of_registeredChannels_0(), ChannelServices_t3115903791_StaticFields::get_offset_of_delayedClientChannels_1(), ChannelServices_t3115903791_StaticFields::get_offset_of__crossContextSink_2(), ChannelServices_t3115903791_StaticFields::get_offset_of_CrossContextUrl_3(), ChannelServices_t3115903791_StaticFields::get_offset_of_oldStartModeTypes_4(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize463 = { sizeof (CrossAppDomainData_t574484588), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable463[3] = { CrossAppDomainData_t574484588::get_offset_of__ContextID_0(), CrossAppDomainData_t574484588::get_offset_of__DomainID_1(), CrossAppDomainData_t574484588::get_offset_of__processGuid_2(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize464 = { sizeof (CrossAppDomainChannel_t426527630), -1, sizeof(CrossAppDomainChannel_t426527630_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable464[1] = { CrossAppDomainChannel_t426527630_StaticFields::get_offset_of_s_lock_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize465 = { sizeof (CrossAppDomainSink_t407920545), -1, sizeof(CrossAppDomainSink_t407920545_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable465[3] = { CrossAppDomainSink_t407920545_StaticFields::get_offset_of_s_sinks_0(), CrossAppDomainSink_t407920545_StaticFields::get_offset_of_processMessageMethod_1(), CrossAppDomainSink_t407920545::get_offset_of__domainID_2(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize466 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize467 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize468 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize469 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize470 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize471 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize472 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize473 = { sizeof (SinkProviderData_t3487717147), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable473[3] = { SinkProviderData_t3487717147::get_offset_of_sinkName_0(), SinkProviderData_t3487717147::get_offset_of_children_1(), SinkProviderData_t3487717147::get_offset_of_properties_2(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize474 = { sizeof (Context_t2330603731), -1, sizeof(Context_t2330603731_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable474[14] = { Context_t2330603731::get_offset_of_domain_id_0(), Context_t2330603731::get_offset_of_context_id_1(), Context_t2330603731::get_offset_of_static_data_2(), Context_t2330603731_StaticFields::get_offset_of_default_server_context_sink_3(), Context_t2330603731::get_offset_of_server_context_sink_chain_4(), Context_t2330603731::get_offset_of_client_context_sink_chain_5(), Context_t2330603731::get_offset_of_datastore_6(), Context_t2330603731::get_offset_of_context_properties_7(), Context_t2330603731::get_offset_of_frozen_8(), Context_t2330603731_StaticFields::get_offset_of_global_count_9(), Context_t2330603731_StaticFields::get_offset_of_namedSlots_10(), Context_t2330603731_StaticFields::get_offset_of_global_dynamic_properties_11(), Context_t2330603731::get_offset_of_context_dynamic_properties_12(), Context_t2330603731::get_offset_of_callback_object_13(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize475 = { sizeof (DynamicPropertyCollection_t3079317807), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable475[1] = { DynamicPropertyCollection_t3079317807::get_offset_of__properties_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize476 = { sizeof (DynamicPropertyReg_t2204871467), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable476[2] = { DynamicPropertyReg_t2204871467::get_offset_of_Property_0(), DynamicPropertyReg_t2204871467::get_offset_of_Sink_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize477 = { sizeof (ContextCallbackObject_t4236601005), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize478 = { sizeof (ContextAttribute_t2427099027), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable478[1] = { ContextAttribute_t2427099027::get_offset_of_AttributeName_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize479 = { sizeof (CrossContextChannel_t3170213951), -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize480 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize481 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize482 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize483 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize484 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize485 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize486 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize487 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize488 = { 0, -1, 0, 0 }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize489 = { sizeof (SynchronizationAttribute_t411119687), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable489[5] = { SynchronizationAttribute_t411119687::get_offset_of__bReEntrant_1(), SynchronizationAttribute_t411119687::get_offset_of__flavor_2(), SynchronizationAttribute_t411119687::get_offset_of__lockCount_3(), SynchronizationAttribute_t411119687::get_offset_of__mutex_4(), SynchronizationAttribute_t411119687::get_offset_of__ownerThread_5(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize490 = { sizeof (SynchronizedClientContextSink_t1571413438), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable490[2] = { SynchronizedClientContextSink_t1571413438::get_offset_of__next_0(), SynchronizedClientContextSink_t1571413438::get_offset_of__att_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize491 = { sizeof (SynchronizedServerContextSink_t3945465521), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable491[2] = { SynchronizedServerContextSink_t3945465521::get_offset_of__next_0(), SynchronizedServerContextSink_t3945465521::get_offset_of__att_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize492 = { sizeof (LeaseManager_t1090072238), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable492[2] = { LeaseManager_t1090072238::get_offset_of__objects_0(), LeaseManager_t1090072238::get_offset_of__timer_1(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize493 = { sizeof (LeaseSink_t3634806523), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable493[1] = { LeaseSink_t3634806523::get_offset_of__nextSink_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize494 = { sizeof (LifetimeServices_t1712433763), -1, sizeof(LifetimeServices_t1712433763_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable494[5] = { LifetimeServices_t1712433763_StaticFields::get_offset_of__leaseManagerPollTime_0(), LifetimeServices_t1712433763_StaticFields::get_offset_of__leaseTime_1(), LifetimeServices_t1712433763_StaticFields::get_offset_of__renewOnCallTime_2(), LifetimeServices_t1712433763_StaticFields::get_offset_of__sponsorshipTimeout_3(), LifetimeServices_t1712433763_StaticFields::get_offset_of__leaseManager_4(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize495 = { sizeof (ArgInfoType_t687995025)+ sizeof (RuntimeObject), sizeof(uint8_t), 0, 0 }; extern const int32_t g_FieldOffsetTable495[3] = { ArgInfoType_t687995025::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)), 0, 0, }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize496 = { sizeof (ArgInfo_t4039207888), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable496[3] = { ArgInfo_t4039207888::get_offset_of__paramMap_0(), ArgInfo_t4039207888::get_offset_of__inoutArgCount_1(), ArgInfo_t4039207888::get_offset_of__method_2(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize497 = { sizeof (AsyncResult_t3008645073), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable497[15] = { AsyncResult_t3008645073::get_offset_of_async_state_0(), AsyncResult_t3008645073::get_offset_of_handle_1(), AsyncResult_t3008645073::get_offset_of_async_delegate_2(), AsyncResult_t3008645073::get_offset_of_data_3(), AsyncResult_t3008645073::get_offset_of_object_data_4(), AsyncResult_t3008645073::get_offset_of_sync_completed_5(), AsyncResult_t3008645073::get_offset_of_completed_6(), AsyncResult_t3008645073::get_offset_of_endinvoke_called_7(), AsyncResult_t3008645073::get_offset_of_async_callback_8(), AsyncResult_t3008645073::get_offset_of_current_9(), AsyncResult_t3008645073::get_offset_of_original_10(), AsyncResult_t3008645073::get_offset_of_gchandle_11(), AsyncResult_t3008645073::get_offset_of_call_message_12(), AsyncResult_t3008645073::get_offset_of_message_ctrl_13(), AsyncResult_t3008645073::get_offset_of_reply_message_14(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize498 = { sizeof (ClientContextTerminatorSink_t1720067768), -1, 0, 0 }; extern const int32_t g_FieldOffsetTable498[1] = { ClientContextTerminatorSink_t1720067768::get_offset_of__context_0(), }; extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize499 = { sizeof (ConstructionCall_t2325625229), -1, sizeof(ConstructionCall_t2325625229_StaticFields), 0 }; extern const int32_t g_FieldOffsetTable499[7] = { ConstructionCall_t2325625229::get_offset_of__activator_11(), ConstructionCall_t2325625229::get_offset_of__activationAttributes_12(), ConstructionCall_t2325625229::get_offset_of__contextProperties_13(), ConstructionCall_t2325625229::get_offset_of__activationType_14(), ConstructionCall_t2325625229::get_offset_of__activationTypeName_15(), ConstructionCall_t2325625229::get_offset_of__isContextOk_16(), ConstructionCall_t2325625229_StaticFields::get_offset_of_U3CU3Ef__switchU24map20_17(), }; #ifdef __clang__ #pragma clang diagnostic pop #endif
[ "star_xlliu@vipabc.com" ]
star_xlliu@vipabc.com
8316446dab5bd25832fe3efcb410906d41f72ecc
62bf789f19f500aa5aa20f6911573cc0c59902c7
/cloudapi/include/alibabacloud/cloudapi/model/ModifyIpControlPolicyItemRequest.h
9997d1968a950121dc3f2fbc49a00fe70684d019
[ "Apache-2.0" ]
permissive
liuyuhua1984/aliyun-openapi-cpp-sdk
0288f0241812e4308975a62a23fdef2403cfd13a
600883d23a243eb204e39f15505f1f976df57929
refs/heads/master
2020-07-04T09:47:49.901987
2019-08-13T14:13:11
2019-08-13T14:13:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,074
h
/* * Copyright 2009-2017 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ALIBABACLOUD_CLOUDAPI_MODEL_MODIFYIPCONTROLPOLICYITEMREQUEST_H_ #define ALIBABACLOUD_CLOUDAPI_MODEL_MODIFYIPCONTROLPOLICYITEMREQUEST_H_ #include <string> #include <vector> #include <alibabacloud/core/RpcServiceRequest.h> #include <alibabacloud/cloudapi/CloudAPIExport.h> namespace AlibabaCloud { namespace CloudAPI { namespace Model { class ALIBABACLOUD_CLOUDAPI_EXPORT ModifyIpControlPolicyItemRequest : public RpcServiceRequest { public: ModifyIpControlPolicyItemRequest(); ~ModifyIpControlPolicyItemRequest(); std::string getIpControlId()const; void setIpControlId(const std::string& ipControlId); std::string getPolicyItemId()const; void setPolicyItemId(const std::string& policyItemId); std::string getSecurityToken()const; void setSecurityToken(const std::string& securityToken); std::string getAppId()const; void setAppId(const std::string& appId); std::string getCidrIp()const; void setCidrIp(const std::string& cidrIp); std::string getAccessKeyId()const; void setAccessKeyId(const std::string& accessKeyId); private: std::string ipControlId_; std::string policyItemId_; std::string securityToken_; std::string appId_; std::string cidrIp_; std::string accessKeyId_; }; } } } #endif // !ALIBABACLOUD_CLOUDAPI_MODEL_MODIFYIPCONTROLPOLICYITEMREQUEST_H_
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
f87e03cf5f43709f7dda885da4f5897eab5461f6
f8c3775282e0fdee3ac0f1dc4a30c2f721d0a29a
/Autonomous_Vehicles_and_Computer_Vision/detect_objects/src/detect_objects_2.cpp
77691155f891d7580d585d909359e333706be6b7
[]
no_license
grandmasterb80/udacity
d6ca230cddd2f1ae2ba5078468814165d02037df
1162414eb3f3dbbf44635d326af38599fb8f9138
refs/heads/main
2022-12-19T18:04:04.673126
2020-10-08T22:36:12
2020-10-08T22:36:12
301,097,462
0
0
null
null
null
null
UTF-8
C++
false
false
8,000
cpp
#include <iostream> #include <numeric> #include <fstream> #include <opencv2/core.hpp> #include <opencv2/highgui.hpp> #include <opencv2/imgproc.hpp> #include <opencv2/dnn.hpp> #include "dataStructures.h" using namespace std; /* * 1. Right out of the box on some pictures taken during vacation, the network delivers extrem good results. Traffic lights, trains, buses, dogs, people, * cars have been quite reliably detected (even if confidence level was low for some cases). I noted that smaller objects, especially tall ones seem * to be detected more often as "person". * 2. The blopsize must be a multiple of 32. * The classification result depends on the blob size. A dog that played in the water was detected fine with the default settings (although the image * showed only his back). With a smaller (also with a larger) blop size, the network deteced a boat. * For the example image from the course, the result also depends on the blop size. If the person was detected, the classification was correct, but it * could happen that the person or the car on the board were not detected at all (for blop size 64x64). Increase the blop size by the smallest increment * (which is 32), reduced the confidence on the board. * 3. A lower threshold for confidence will determine how many objects are considered at all for further tests. Lower threshold means more classifications / "boxes2 * are going to be considered for further proceesing which can be a lot in real traffic. * */ void detectObjects2(const string &filename_image) { // load image from file // cv::Mat imgSrc = cv::imread( filename_image ); // cv::Mat img; // resize(imgSrc, img, cv::Size(), 0.25, 0.25, cv::INTER_CUBIC); cv::Mat img = cv::imread( filename_image ); // load class names from file string yoloBasePath = "../dat/yolo/"; string yoloClassesFile = yoloBasePath + "coco.names"; string yoloModelConfiguration = yoloBasePath + "yolov3.cfg"; string yoloModelWeights = yoloBasePath + "yolov3.weights"; vector<string> classes; ifstream ifs(yoloClassesFile.c_str()); string line; if( !ifs.is_open() ) { cerr << "ERROR: " << __FILE__ << ", " << __LINE__ << " in function " << __FUNCTION__ << " could not open file" << endl; return; } while (getline(ifs, line)) classes.push_back(line); // load neural network cv::dnn::Net net = cv::dnn::readNetFromDarknet(yoloModelConfiguration, yoloModelWeights); net.setPreferableBackend(cv::dnn::DNN_BACKEND_OPENCV); net.setPreferableTarget(cv::dnn::DNN_TARGET_CPU); // net.setPreferableTarget(cv::dnn::DNN_TARGET_OPENCL); double t = (double)cv::getTickCount(); // generate 4D blob from input image cv::Mat blob; double scalefactor = 1/255.0; cv::Size size = cv::Size(416, 416); // cv::Size size = cv::Size(416, 416); cv::Scalar mean = cv::Scalar(0,0,0); bool swapRB = false; bool crop = false; cv::dnn::blobFromImage(img, blob, scalefactor, size, mean, swapRB, crop); t = ((double)cv::getTickCount() - t) / cv::getTickFrequency(); cout << "BENCHMARK: blobFromImage in " << 1000 * t / 1.0 << " ms" << endl; t = (double)cv::getTickCount(); // Get names of output layers vector<cv::String> names; vector<int> outLayers = net.getUnconnectedOutLayers(); // get indices of output layers, i.e. layers with unconnected outputs vector<cv::String> layersNames = net.getLayerNames(); // get names of all layers in the network names.resize(outLayers.size()); for (size_t i = 0; i < outLayers.size(); ++i) // Get the names of the output layers in names { names[i] = layersNames[outLayers[i] - 1]; } // invoke forward propagation through network vector<cv::Mat> netOutput; net.setInput(blob); net.forward(netOutput, names); // Scan through all bounding boxes and keep only the ones with high confidence float confThreshold = 0.2; vector<int> classIds; vector<float> confidences; vector<cv::Rect> boxes; for (size_t i = 0; i < netOutput.size(); ++i) { float* data = (float*)netOutput[i].data; for (int j = 0; j < netOutput[i].rows; ++j, data += netOutput[i].cols) { cv::Mat scores = netOutput[i].row(j).colRange(5, netOutput[i].cols); cv::Point classId; double confidence; // Get the value and location of the maximum score cv::minMaxLoc(scores, 0, &confidence, 0, &classId); if (confidence > confThreshold) { cv::Rect box; int cx, cy; cx = (int)(data[0] * img.cols); cy = (int)(data[1] * img.rows); box.width = (int)(data[2] * img.cols); box.height = (int)(data[3] * img.rows); box.x = cx - box.width/2; // left box.y = cy - box.height/2; // top boxes.push_back(box); classIds.push_back(classId.x); confidences.push_back((float)confidence); } } } t = ((double)cv::getTickCount() - t) / cv::getTickFrequency(); cout << "BENCHMARK: detected " << netOutput.size() << " potential objects in " << 1000 * t / 1.0 << " ms" << endl; t = (double)cv::getTickCount(); // perform non-maxima suppression float nmsThreshold = 0.5; // Non-maximum suppression threshold vector<int> indices; cv::dnn::NMSBoxes(boxes, confidences, confThreshold, nmsThreshold, indices); std::vector<BoundingBox> bBoxes; for (auto it = indices.begin(); it != indices.end(); ++it) { BoundingBox bBox; bBox.roi = boxes[*it]; bBox.classID = classIds[*it]; bBox.confidence = confidences[*it]; bBox.boxID = (int)bBoxes.size(); // zero-based unique identifier for this bounding box bBoxes.push_back(bBox); } t = ((double)cv::getTickCount() - t) / cv::getTickFrequency(); cout << "BENCHMARK: classification of " << indices.size() << " objects in " << 1000 * t / 1.0 << " ms" << endl; // show results cv::Mat visImg = img.clone(); for (auto it = bBoxes.begin(); it != bBoxes.end(); ++it) { // Draw rectangle displaying the bounding box int top, left, width, height; top = (*it).roi.y; left = (*it).roi.x; width = (*it).roi.width; height = (*it).roi.height; cv::rectangle(visImg, cv::Point(left, top), cv::Point(left + width, top + height), cv::Scalar(0, 255, 0), 2); string label = cv::format("%.2f", (*it).confidence); label = classes[((*it).classID)] + ":" + label; // Display label at the top of the bounding box int baseLine; cv::Size labelSize = getTextSize(label, cv::FONT_ITALIC, 0.5, 1, &baseLine); top = max(top, labelSize.height); rectangle(visImg, cv::Point(left, top - round(1.5 * labelSize.height)), cv::Point(left + round(1.5 * labelSize.width), top + baseLine), cv::Scalar(255, 255, 255), cv::FILLED); cv::putText(visImg, label, cv::Point(left, top), cv::FONT_ITALIC, 0.75, cv::Scalar(0, 0, 0), 1); } string windowName = "Object classification"; cv::namedWindow( windowName, 1 ); cv::imshow( windowName, visImg ); cv::waitKey(0); // wait for key to be pressed } int main(int argn, char** argv) { string filename; if( argn >= 2 ) { filename = argv[1]; } else { filename = "../images/s_thrun.jpg"; // filename = "/mnt/windows_BilderBackup/Bilder_Filme/2012 Liverpool/_MG_4075.JPG"; // filename = "/mnt/windows_BilderBackup/Bilder_Filme/2012 Liverpool/_MG_4118.JPG"; // filename = "/mnt/windows_BilderBackup/Bilder_Filme/2012 Liverpool/_MG_4119.JPG"; // filename = "/mnt/windows_BilderBackup/Bilder_Filme/2012 Liverpool/_MG_4120.JPG"; } detectObjects2( filename ); }
[ "daniel.baudisch@web.de" ]
daniel.baudisch@web.de
f7349a56524004c292413a1dcb17ee66d54e6545
5252069494bb711012fc4bd9c11804cf668e5678
/Source/Shaders/ParticleShader.hpp
ad118edde4dc5c1c62a39b39a9af750903441a58
[]
no_license
NoSilentWonder/Seasons
5cea5251ac8e1fe2a362a9a4a8f1bb9a2cd57e68
374febb8008220a5b0d0b9cff6b914680ecae246
refs/heads/master
2021-01-19T16:34:26.174472
2012-12-07T23:03:11
2012-12-07T23:03:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,397
hpp
/* Created Elinor Townsend 2011 */ /* Name Particle Shader Brief Definition of Particle Shader Class inherited from Shader */ #ifndef _PARTICLE_SHADER_H #define _PARTICLE_SHADER_H #include "Shaders/Shader.hpp" struct LightSimple; enum Particle; class ParticleShader : public Shader { public: bool initialise(); bool initialise(Particle particle); void deinitialise(); void setupRender(float sceneTime, float timeStep, D3DXVECTOR4* eyePosW, D3DXVECTOR4* emitPosW, D3DXVECTOR4* emitDirW, ID3D10ShaderResourceView* texArrayRV, ID3D10ShaderResourceView* randomTexRV); void setStreamOutTech(D3D10_TECHNIQUE_DESC* techDesc); void setDrawTech(D3D10_TECHNIQUE_DESC* techDesc); void applyStreamOutPass(UINT pass); void applyDrawPass(UINT pass); ID3D10InputLayout * getLayout() const { return vertexLayout_; }; private: bool createEffectFile(Particle particle); bool buildVertexLayout(); ID3D10EffectTechnique* streamOutTech_; ID3D10EffectTechnique* drawTech_; ID3D10EffectMatrixVariable* viewProjVar_; ID3D10EffectScalarVariable* sceneTimeVar_; ID3D10EffectScalarVariable* timeStepVar_; ID3D10EffectVectorVariable* eyePosVar_; ID3D10EffectVectorVariable* emitPosVar_; ID3D10EffectVectorVariable* emitDirVar_; ID3D10EffectShaderResourceVariable* texArrayVar_; ID3D10EffectShaderResourceVariable* randomTexVar_; }; #endif // _PARTICLE_SHADER_H
[ "elinor.townsend@gmail.com" ]
elinor.townsend@gmail.com
f05969fdada737851718a0cf58207f89dee59edc
98b6c7cedf3ab2b09f16b854b70741475e07ab64
/www.cplusplus.com-20180131/reference/locale/locale/name/name.cpp
460d0fd51fc194309ca6f197699fc72698ca06d6
[]
no_license
yull2310/book-code
71ef42766acb81dde89ce4ae4eb13d1d61b20c65
86a3e5bddbc845f33c5f163c44e74966b8bfdde6
refs/heads/master
2023-03-17T16:35:40.741611
2019-03-05T08:38:51
2019-03-05T08:38:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
242
cpp
// locale::name example #include <iostream> // std::cout #include <locale> // std::locale int main () { std::locale loc; // global locale std::cout << "The global locale is: " << loc.name() << '\n'; return 0; }
[ "zhongtao.chen@yourun.com" ]
zhongtao.chen@yourun.com
26469a08b7713b9602ec4ae7bbba387b0c67d2e2
74ea726156e2c8229eb313bb299ef1fa523f4402
/Minimal/Cube.h
7a5bcae6422c5c4517c8bd9305ea638ce40fe681
[]
no_license
oolugboy/MinimalVR-master
a065b0997e774178ca41588c3b739e3a58c1d4a8
132d15ad3af05ade4bb74eae6d1c921305546a02
refs/heads/master
2021-06-17T02:56:59.911935
2017-05-02T05:05:12
2017-05-02T05:05:12
88,382,978
0
0
null
null
null
null
UTF-8
C++
false
false
2,542
h
#pragma once #define GLFW_INCLUDE_GLEXT #include <GL/glew.h> // Use of degrees is deprecated. Use radians instead. #ifndef GLM_FORCE_RADIANS #define GLM_FORCE_RADIANS #endif #include <glm/mat4x4.hpp> #include <glm/gtc/matrix_transform.hpp> #include "Geode.h" class Cube : public Geode { public: Cube(bool wired); ~Cube(); void setToWorld(glm::mat4 toWorld); void draw(GLuint shaderProgram, glm::mat4 projection, glm::mat4 modelView); void update(); void spin(float); void scaleBoundaries(); void factorSphereCollision(glm::vec3 pos, float radius, glm::vec3 & velocity); float xMax, xMin, yMax, yMin, zMax, zMin; void loadTextures(const char * fileName); }; // Define the coordinates and indices needed to draw the cube. Note that it is not necessary // to use a 2-dimensional array, since the layout in memory is the same as a 1-dimensional array. // This just looks nicer since it's easy to tell what coordinates/indices belong where. const GLfloat vertices[24][3] = { // "Front" face { -1.0, -1.0, 1.0 },{ 1.0, -1.0, 1.0 },{ 1.0, 1.0, 1.0 },{ -1.0, 1.0, 1.0 }, // "Right" face { 1.0, -1.0, 1.0 },{ 1.0, -1.0, -1.0 },{ 1.0, 1.0, -1.0 },{ 1.0, 1.0, 1.0 }, // "Back" vertices {-1.0, -1.0, -1.0 },{ 1.0, -1.0, -1.0 },{ 1.0, 1.0, -1.0 },{ -1.0, 1.0, -1.0 }, // "left" face {-1.0, -1.0, 1.0},{-1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, 1.0, 1.0}, // "Bottom" face {-1.0, -1.0, 1.0},{1.0, -1.0, 1.0},{1.0, -1.0, -1.0},{-1.0, -1.0, -1.0}, //" top face {-1.0, 1.0, 1.0},{1.0, 1.0, 1.0}, {1.0, 1.0, -1.0}, {-1.0, 1.0, -1.0} }; const GLfloat texCoords[24][2] = { // " Front face" texCoords { 0.0, 1.0 },{ 1.0, 1.0 },{ 1.0, 0.0 },{ 0.0, 0.0 }, // " Right face" texCoords { 0.0, 1.0 },{ 1.0, 1.0 },{ 1.0, 0.0 },{ 0.0, 0.0 }, // " Back face" texCoords { 1.0, 1.0 },{ 1.0, 0.0 },{ 0.0, 0.0 },{ 0.0, 1.0 }, // " left face texCoords { 1.0, 1.0 },{ 1.0, 0.0 },{ 0.0, 0.0 },{ 0.0, 1.0 }, // " The bottom face texCoords { 0.0, 0.0 },{ 0.0, 1.0 },{ 1.0, 1.0 },{ 1.0, 0.0 }, // " Top face texCoords " { 0.0, 1.0 },{ 1.0, 1.0 },{ 1.0, 0.0 },{ 0.0, 0.0 } }; // Note that GL_QUADS is deprecated in modern OpenGL (and removed from OSX systems). // This is why we need to draw each face as 2 triangles instead of 1 quadrilateral const GLuint indices[6][6] = { // Front face { 0, 1, 2, 2, 3, 0 }, // Right face { 4, 5, 6, 6, 7, 4 }, // Back face { 8, 9, 10, 10, 11, 8 }, // left face { 12, 13, 14, 14, 15, 12 }, // Bottom face { 16, 17, 18, 18, 19, 16 }, // Top face { 20, 21, 22, 22, 23, 20 } };
[ "oolugboy@ITS-CSEB210-22" ]
oolugboy@ITS-CSEB210-22
05a2696757698dae22325a0a8f2fdc4009511b14
d0c44dd3da2ef8c0ff835982a437946cbf4d2940
/cmake-build-debug/programs_tiling/function14299/function14299_schedule_17/function14299_schedule_17.cpp
855fcb2327de6a3463c0cfd24e7b6f95ca8bf36f
[]
no_license
IsraMekki/tiramisu_code_generator
8b3f1d63cff62ba9f5242c019058d5a3119184a3
5a259d8e244af452e5301126683fa4320c2047a3
refs/heads/master
2020-04-29T17:27:57.987172
2019-04-23T16:50:32
2019-04-23T16:50:32
176,297,755
1
2
null
null
null
null
UTF-8
C++
false
false
825
cpp
#include <tiramisu/tiramisu.h> using namespace tiramisu; int main(int argc, char **argv){ tiramisu::init("function14299_schedule_17"); constant c0("c0", 256), c1("c1", 512), c2("c2", 512); var i0("i0", 0, c0), i1("i1", 0, c1), i2("i2", 0, c2), i01("i01"), i02("i02"), i03("i03"), i04("i04"); input input00("input00", {i2}, p_int32); computation comp0("comp0", {i0, i1, i2}, input00(i2)); comp0.tile(i1, i2, 128, 128, i01, i02, i03, i04); comp0.parallelize(i0); buffer buf00("buf00", {512}, p_int32, a_input); buffer buf0("buf0", {256, 512, 512}, p_int32, a_output); input00.store_in(&buf00); comp0.store_in(&buf0); tiramisu::codegen({&buf00, &buf0}, "../data/programs/function14299/function14299_schedule_17/function14299_schedule_17.o"); return 0; }
[ "ei_mekki@esi.dz" ]
ei_mekki@esi.dz
13b80d0422681a210be8c21ab30f56b3ebdab5db
ab56d48406b6bae88ccc471c9e5c747cb92bc897
/examples/summerSchool/unitTest.cpp
7a7a83ba1eb773f8705b774a02c999594452d932
[ "Apache-2.0" ]
permissive
nestordemeure/shaman
66dce9eb46181787a24e2dfaf8841a27781024b1
39a6d6d658535208fbcb255f37f6eaf1f0c02ca1
refs/heads/master
2023-06-21T09:49:40.844365
2021-07-18T19:26:36
2021-07-18T19:26:36
345,312,482
5
0
null
null
null
null
UTF-8
C++
false
false
1,825
cpp
#include "integrate.hxx" #include <iostream> #include <iomanip> #include <cmath> #include <functional> #include <sstream> /** Teste la convergence du calcul d'intégrale avec le nombre de rectangles. On utilise comme cas-test le calcul de l'intégrale de cos entre 0 et pi/2, dont la valeur exacte est 1. Le même calcul est réalisé pour une suite croissante (~géométrique) de nombre de rectangles. Chaque résultat de calcul est affiché en sortie. @param step facteur entre deux nombre de rectangles testés */ void testConvergence (const RealType & step) { for (unsigned int n = 1; n <= 100000; n = std::max((unsigned int)(step*n), n+1)) { // Calcul approché RealType res = integrate([](RealType x){return cos(x);}, 0, M_PI_2, n); // Erreur (relative) par rapport à la valeur exacte RealType err = abs(1 - res); // Affichage en sortie sur cinq colonnes: // Nrectangles Resultat Erreur Erreur_approchée Resultat_(chiffres_significatifs_uniquement) std::cout << std::scientific << std::setprecision(7) << n << " " << res.number << " " << err.number << " " << std::abs(res.error) << " " << res << std::endl; } } /** Fonction utilitaire de conversion de chaîne @param str la chaîne à convertir @param TO le type de donnée à lire */ template <typename TO> TO strTo (const std::string & str) { std::istringstream iss(str); TO x; iss >> x; return x; } /** Fonction principale : le facteur de croissance du nombre de rectangles testés est lu comme premier argument en ligne de commande. La valeur 10 est choisie par défaut si aucun argument n'est fourni. */ int main (int argc, char **argv) { RealType step = 10; if (argc > 1) step = strTo<RealType> (argv[1]); testConvergence (step); return 0; }
[ "nestor.demeure.ocre@cea.fr" ]
nestor.demeure.ocre@cea.fr
1d78eca469c156e50e88598182418a6ab59ac239
fb7efe44f4d9f30d623f880d0eb620f3a81f0fbd
/ui/gl/test/gl_image_test_support.cc
abd8aa2f839109f7d3536639e88ed7c9325620ed
[ "BSD-3-Clause" ]
permissive
wzyy2/chromium-browser
2644b0daf58f8b3caee8a6c09a2b448b2dfe059c
eb905f00a0f7e141e8d6c89be8fb26192a88c4b7
refs/heads/master
2022-11-23T20:25:08.120045
2018-01-16T06:41:26
2018-01-16T06:41:26
117,618,467
3
2
BSD-3-Clause
2022-11-20T22:03:57
2018-01-16T02:09:10
null
UTF-8
C++
false
false
7,060
cc
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ui/gl/test/gl_image_test_support.h" #include <vector> #include "ui/gfx/half_float.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/init/gl_factory.h" #include "ui/gl/test/gl_surface_test_support.h" #if defined(USE_OZONE) #include "base/run_loop.h" #include "ui/ozone/public/ozone_platform.h" #endif namespace gl { // static void GLImageTestSupport::InitializeGL() { #if defined(USE_OZONE) ui::OzonePlatform::InitParams params; params.single_process = true; ui::OzonePlatform::InitializeForGPU(params); #endif std::vector<GLImplementation> allowed_impls = init::GetAllowedGLImplementations(); DCHECK(!allowed_impls.empty()); GLImplementation impl = allowed_impls[0]; GLSurfaceTestSupport::InitializeOneOffImplementation(impl, true); #if defined(USE_OZONE) // Make sure all the tasks posted to the current task runner by the // initialization functions are run before running the tests. base::RunLoop().RunUntilIdle(); #endif } // static void GLImageTestSupport::CleanupGL() { init::ShutdownGL(); } // static void GLImageTestSupport::SetBufferDataToColor(int width, int height, int stride, int plane, gfx::BufferFormat format, const uint8_t color[4], uint8_t* data) { switch (format) { case gfx::BufferFormat::R_8: case gfx::BufferFormat::RG_88: DCHECK_EQ(0, plane); for (int y = 0; y < height; ++y) { memset(&data[y * stride], color[0], width); } return; case gfx::BufferFormat::R_16: DCHECK_EQ(0, plane); for (int y = 0; y < height; ++y) { uint16_t* row = reinterpret_cast<uint16_t*>(data + y * stride); for (int x = 0; x < width; ++x) { row[x] = static_cast<uint16_t>(color[0] << 8); } } return; case gfx::BufferFormat::BGR_565: DCHECK_EQ(0, plane); for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { *reinterpret_cast<uint16_t*>(&data[y * stride + x * 2]) = ((color[2] >> 3) << 11) | ((color[1] >> 2) << 5) | (color[0] >> 3); } } return; case gfx::BufferFormat::RGBX_8888: DCHECK_EQ(0, plane); for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { data[y * stride + x * 4 + 0] = color[0]; data[y * stride + x * 4 + 1] = color[1]; data[y * stride + x * 4 + 2] = color[2]; data[y * stride + x * 4 + 3] = 0xaa; // unused } } return; case gfx::BufferFormat::RGBA_8888: DCHECK_EQ(0, plane); for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { data[y * stride + x * 4 + 0] = color[0]; data[y * stride + x * 4 + 1] = color[1]; data[y * stride + x * 4 + 2] = color[2]; data[y * stride + x * 4 + 3] = color[3]; } } return; case gfx::BufferFormat::BGRX_8888: DCHECK_EQ(0, plane); for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { data[y * stride + x * 4 + 0] = color[2]; data[y * stride + x * 4 + 1] = color[1]; data[y * stride + x * 4 + 2] = color[0]; data[y * stride + x * 4 + 3] = 0xaa; // unused } } return; case gfx::BufferFormat::BGRA_8888: DCHECK_EQ(0, plane); for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { data[y * stride + x * 4 + 0] = color[2]; data[y * stride + x * 4 + 1] = color[1]; data[y * stride + x * 4 + 2] = color[0]; data[y * stride + x * 4 + 3] = color[3]; } } return; case gfx::BufferFormat::RGBA_F16: { DCHECK_EQ(0, plane); float float_color[4] = { color[0] / 255.f, color[1] / 255.f, color[2] / 255.f, color[3] / 255.f, }; uint16_t half_float_color[4]; gfx::FloatToHalfFloat(float_color, half_float_color, 4); for (int y = 0; y < height; ++y) { uint16_t* row = reinterpret_cast<uint16_t*>(data + y * stride); for (int x = 0; x < width; ++x) { row[x * 4 + 0] = half_float_color[0]; row[x * 4 + 1] = half_float_color[1]; row[x * 4 + 2] = half_float_color[2]; row[x * 4 + 3] = half_float_color[3]; } } return; } case gfx::BufferFormat::YVU_420: { DCHECK_LT(plane, 3); DCHECK_EQ(0, height % 2); DCHECK_EQ(0, width % 2); // These values are used in the transformation from YUV to RGB color // values. They are taken from the following webpage: // http://www.fourcc.org/fccyvrgb.php uint8_t yvu[] = { (0.257 * color[0]) + (0.504 * color[1]) + (0.098 * color[2]) + 16, (0.439 * color[0]) - (0.368 * color[1]) - (0.071 * color[2]) + 128, -(0.148 * color[0]) - (0.291 * color[1]) + (0.439 * color[2]) + 128}; if (plane == 0) { for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { data[stride * y + x] = yvu[0]; } } } else { for (int y = 0; y < height / 2; ++y) { for (int x = 0; x < width / 2; ++x) { data[stride * y + x] = yvu[plane]; } } } return; } case gfx::BufferFormat::YUV_420_BIPLANAR: { DCHECK_LT(plane, 2); DCHECK_EQ(0, height % 2); DCHECK_EQ(0, width % 2); // These values are used in the transformation from YUV to RGB color // values. They are taken from the following webpage: // http://www.fourcc.org/fccyvrgb.php uint8_t yuv[] = { (0.257 * color[0]) + (0.504 * color[1]) + (0.098 * color[2]) + 16, -(0.148 * color[0]) - (0.291 * color[1]) + (0.439 * color[2]) + 128, (0.439 * color[0]) - (0.368 * color[1]) - (0.071 * color[2]) + 128}; if (plane == 0) { for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { data[stride * y + x] = yuv[0]; } } } else { for (int y = 0; y < height / 2; ++y) { for (int x = 0; x < width / 2; ++x) { data[stride * y + x * 2] = yuv[1]; data[stride * y + x * 2 + 1] = yuv[2]; } } } return; } case gfx::BufferFormat::ATC: case gfx::BufferFormat::ATCIA: case gfx::BufferFormat::DXT1: case gfx::BufferFormat::DXT5: case gfx::BufferFormat::ETC1: case gfx::BufferFormat::RGBA_4444: case gfx::BufferFormat::UYVY_422: NOTREACHED(); return; } NOTREACHED(); } } // namespace gl
[ "jacob-chen@iotwrt.com" ]
jacob-chen@iotwrt.com
c89ec9f100a44749398dec0cc245f1af71077859
b46ca04457662a402ebadf4d2320cbd752281375
/self_localization/self_localization/src/mcl.cpp
4764e198b9f910dae4daea53f7c65752ac93db05
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
tkuwheel/TKURoboSot
147b55e278c54fda3aa77e20a7b659d21a76c0f4
71dc3d5cd7952d4bbba498e32313594c697f781a
refs/heads/master
2021-07-14T18:06:35.682888
2020-02-25T09:24:40
2020-02-25T09:24:40
175,620,874
14
25
MIT
2019-08-12T22:43:33
2019-03-14T12:49:09
HTML
UTF-8
C++
false
false
13,560
cpp
#include "mcl.h" #include "util.hpp" #include <fstream> #include <iostream> #include <cstring> #include <ros/package.h> #include <opencv2/opencv.hpp> #include "fMatrix/fVector.h" #define N_PARTICLE 600 #define TO_RAD M_PI/180.0 #define FIELD_WIDTH 600 #define FIELD_HEIGHT 400 #define XLINE1 300 #define XLINE2 XLINE1-40 #define XLINE3 XLINE1-75 #define XLINE4 0 #define XLINE5 -(XLINE3) #define XLINE6 -(XLINE2) #define XLINE7 -(XLINE1) #define XLINE8 75 #define XLINE9 -XLINE8 #define YLINE1 200 #define YLINE2 100 #define YLINE3 80 #define YLINE4 -(YLINE3) #define YLINE5 -(YLINE2) #define YLINE6 -(YLINE1) #define CENTER_RADIUS 60 #define CENTER_RADIUS2 25 #define DISTANCE_MATRIX_WIDTH 700 #define DISTANCE_MATRIX_HEIGHT 500 // for qrc //#include <QtCore> //#include <QString> //#include <QResource> //#include <QFileInfo> using namespace std; using namespace cv; typedef unsigned char BYTE; MCL::MCL() : xvar(10), yvar(10), wvar(5), cmps(0), w_fast(0.0), w_slow(0.0), a_fast(1.), a_slow(0.0005), wcmps(0.1), wvision(1.-wcmps) { std::random_device x_rd, y_rd, w_rd; std::uniform_real_distribution<double> x_rgen(-300,300), y_rgen(-200,200), w_rgen(0.0,360.0); for(int i=0; i<N_PARTICLE; i++) { particles.push_back(Particle(x_rgen(x_rd),y_rgen(y_rd),w_rgen(w_rd),wvision/N_PARTICLE,wcmps/N_PARTICLE,1.0/N_PARTICLE)); } } void MCL::setAugmentParam(double a_fast, double a_slow) { this->a_fast = a_fast; this->a_slow = a_slow; this->w_fast = 0.0; this->w_slow = 0.0; } void MCL::setCmpsWeight(double w) { this->wcmps = w; this->wvision = 1. - wcmps; } void MCL::updateMotion(double vx, double vy, double dw) { utility::timer timer; mutex.lock(); static std::random_device xrd, yrd, wrd; static std::normal_distribution<> xgen(0.0,xvar), ygen(0.0,yvar), wgen(0.0,wvar); for(auto& p : particles) { double c = cos(w(p)*TO_RAD); double s = sin(w(p)*TO_RAD); double dx = c*vx+s*vy; double dy = -s*vx+c*vy; double static_noise_x = xgen(xrd)/5.0; double static_noise_y = ygen(yrd)/5.0; double static_noise_w = wgen(wrd)/1.0; double dynamic_noise_x = fabs(dx)*xgen(xrd)/5.0; double dynamic_noise_y = fabs(dy)*ygen(yrd)/5.0; double dynamic_noise_w = fabs(dw)*wgen(wrd)/3.0; double x_yterm = fabs(dy)*xgen(xrd)/30.0; // dynamic noise on x-direction because of y motion double x_wterm = fabs(dw)*xgen(xrd)/30.0; // dynamic noise on x-direction because of w motion double y_xterm = fabs(dx)*ygen(yrd)/30.0; // dynamic noise on y-direction because of x motion double y_wterm = fabs(dw)*ygen(yrd)/30.0; // dynamic noise on y-direction because of w motion double w_xterm = fabs(dx)*wgen(wrd)/2.0; // dynamic noise on w-direction because of x motion double w_yterm = fabs(dy)*wgen(wrd)/2.0; // dynamic noise on w-direction because of y motion x(p) += dx+static_noise_x+dynamic_noise_x+x_yterm+x_wterm; y(p) += dy+static_noise_y+dynamic_noise_y+y_xterm+y_wterm; w(p) += dw+static_noise_w+dynamic_noise_w+w_xterm+w_yterm; while (w(p)>360.) { w(p) -= 360.; } while (w(p)<0.) { w(p) += 360.; } } mutex.unlock(); auto time = timer.elapsed(); // std::cout << "update Motion : " << time << " ms\n"; } void MCL::updateSensor(const std::vector<MCL::SensorData> &data) { utility::timer timer; mutex.lock(); int n_data = data.size(); if(n_data<=0) return; double weight_sum(0.0); double weight_sum_cmps(0.0); for(auto& p : particles) { double err_sum(0.0); for(auto d : data) { double c = cos(w(p)*TO_RAD); double s = sin(w(p)*TO_RAD); double world_x = c*x(d)+s*y(d)+x(p); double world_y = -s*x(d)+c*y(d)+y(p); double distance = field.distance(world_x,world_y); distance = distance*distance; double pt_distance = sqrt(x(d)*x(d)+y(d)*y(d)); err_sum += distance; } // double cmps_err = 10.0*fabs(cmps_error(w(p))); double p_weight = 1.0/(err_sum/*+cmps_err*/)/n_data; vis_weight(p) = p_weight; weight_sum += p_weight; double cmps_err = 180.0/std::max(fabs(cmps_error(w(p))),1.); cmps_weight(p) = cmps_err; weight_sum_cmps += cmps_err; } double w_avg(0.0); for(auto& p : particles){ vis_weight(p) /= weight_sum; cmps_weight(p) = (cmps_weight(p)/weight_sum_cmps); total_weight(p) = wcmps*cmps_weight(p) + wvision*vis_weight(p); } w_avg = (weight_sum*wvision+wcmps*weight_sum_cmps)/N_PARTICLE; // double w_avg = weight_sum/N_PARTICLE; // std::cout << "W_AVG : " << w_avg << '\n'; w_slow = w_slow + a_slow*(w_avg-w_slow); w_fast = w_fast + a_fast*(w_avg-w_fast); //====================== if(w_slow>1)w_slow=1; if(w_fast>10)w_fast=10; //====================== resample(); mutex.unlock(); auto time = timer.elapsed(); //std::cout << "update Measurement : " << time << " ms; " // << "w_slow : " << w_slow << "; w_fast : " << w_fast // << std::endl; } void MCL::updateCompass(double compass) { cmps = compass; } MCL::State MCL::estimation() { mutex.lock(); double x_mean = 0.0; double y_mean = 0.0; double w_mean = 0.0; //=========================== Particles temp; Float* x_elem = new Float[N_PARTICLE]; Float* y_elem = new Float[N_PARTICLE]; double std_x, std_y, std_xy; static double x_mean_, y_mean_; for(int i=0; i<particles.size(); i++) { x_elem[i]=x(particles.at(i)); y_elem[i]=y(particles.at(i)); } fVector x_(N_PARTICLE, x_elem); fVector y_(N_PARTICLE, y_elem); std_x=Std(x_); std_y=Std(y_); std_xy = (std_x+std_y)/2; sd = std_xy; //cout<<std_xy<<endl; if(std_xy<80){ x_mean_=0; y_mean_=0; for(auto p : particles) { x_mean_ += (1.0/N_PARTICLE)*x(p); y_mean_ += (1.0/N_PARTICLE)*y(p); } } if(std_xy<200){ //cout<<std_xy<<endl; //cout<<temp.size()<<endl; for(int i=0; i<particles.size(); i++) { double distance = sqrt(pow(x(particles.at(i))-x_mean_,2)+pow(y(particles.at(i))-y_mean_,2)); if(distance<40){ //cout<<fabs(x(particles.at(i))-x_mean_)<<endl; //if(fabs(x(particles.at(i))-x_mean_)<60){ temp.push_back(particles.at(i)); //cout<<"erase"<<i<<endl; } } x_mean_=0; y_mean_=0; for(auto p : temp) { x_mean_ += (1.0/temp.size())*x(p); y_mean_ += (1.0/temp.size())*y(p); } //cout<<temp.size()<<endl; } //=========================== for(auto p : temp) { //cout<<temp.size()<<endl; //x_mean += (1.0/N_PARTICLE)*x(p); //y_mean += (1.0/N_PARTICLE)*y(p); x_mean += (1.0/temp.size())*x(p); y_mean += (1.0/temp.size())*y(p); double wm_tmp = w_mean; while(wm_tmp>360.) wm_tmp -= 360.; while (wm_tmp<0.) wm_tmp += 360.; double dw = w(p) - wm_tmp; if(dw>180.) { dw = -(360. - dw); } else if(dw<-180.) { dw = 360. + dw; } //w_mean += (1.0/N_PARTICLE)*(720./180.)*dw; w_mean += (1.0/temp.size())*(720./180.)*dw; } while(w_mean>360.) w_mean -= 360.; while (w_mean<0.) w_mean += 360.; x(pose_estimation) = x_mean; y(pose_estimation) = y_mean; w(pose_estimation) = w_mean; mutex.unlock(); return std::make_tuple(x_mean,y_mean,w_mean); } MCL::State MCL::weighted_estimation() { mutex.lock(); double x_mean = x(pose_estimation); double y_mean = y(pose_estimation); double w_mean = 0.; //================== Particles temp; Float* x_elem = new Float[N_PARTICLE]; Float* y_elem = new Float[N_PARTICLE]; double std_x, std_y, std_xy; double x_mean_, y_mean_; for(int i=0; i<particles.size(); i++) { x_elem[i]=x(particles.at(i)); y_elem[i]=y(particles.at(i)); } fVector x_(N_PARTICLE, x_elem); fVector y_(N_PARTICLE, y_elem); std_x=Std(x_); std_y=Std(y_); std_xy = (std_x+std_y)/2; //cout<<std_xy<<endl; if(std_xy<200){ for(auto p : particles) { x_mean_ += (1.0/N_PARTICLE)*x(p); y_mean_ += (1.0/N_PARTICLE)*y(p); } //cout<<temp.size()<<endl; for(int i=0; i<particles.size(); i++) { //if(fabs(x(particles.at(i))-x_mean_)<60&&fabs(y(particles.at(i))-y_mean_)<60){ //int distance = sqrt(pow(x(particles.at(i))-x_mean_,2)+pow(y(particles.at(i))-y_mean_,2)); //if(distance<40){ temp.push_back(particles.at(i)); //cout<<"erase"<<i<<endl; //temp.erase(temp.begin()+i); //} } //cout<<temp.size()<<endl; } //================== for(auto p : temp) { auto pw = total_weight(p); x_mean += (pw)*(x(p)-x(pose_estimation)); y_mean += (pw)*(y(p)-y(pose_estimation)); double wm_tmp = w_mean; while(wm_tmp>360.) wm_tmp -= 360.; while (wm_tmp<0.) wm_tmp += 360.; double dw = w(p) - wm_tmp; if(dw>180.) { dw = -(360. - dw); } else if(dw<-180.) { dw = 360. + dw; } w_mean += (pw)*(720./180.)*dw; } while(w_mean>360.) w_mean -= 360.; while (w_mean<0.) w_mean += 360.; // x(pose_estimation) = x_mean; // y(pose_estimation) = y_mean; // w(pose_estimation) = w_mean; mutex.unlock(); return std::make_tuple(x_mean,y_mean,w_mean); } void MCL::resetParticles(bool init, double xpos, double ypos, double wpos) { std::random_device xrd, yrd, wrd; w_fast=0.0, w_slow=0.0; if(init) { std::normal_distribution<double> xrg(xpos,xvar), yrg(ypos,yvar), wrg(wpos,wvar); for(auto& p : particles) { x(p) = xrg(xrd); y(p) = yrg(yrd); w(p) = wrg(wrd); } } else { std::uniform_real_distribution<double> xrg(-300,300), yrg(-200,200), wrg(0,360); for(auto& p : particles) { x(p) = xrg(xrd); y(p) = yrg(yrd); w(p) = wrg(wrd); } } } void MCL::setRandomParameter(double xv, double yv, double wv) { xvar = xv; yvar = yv; wvar = wv; } inline void MCL::resample() { Particles plist; std::random_device rd; std::mt19937 gen(rd()); std::uniform_real_distribution<> rg(0.0,1.0/N_PARTICLE); double r = rg(gen); // double c = vis_weight(particles[0]); double c = total_weight(particles[0]); int idx = 0; std::random_device rd1; std::mt19937 gen1(rd1()); std::random_device rd2; std::mt19937 gen2(rd2()); std::uniform_real_distribution<double> xrg(-300,300), yrg(-200,200), wrg(0,360); double random_prob = (1.0-(w_fast/w_slow)); // std::bernoulli_distribution random_gen((random_prob<0) ? 0.0 : (random_prob>1 ? 1.0 : random_prob)); std::bernoulli_distribution random_gen(std::max(0.0,random_prob)); for(int i=0; i<N_PARTICLE; i++) { if(random_gen(gen1)) { plist.push_back(std::make_tuple(xrg(gen2),yrg(gen2),wrg(gen2),wvision/N_PARTICLE,wcmps/N_PARTICLE,1.0/N_PARTICLE)); } else { double u = r+((double)i/N_PARTICLE); while (u>c) { idx += 1; // c += vis_weight(particles[idx]); c += total_weight(particles[idx]); } plist.push_back(particles[idx]); } } particles = plist; } double MCL::cmps_error(double &angle) { while(angle>360.) { angle -= 360.; } while (angle<0.) { angle += 360.; } double err = angle-cmps; if(fabs(err)>180.0) { err = 360.0-fabs(err); } return err; } MCL::FieldMatrix::FieldMatrix() { xline.push_back(XLINE1); xline.push_back(XLINE2); xline.push_back(XLINE3); xline.push_back(XLINE4); xline.push_back(XLINE5); xline.push_back(XLINE6); xline.push_back(XLINE7); yline.push_back(YLINE1); yline.push_back(YLINE2); yline.push_back(YLINE3); yline.push_back(YLINE4); yline.push_back(YLINE5); yline.push_back(YLINE6); start_x = -xline[0]-100; end_x = xline[0]+100; start_y = -yline[0]-100; end_y = yline[0]+100; x_length = end_x-start_x+1; y_length = end_y-start_y+1; //======================= distance_matrix = (double*) malloc(sizeof(double)*x_length*y_length); //#define TEST ros::package::getPath("vision")+"/localization/errortable.bin" string vision_path = ros::package::getPath("self_localization"); string FILE_PATH = "/self_localization/src/errortable.bin"; string Filename = vision_path + FILE_PATH; const char *Filename_Path = Filename.c_str(); if(ifstream(Filename)){ // open the file: streampos fileSize; std::ifstream file(Filename_Path, ios::binary); // get its size: file.seekg(0, ios::end); fileSize = file.tellg(); file.seekg(0, ios::beg); // read the data: vector<BYTE> fileData(fileSize); file.read((char *)distance_matrix, fileSize); cout<<"read bin finish"<<endl; cv::Mat distance_map(DISTANCE_MATRIX_HEIGHT, DISTANCE_MATRIX_WIDTH, CV_8UC3, Scalar(255,255,255)); for(int i=0; i<DISTANCE_MATRIX_WIDTH; i++) { for(int j=0; j<DISTANCE_MATRIX_HEIGHT; j++) { auto color = (int)(distance((double)i-DISTANCE_MATRIX_WIDTH/2,(double)j-DISTANCE_MATRIX_HEIGHT/2))+50; auto px = (color>255)? (255) : (color<0?0:color); px = 255-px; } } //cv::imshow("distance_map",distance_map); //cv::waitKey(10); }else{ cout<<"can not find the bin file.\n"; } //=========================== } double MCL::FieldMatrix::distance(double x, double y) { if((abs((int)x)<=end_x) && (abs((int)y)<=end_y)) return distance_matrix[((int)(y)-start_y)*x_length+(int)(x)-start_x]; else { // std::cout << "[FieldMatrix] index out of bound\n"; //return 500.0; return 300; } }
[ "thomas19980311@gmail.com" ]
thomas19980311@gmail.com
28b2b05402e8a0452f52cb48f152c2bb1ad63b17
0cffa6803ee52ccbd5981b57d18c85fe11e6f7fb
/017_scoped_ptr/main.cpp
1af8cdf35f3a167f51bede85e4bcef8c58a12f77
[]
no_license
fengyunzhenyu/boost_learn
74ff1f799eeecae13378d351697a0f34544931b4
ed0948e7082c052f786a5d1689d77c6e60ae6b41
refs/heads/master
2022-08-03T03:15:26.485075
2020-05-23T14:35:08
2020-05-23T14:35:08
266,306,797
0
0
null
null
null
null
GB18030
C++
false
false
829
cpp
#include<iostream> using namespace std; #include<boost/scoped_ptr.hpp> #include<boost/scoped_array.hpp> using namespace boost; class A { public: A() { cout << "构造A类对象!" << endl; } ~A() { cout << "析构A类对象!" << endl; } int m_a; }; int main() { //注意,scoped_ptr不能接受数组指针 scoped_ptr<A> p1(new A[5]);//传入对象数组指针 //c++中的 new 与delete需要注意的 A* pA = new A; delete pA; A* pArr = new A[5]; pArr[3].m_a = 1000; (pArr + 3)->m_a = 2000; delete []pArr;//删除数组指针 //指向数组内存地址的指针 scoped_array<A> p2(new A[5]); for (int i = 0; i < 5; i++) { p2[i].m_a = i;//支持[]访问,把p2当做数组名使用 } cout << p2[4].m_a << endl;//用索引访问 (p2 + 3)->m_a = 200;//这种方式不支持 return 0; }
[ "fengyunzhenyu@sina.com" ]
fengyunzhenyu@sina.com
729903eaad660c45ea6162daccf90d77160d242d
06fdb4c97f29c81ac155802413f75203c1e71a75
/7 游戏主程序/SourceCode/Header/LessonE.h
a73a83b465db75d8ebbe9dd51408bf57fc2fb152
[]
no_license
WhitePhosphorus4/P4-funcode-project
0e3dc5fa7b9ab69dcf5ae204b622cc7e08451e65
b2479421db5b45d87d2e32bd989189c30b15a679
refs/heads/main
2023-04-07T02:53:39.058884
2021-04-06T09:34:53
2021-04-06T09:34:53
355,128,506
1
1
null
null
null
null
GB18030
C++
false
false
2,260
h
///////////////////////////////////////////////////////////////////////////////// // // // // ///////////////////////////////////////////////////////////////////////////////// #ifndef _LESSON_E_H_ #define _LESSON_E_H_ // #include <Windows.h> #include "..\VCProject2010/VCProject2010/home.h" ///////////////////////////////////////////////////////////////////////////////// // // 游戏总管类。负责处理游戏主循环、游戏初始化、结束等工作 class BGameMain { private: int m_iGameState; // 游戏状态,0:结束或者等待开始;1:初始化;2:游戏进行中 int located1, located2; //所在的大场景和小场景位置 bool carry; bool doorisopen[6]; double beblack; // 黑幕产生的进度 int becomeblack; //判断是否要变黑 1为变黑 0为不变 -1为便白 2为永久变黑 int now; //暂时存储要转换的图的编号 bool isattack; bool attackfirst; //判断音乐是否响起 bool attackafter; bool attackafter1; CSound* surrounded; CSound* keyopen; // CSound* horror1; CSound* click; CSound* openthedoor; CSound* shriek; CSound* hited; CSound* scared; bool isagain; bool firstsee; public: BGameMain(); //构造函数 ~BGameMain(); //析构函数 // Get方法 int GetGameState() { return m_iGameState; } Home* home; // Set方法 void SetGameState( const int iState ) { m_iGameState = iState; } // 游戏主循环等 void GameMainLoop( float fDeltaTime ); void GameInit(); void GameRun( float fDeltaTime ); void GameEnd(); void OnMouseMove( const float fMouseX, const float fMouseY ); void OnMouseClick( const int iMouseType, const float fMouseX, const float fMouseY ); void OnMouseUp( const int iMouseType, const float fMouseX, const float fMouseY ); void OnKeyDown( const int iKey, const bool bAltPress, const bool bShiftPress, const bool bCtrlPress ); void OnKeyUp( const int iKey ); void OnSpriteColSprite( const char *szSrcName, const char *szTarName ); void OnSpriteColWorldLimit( const char *szName, const int iColSide ); }; ///////////////////////////////////////////////////////////////////////////////// // extern BGameMain b_GameMain; #endif // _LESSON_E_H_
[ "xionghao0613@163.com" ]
xionghao0613@163.com
c90b075b22c115ac21d85b0817ff3a6e131da138
bb855dc3eb6ab7256ab4db5492d1d12c5958d9c1
/Aphrodite-Runtime/src/Aphrodite/Scene/Entity.cpp
844d71d45c36d54d29f46a0781eb990edf80f52e
[ "MIT" ]
permissive
blizmax/Aphrodite
6a7744384962c46fc3acb3941184c6360919e7f8
f60289485457844b08e62e7429342b81f54a4c67
refs/heads/master
2023-06-15T11:06:38.053890
2021-07-05T09:10:33
2021-07-05T09:10:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
272
cpp
// // Created by npchitman on 6/27/21. // #include "Entity.h" #include "pch.h" namespace Aph { Entity::Entity(entt::entity handle, Scene *scene) : m_EntityHandle(handle), m_Scene(scene) { } }// namespace Aph
[ "npchitman@outlook.com" ]
npchitman@outlook.com
046c9b6d41e7c922be8cf566551ac5c1ea2e5b6f
5130d9033f157a1612f287e6935f0ba7fdfd353f
/supervisor/supervisorio/tcpclient.h
5cd436b31366ae5f3304af1046b56d3b0bce3a8d
[ "MIT" ]
permissive
AlexanderSilvaB/Mari
5c75470760afd0729420541bb318837193f0bbb5
0a660d39ad9d987d449c7fc9b1fb6d1cec631cb6
refs/heads/master
2021-07-10T07:43:10.799212
2019-01-25T00:54:26
2019-01-25T00:54:26
145,122,528
3
9
MIT
2020-06-20T16:20:48
2018-08-17T13:16:02
C++
UTF-8
C++
false
false
1,086
h
#ifndef TCPCLIENT_H #define TCPCLIENT_H #include <QThread> #include <QTcpSocket> #include <QAbstractSocket> #include "message.h" #include "imagemessage.h" class TCPClient : public QObject { Q_OBJECT private: int port; int inSize; QByteArray inData; QString address; QString imageType; QTcpSocket *socket; QStringList imageTypes; char infoDataRaw[8]; void processImage(ImageMessage &imageMessage); public: TCPClient(); ~TCPClient(); void setImageType(QString name); void setPort(int port); bool connectToHost(QString address); bool disconnectFromHost(); bool isConnected(); bool send(Message *message); public slots: void connected(); void disconnected(); void readyRead(); signals: void updateImage(ImageMessage imageMessage); void addImageType(QString name); void cameraSetting(int setting, int value); void messageReceived(Message msg); }; #endif // TCPCLIENT_H
[ "alexander.lmx@outlook.com" ]
alexander.lmx@outlook.com
98b8f9a09b7cd54c801053333cba7a9bc3f351c9
a6205d92ce9e063d6ee185e5f39ced26e3c3d3d2
/todo/tuts/masm64/Include/cnetcfg.inc
2947498069a1c0bc4a0a8e09a811672c330f5828
[]
no_license
wyrover/masm32-package-vs2015
9cd3bbcd1aaeb79fc33d924f1f1fdb4ed0f6eb26
855707ef7b9e9cbc6dc69bd24a635014c61fcfed
refs/heads/master
2020-12-30T22:31:42.391236
2016-05-24T17:22:27
2016-05-24T17:22:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
382
inc
extern __imp_InetConfigSystem:PANYARGS InetConfigSystem TEXTEQU <__imp_InetConfigSystem> extern __imp_InetNeedModem:PANYARGS InetNeedModem TEXTEQU <__imp_InetNeedModem> extern __imp_InetNeedSystemComponents:PANYARGS InetNeedSystemComponents TEXTEQU <__imp_InetNeedSystemComponents> extern __imp_InetStartServices:PANYARGS InetStartServices TEXTEQU <__imp_InetStartServices>
[ "admin@agguro.be" ]
admin@agguro.be
70fa9e05d0ea8baab2a2c9f9488598b24676573e
bfff5d8dff401bba13734b979350e7af5eed45d5
/Src/Modules/BehaviorControl/Libraries/LibCodeReleaseProvider.cpp
5563d580fa75d642f4600ba7eceb629e2a3748ce
[ "BSD-2-Clause" ]
permissive
SkyCloudShang/iRobot_Bhuman
fb1d7054be0f5d748f4415a902998254d7db3f0c
bcf9fc6ea4c024df56b5c5091ae4bba16dbeb11b
refs/heads/master
2021-09-08T17:30:17.772182
2017-12-24T02:57:20
2017-12-24T02:57:20
104,904,130
0
0
null
null
null
null
UTF-8
C++
false
false
1,485
cpp
/** * @file LibCodeRelease.cpp */ #include "LibCodeReleaseProvider.h" MAKE_MODULE(LibCodeReleaseProvider, behaviorControl); using namespace Transformation; void LibCodeReleaseProvider::update(LibCodeRelease& libCodeRelease) { libCodeRelease.timeSinceBallWasSeen = theFrameInfo.getTimeSince(theBallModel.timeWhenLastSeen); libCodeRelease.angleToGoal = (theRobotPose.inversePose * Vector2f(theFieldDimensions.xPosOpponentGroundline, 0.f)).angle(); libCodeRelease.between = [&](float value, float min, float max) -> bool { return value >= min && value <= max; }; libCodeRelease.angleToCenter=(theRobotPose.inversePose * Vector2f(0.f, 0.f)).angle(); libCodeRelease.angleToBall=(theRobotPose.inversePose * Vector2f(robotToField(theRobotPose,theBallModel.estimate.position))).angle(); static float odometryR = 0.f; static float odometryX = 0.f; odometryR = static_cast<float>(theOdometer.odometryOffset.rotation); odometryX = theOdometer.odometryOffset.translation.x(); if (theGameInfo.state == STATE_PLAYING && theRobotInfo.penalty == PENALTY_NONE) { libCodeRelease.odometryRSum += odometryR; libCodeRelease.odometryXSum += odometryX; } else { libCodeRelease.odometryRSum = 0.f; libCodeRelease.odometryXSum = 0.f; } if ((theRobotInfo.number == 2) && (theTeamData.teammates.empty() || theTeamData.teammates[0].theBehaviorStatus.firstRobotArrived==0)) { libCodeRelease.odometryRSum = 0.f; libCodeRelease.odometryXSum = 0.f; } }
[ "814359194@qq.com" ]
814359194@qq.com
e4df52c0e7c8b5f530c1baae1ffae5b89be7fa75
07d5313b6f7aa7fc421dd244a045e45962b23bf8
/Common_3/ThirdParty/OpenSource/BulletPhysics/2.77/src/LinearMath/btSerializer.cpp
10f613a0aba4eea14c5fc16a61aad5f5dd2ba9b1
[ "Zlib", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-unknown", "Apache-2.0" ]
permissive
daveansh/The-Forge
4bc91d1978f6f46ec746d4e690280fcdfe06efbd
29b377a64230be414eb84b632b8517646a1f9da4
refs/heads/master
2022-02-22T21:14:44.125736
2019-08-19T20:27:19
2019-08-19T20:27:19
192,270,664
1
0
Apache-2.0
2019-06-17T03:44:11
2019-06-17T03:44:11
null
UTF-8
C++
false
false
38,218
cpp
unsigned char sBulletDNAstr64[]= { 83,68,78,65,78,65,77,69,-79,0,0,0,109,95,115,105,122,101,0,109, 95,99,97,112,97,99,105,116,121,0,42,109,95,100,97,116,97,0,109,95, 99,111,108,108,105,115,105,111,110,83,104,97,112,101,115,0,109,95,99,111, 108,108,105,115,105,111,110,79,98,106,101,99,116,115,0,109,95,99,111,110, 115,116,114,97,105,110,116,115,0,42,102,105,114,115,116,0,42,108,97,115, 116,0,109,95,102,108,111,97,116,115,91,52,93,0,109,95,101,108,91,51, 93,0,109,95,98,97,115,105,115,0,109,95,111,114,105,103,105,110,0,109, 95,114,111,111,116,78,111,100,101,73,110,100,101,120,0,109,95,115,117,98, 116,114,101,101,83,105,122,101,0,109,95,113,117,97,110,116,105,122,101,100, 65,97,98,98,77,105,110,91,51,93,0,109,95,113,117,97,110,116,105,122, 101,100,65,97,98,98,77,97,120,91,51,93,0,109,95,97,97,98,98,77, 105,110,79,114,103,0,109,95,97,97,98,98,77,97,120,79,114,103,0,109, 95,101,115,99,97,112,101,73,110,100,101,120,0,109,95,115,117,98,80,97, 114,116,0,109,95,116,114,105,97,110,103,108,101,73,110,100,101,120,0,109, 95,112,97,100,91,52,93,0,109,95,101,115,99,97,112,101,73,110,100,101, 120,79,114,84,114,105,97,110,103,108,101,73,110,100,101,120,0,109,95,98, 118,104,65,97,98,98,77,105,110,0,109,95,98,118,104,65,97,98,98,77, 97,120,0,109,95,98,118,104,81,117,97,110,116,105,122,97,116,105,111,110, 0,109,95,99,117,114,78,111,100,101,73,110,100,101,120,0,109,95,117,115, 101,81,117,97,110,116,105,122,97,116,105,111,110,0,109,95,110,117,109,67, 111,110,116,105,103,117,111,117,115,76,101,97,102,78,111,100,101,115,0,109, 95,110,117,109,81,117,97,110,116,105,122,101,100,67,111,110,116,105,103,117, 111,117,115,78,111,100,101,115,0,42,109,95,99,111,110,116,105,103,117,111, 117,115,78,111,100,101,115,80,116,114,0,42,109,95,113,117,97,110,116,105, 122,101,100,67,111,110,116,105,103,117,111,117,115,78,111,100,101,115,80,116, 114,0,42,109,95,115,117,98,84,114,101,101,73,110,102,111,80,116,114,0, 109,95,116,114,97,118,101,114,115,97,108,77,111,100,101,0,109,95,110,117, 109,83,117,98,116,114,101,101,72,101,97,100,101,114,115,0,42,109,95,110, 97,109,101,0,109,95,115,104,97,112,101,84,121,112,101,0,109,95,112,97, 100,100,105,110,103,91,52,93,0,109,95,99,111,108,108,105,115,105,111,110, 83,104,97,112,101,68,97,116,97,0,109,95,108,111,99,97,108,83,99,97, 108,105,110,103,0,109,95,112,108,97,110,101,78,111,114,109,97,108,0,109, 95,112,108,97,110,101,67,111,110,115,116,97,110,116,0,109,95,105,109,112, 108,105,99,105,116,83,104,97,112,101,68,105,109,101,110,115,105,111,110,115, 0,109,95,99,111,108,108,105,115,105,111,110,77,97,114,103,105,110,0,109, 95,112,97,100,100,105,110,103,0,109,95,112,111,115,0,109,95,114,97,100, 105,117,115,0,109,95,99,111,110,118,101,120,73,110,116,101,114,110,97,108, 83,104,97,112,101,68,97,116,97,0,42,109,95,108,111,99,97,108,80,111, 115,105,116,105,111,110,65,114,114,97,121,80,116,114,0,109,95,108,111,99, 97,108,80,111,115,105,116,105,111,110,65,114,114,97,121,83,105,122,101,0, 109,95,118,97,108,117,101,0,109,95,112,97,100,91,50,93,0,109,95,118, 97,108,117,101,115,91,51,93,0,42,109,95,118,101,114,116,105,99,101,115, 51,102,0,42,109,95,118,101,114,116,105,99,101,115,51,100,0,42,109,95, 105,110,100,105,99,101,115,51,50,0,42,109,95,51,105,110,100,105,99,101, 115,49,54,0,42,109,95,105,110,100,105,99,101,115,49,54,0,109,95,110, 117,109,84,114,105,97,110,103,108,101,115,0,109,95,110,117,109,86,101,114, 116,105,99,101,115,0,42,109,95,109,101,115,104,80,97,114,116,115,80,116, 114,0,109,95,115,99,97,108,105,110,103,0,109,95,110,117,109,77,101,115, 104,80,97,114,116,115,0,109,95,109,101,115,104,73,110,116,101,114,102,97, 99,101,0,42,109,95,113,117,97,110,116,105,122,101,100,70,108,111,97,116, 66,118,104,0,42,109,95,113,117,97,110,116,105,122,101,100,68,111,117,98, 108,101,66,118,104,0,42,109,95,116,114,105,97,110,103,108,101,73,110,102, 111,77,97,112,0,109,95,112,97,100,51,91,52,93,0,109,95,116,114,97, 110,115,102,111,114,109,0,42,109,95,99,104,105,108,100,83,104,97,112,101, 0,109,95,99,104,105,108,100,83,104,97,112,101,84,121,112,101,0,109,95, 99,104,105,108,100,77,97,114,103,105,110,0,42,109,95,99,104,105,108,100, 83,104,97,112,101,80,116,114,0,109,95,110,117,109,67,104,105,108,100,83, 104,97,112,101,115,0,109,95,117,112,65,120,105,115,0,109,95,102,108,97, 103,115,0,109,95,101,100,103,101,86,48,86,49,65,110,103,108,101,0,109, 95,101,100,103,101,86,49,86,50,65,110,103,108,101,0,109,95,101,100,103, 101,86,50,86,48,65,110,103,108,101,0,42,109,95,104,97,115,104,84,97, 98,108,101,80,116,114,0,42,109,95,110,101,120,116,80,116,114,0,42,109, 95,118,97,108,117,101,65,114,114,97,121,80,116,114,0,42,109,95,107,101, 121,65,114,114,97,121,80,116,114,0,109,95,99,111,110,118,101,120,69,112, 115,105,108,111,110,0,109,95,112,108,97,110,97,114,69,112,115,105,108,111, 110,0,109,95,101,113,117,97,108,86,101,114,116,101,120,84,104,114,101,115, 104,111,108,100,0,109,95,101,100,103,101,68,105,115,116,97,110,99,101,84, 104,114,101,115,104,111,108,100,0,109,95,122,101,114,111,65,114,101,97,84, 104,114,101,115,104,111,108,100,0,109,95,110,101,120,116,83,105,122,101,0, 109,95,104,97,115,104,84,97,98,108,101,83,105,122,101,0,109,95,110,117, 109,86,97,108,117,101,115,0,109,95,110,117,109,75,101,121,115,0,109,95, 103,105,109,112,97,99,116,83,117,98,84,121,112,101,0,42,109,95,117,110, 115,99,97,108,101,100,80,111,105,110,116,115,70,108,111,97,116,80,116,114, 0,42,109,95,117,110,115,99,97,108,101,100,80,111,105,110,116,115,68,111, 117,98,108,101,80,116,114,0,109,95,110,117,109,85,110,115,99,97,108,101, 100,80,111,105,110,116,115,0,109,95,112,97,100,100,105,110,103,51,91,52, 93,0,42,109,95,98,114,111,97,100,112,104,97,115,101,72,97,110,100,108, 101,0,42,109,95,99,111,108,108,105,115,105,111,110,83,104,97,112,101,0, 42,109,95,114,111,111,116,67,111,108,108,105,115,105,111,110,83,104,97,112, 101,0,109,95,119,111,114,108,100,84,114,97,110,115,102,111,114,109,0,109, 95,105,110,116,101,114,112,111,108,97,116,105,111,110,87,111,114,108,100,84, 114,97,110,115,102,111,114,109,0,109,95,105,110,116,101,114,112,111,108,97, 116,105,111,110,76,105,110,101,97,114,86,101,108,111,99,105,116,121,0,109, 95,105,110,116,101,114,112,111,108,97,116,105,111,110,65,110,103,117,108,97, 114,86,101,108,111,99,105,116,121,0,109,95,97,110,105,115,111,116,114,111, 112,105,99,70,114,105,99,116,105,111,110,0,109,95,99,111,110,116,97,99, 116,80,114,111,99,101,115,115,105,110,103,84,104,114,101,115,104,111,108,100, 0,109,95,100,101,97,99,116,105,118,97,116,105,111,110,84,105,109,101,0, 109,95,102,114,105,99,116,105,111,110,0,109,95,114,101,115,116,105,116,117, 116,105,111,110,0,109,95,104,105,116,70,114,97,99,116,105,111,110,0,109, 95,99,99,100,83,119,101,112,116,83,112,104,101,114,101,82,97,100,105,117, 115,0,109,95,99,99,100,77,111,116,105,111,110,84,104,114,101,115,104,111, 108,100,0,109,95,104,97,115,65,110,105,115,111,116,114,111,112,105,99,70, 114,105,99,116,105,111,110,0,109,95,99,111,108,108,105,115,105,111,110,70, 108,97,103,115,0,109,95,105,115,108,97,110,100,84,97,103,49,0,109,95, 99,111,109,112,97,110,105,111,110,73,100,0,109,95,97,99,116,105,118,97, 116,105,111,110,83,116,97,116,101,49,0,109,95,105,110,116,101,114,110,97, 108,84,121,112,101,0,109,95,99,104,101,99,107,67,111,108,108,105,100,101, 87,105,116,104,0,109,95,99,111,108,108,105,115,105,111,110,79,98,106,101, 99,116,68,97,116,97,0,109,95,105,110,118,73,110,101,114,116,105,97,84, 101,110,115,111,114,87,111,114,108,100,0,109,95,108,105,110,101,97,114,86, 101,108,111,99,105,116,121,0,109,95,97,110,103,117,108,97,114,86,101,108, 111,99,105,116,121,0,109,95,97,110,103,117,108,97,114,70,97,99,116,111, 114,0,109,95,108,105,110,101,97,114,70,97,99,116,111,114,0,109,95,103, 114,97,118,105,116,121,0,109,95,103,114,97,118,105,116,121,95,97,99,99, 101,108,101,114,97,116,105,111,110,0,109,95,105,110,118,73,110,101,114,116, 105,97,76,111,99,97,108,0,109,95,116,111,116,97,108,70,111,114,99,101, 0,109,95,116,111,116,97,108,84,111,114,113,117,101,0,109,95,105,110,118, 101,114,115,101,77,97,115,115,0,109,95,108,105,110,101,97,114,68,97,109, 112,105,110,103,0,109,95,97,110,103,117,108,97,114,68,97,109,112,105,110, 103,0,109,95,97,100,100,105,116,105,111,110,97,108,68,97,109,112,105,110, 103,70,97,99,116,111,114,0,109,95,97,100,100,105,116,105,111,110,97,108, 76,105,110,101,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111, 108,100,83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110, 103,117,108,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,108, 100,83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,103, 117,108,97,114,68,97,109,112,105,110,103,70,97,99,116,111,114,0,109,95, 108,105,110,101,97,114,83,108,101,101,112,105,110,103,84,104,114,101,115,104, 111,108,100,0,109,95,97,110,103,117,108,97,114,83,108,101,101,112,105,110, 103,84,104,114,101,115,104,111,108,100,0,109,95,97,100,100,105,116,105,111, 110,97,108,68,97,109,112,105,110,103,0,109,95,110,117,109,67,111,110,115, 116,114,97,105,110,116,82,111,119,115,0,110,117,98,0,42,109,95,114,98, 65,0,42,109,95,114,98,66,0,109,95,111,98,106,101,99,116,84,121,112, 101,0,109,95,117,115,101,114,67,111,110,115,116,114,97,105,110,116,84,121, 112,101,0,109,95,117,115,101,114,67,111,110,115,116,114,97,105,110,116,73, 100,0,109,95,110,101,101,100,115,70,101,101,100,98,97,99,107,0,109,95, 97,112,112,108,105,101,100,73,109,112,117,108,115,101,0,109,95,100,98,103, 68,114,97,119,83,105,122,101,0,109,95,100,105,115,97,98,108,101,67,111, 108,108,105,115,105,111,110,115,66,101,116,119,101,101,110,76,105,110,107,101, 100,66,111,100,105,101,115,0,109,95,112,97,100,52,91,52,93,0,109,95, 116,121,112,101,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,109, 95,112,105,118,111,116,73,110,65,0,109,95,112,105,118,111,116,73,110,66, 0,109,95,114,98,65,70,114,97,109,101,0,109,95,114,98,66,70,114,97, 109,101,0,109,95,117,115,101,82,101,102,101,114,101,110,99,101,70,114,97, 109,101,65,0,109,95,97,110,103,117,108,97,114,79,110,108,121,0,109,95, 101,110,97,98,108,101,65,110,103,117,108,97,114,77,111,116,111,114,0,109, 95,109,111,116,111,114,84,97,114,103,101,116,86,101,108,111,99,105,116,121, 0,109,95,109,97,120,77,111,116,111,114,73,109,112,117,108,115,101,0,109, 95,108,111,119,101,114,76,105,109,105,116,0,109,95,117,112,112,101,114,76, 105,109,105,116,0,109,95,108,105,109,105,116,83,111,102,116,110,101,115,115, 0,109,95,98,105,97,115,70,97,99,116,111,114,0,109,95,114,101,108,97, 120,97,116,105,111,110,70,97,99,116,111,114,0,109,95,115,119,105,110,103, 83,112,97,110,49,0,109,95,115,119,105,110,103,83,112,97,110,50,0,109, 95,116,119,105,115,116,83,112,97,110,0,109,95,100,97,109,112,105,110,103, 0,109,95,108,105,110,101,97,114,85,112,112,101,114,76,105,109,105,116,0, 109,95,108,105,110,101,97,114,76,111,119,101,114,76,105,109,105,116,0,109, 95,97,110,103,117,108,97,114,85,112,112,101,114,76,105,109,105,116,0,109, 95,97,110,103,117,108,97,114,76,111,119,101,114,76,105,109,105,116,0,109, 95,117,115,101,76,105,110,101,97,114,82,101,102,101,114,101,110,99,101,70, 114,97,109,101,65,0,109,95,117,115,101,79,102,102,115,101,116,70,111,114, 67,111,110,115,116,114,97,105,110,116,70,114,97,109,101,0,84,89,80,69, 58,0,0,0,99,104,97,114,0,117,99,104,97,114,0,115,104,111,114,116, 0,117,115,104,111,114,116,0,105,110,116,0,108,111,110,103,0,117,108,111, 110,103,0,102,108,111,97,116,0,100,111,117,98,108,101,0,118,111,105,100, 0,80,111,105,110,116,101,114,65,114,114,97,121,0,98,116,80,104,121,115, 105,99,115,83,121,115,116,101,109,0,76,105,115,116,66,97,115,101,0,98, 116,86,101,99,116,111,114,51,70,108,111,97,116,68,97,116,97,0,98,116, 86,101,99,116,111,114,51,68,111,117,98,108,101,68,97,116,97,0,98,116, 77,97,116,114,105,120,51,120,51,70,108,111,97,116,68,97,116,97,0,98, 116,77,97,116,114,105,120,51,120,51,68,111,117,98,108,101,68,97,116,97, 0,98,116,84,114,97,110,115,102,111,114,109,70,108,111,97,116,68,97,116, 97,0,98,116,84,114,97,110,115,102,111,114,109,68,111,117,98,108,101,68, 97,116,97,0,98,116,66,118,104,83,117,98,116,114,101,101,73,110,102,111, 68,97,116,97,0,98,116,79,112,116,105,109,105,122,101,100,66,118,104,78, 111,100,101,70,108,111,97,116,68,97,116,97,0,98,116,79,112,116,105,109, 105,122,101,100,66,118,104,78,111,100,101,68,111,117,98,108,101,68,97,116, 97,0,98,116,81,117,97,110,116,105,122,101,100,66,118,104,78,111,100,101, 68,97,116,97,0,98,116,81,117,97,110,116,105,122,101,100,66,118,104,70, 108,111,97,116,68,97,116,97,0,98,116,81,117,97,110,116,105,122,101,100, 66,118,104,68,111,117,98,108,101,68,97,116,97,0,98,116,67,111,108,108, 105,115,105,111,110,83,104,97,112,101,68,97,116,97,0,98,116,83,116,97, 116,105,99,80,108,97,110,101,83,104,97,112,101,68,97,116,97,0,98,116, 67,111,110,118,101,120,73,110,116,101,114,110,97,108,83,104,97,112,101,68, 97,116,97,0,98,116,80,111,115,105,116,105,111,110,65,110,100,82,97,100, 105,117,115,0,98,116,77,117,108,116,105,83,112,104,101,114,101,83,104,97, 112,101,68,97,116,97,0,98,116,73,110,116,73,110,100,101,120,68,97,116, 97,0,98,116,83,104,111,114,116,73,110,116,73,110,100,101,120,68,97,116, 97,0,98,116,83,104,111,114,116,73,110,116,73,110,100,101,120,84,114,105, 112,108,101,116,68,97,116,97,0,98,116,77,101,115,104,80,97,114,116,68, 97,116,97,0,98,116,83,116,114,105,100,105,110,103,77,101,115,104,73,110, 116,101,114,102,97,99,101,68,97,116,97,0,98,116,84,114,105,97,110,103, 108,101,77,101,115,104,83,104,97,112,101,68,97,116,97,0,98,116,84,114, 105,97,110,103,108,101,73,110,102,111,77,97,112,68,97,116,97,0,98,116, 67,111,109,112,111,117,110,100,83,104,97,112,101,67,104,105,108,100,68,97, 116,97,0,98,116,67,111,109,112,111,117,110,100,83,104,97,112,101,68,97, 116,97,0,98,116,67,121,108,105,110,100,101,114,83,104,97,112,101,68,97, 116,97,0,98,116,67,97,112,115,117,108,101,83,104,97,112,101,68,97,116, 97,0,98,116,84,114,105,97,110,103,108,101,73,110,102,111,68,97,116,97, 0,98,116,71,73,109,112,97,99,116,77,101,115,104,83,104,97,112,101,68, 97,116,97,0,98,116,67,111,110,118,101,120,72,117,108,108,83,104,97,112, 101,68,97,116,97,0,98,116,67,111,108,108,105,115,105,111,110,79,98,106, 101,99,116,68,111,117,98,108,101,68,97,116,97,0,98,116,67,111,108,108, 105,115,105,111,110,79,98,106,101,99,116,70,108,111,97,116,68,97,116,97, 0,98,116,82,105,103,105,100,66,111,100,121,70,108,111,97,116,68,97,116, 97,0,98,116,82,105,103,105,100,66,111,100,121,68,111,117,98,108,101,68, 97,116,97,0,98,116,67,111,110,115,116,114,97,105,110,116,73,110,102,111, 49,0,98,116,84,121,112,101,100,67,111,110,115,116,114,97,105,110,116,68, 97,116,97,0,98,116,82,105,103,105,100,66,111,100,121,68,97,116,97,0, 98,116,80,111,105,110,116,50,80,111,105,110,116,67,111,110,115,116,114,97, 105,110,116,70,108,111,97,116,68,97,116,97,0,98,116,80,111,105,110,116, 50,80,111,105,110,116,67,111,110,115,116,114,97,105,110,116,68,111,117,98, 108,101,68,97,116,97,0,98,116,72,105,110,103,101,67,111,110,115,116,114, 97,105,110,116,68,111,117,98,108,101,68,97,116,97,0,98,116,72,105,110, 103,101,67,111,110,115,116,114,97,105,110,116,70,108,111,97,116,68,97,116, 97,0,98,116,67,111,110,101,84,119,105,115,116,67,111,110,115,116,114,97, 105,110,116,68,97,116,97,0,98,116,71,101,110,101,114,105,99,54,68,111, 102,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,98,116,83,108, 105,100,101,114,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,0, 84,76,69,78,1,0,1,0,2,0,2,0,4,0,4,0,4,0,4,0, 8,0,0,0,16,0,48,0,16,0,16,0,32,0,48,0,96,0,64,0, -128,0,20,0,48,0,80,0,16,0,96,0,-112,0,16,0,56,0,56,0, 20,0,72,0,4,0,4,0,8,0,48,0,32,0,80,0,72,0,80,0, 32,0,64,0,64,0,16,0,72,0,80,0,-40,1,8,1,-16,1,-88,3, 8,0,56,0,0,0,88,0,120,0,96,1,-32,0,-40,0,0,1,-48,0, 83,84,82,67,47,0,0,0,10,0,3,0,4,0,0,0,4,0,1,0, 9,0,2,0,11,0,3,0,10,0,3,0,10,0,4,0,10,0,5,0, 12,0,2,0,9,0,6,0,9,0,7,0,13,0,1,0,7,0,8,0, 14,0,1,0,8,0,8,0,15,0,1,0,13,0,9,0,16,0,1,0, 14,0,9,0,17,0,2,0,15,0,10,0,13,0,11,0,18,0,2,0, 16,0,10,0,14,0,11,0,19,0,4,0,4,0,12,0,4,0,13,0, 2,0,14,0,2,0,15,0,20,0,6,0,13,0,16,0,13,0,17,0, 4,0,18,0,4,0,19,0,4,0,20,0,0,0,21,0,21,0,6,0, 14,0,16,0,14,0,17,0,4,0,18,0,4,0,19,0,4,0,20,0, 0,0,21,0,22,0,3,0,2,0,14,0,2,0,15,0,4,0,22,0, 23,0,12,0,13,0,23,0,13,0,24,0,13,0,25,0,4,0,26,0, 4,0,27,0,4,0,28,0,4,0,29,0,20,0,30,0,22,0,31,0, 19,0,32,0,4,0,33,0,4,0,34,0,24,0,12,0,14,0,23,0, 14,0,24,0,14,0,25,0,4,0,26,0,4,0,27,0,4,0,28,0, 4,0,29,0,21,0,30,0,22,0,31,0,4,0,33,0,4,0,34,0, 19,0,32,0,25,0,3,0,0,0,35,0,4,0,36,0,0,0,37,0, 26,0,5,0,25,0,38,0,13,0,39,0,13,0,40,0,7,0,41,0, 0,0,21,0,27,0,5,0,25,0,38,0,13,0,39,0,13,0,42,0, 7,0,43,0,4,0,44,0,28,0,2,0,13,0,45,0,7,0,46,0, 29,0,4,0,27,0,47,0,28,0,48,0,4,0,49,0,0,0,37,0, 30,0,1,0,4,0,50,0,31,0,2,0,2,0,50,0,0,0,51,0, 32,0,2,0,2,0,52,0,0,0,51,0,33,0,7,0,13,0,53,0, 14,0,54,0,30,0,55,0,32,0,56,0,31,0,57,0,4,0,58,0, 4,0,59,0,34,0,4,0,33,0,60,0,13,0,61,0,4,0,62,0, 0,0,37,0,35,0,7,0,25,0,38,0,34,0,63,0,23,0,64,0, 24,0,65,0,36,0,66,0,7,0,43,0,0,0,67,0,37,0,4,0, 17,0,68,0,25,0,69,0,4,0,70,0,7,0,71,0,38,0,4,0, 25,0,38,0,37,0,72,0,4,0,73,0,7,0,43,0,39,0,3,0, 27,0,47,0,4,0,74,0,0,0,37,0,40,0,3,0,27,0,47,0, 4,0,74,0,0,0,37,0,41,0,4,0,4,0,75,0,7,0,76,0, 7,0,77,0,7,0,78,0,36,0,14,0,4,0,79,0,4,0,80,0, 41,0,81,0,4,0,82,0,7,0,83,0,7,0,84,0,7,0,85,0, 7,0,86,0,7,0,87,0,4,0,88,0,4,0,89,0,4,0,90,0, 4,0,91,0,0,0,37,0,42,0,5,0,25,0,38,0,34,0,63,0, 13,0,39,0,7,0,43,0,4,0,92,0,43,0,5,0,27,0,47,0, 13,0,93,0,14,0,94,0,4,0,95,0,0,0,96,0,44,0,24,0, 9,0,97,0,9,0,98,0,25,0,99,0,0,0,35,0,18,0,100,0, 18,0,101,0,14,0,102,0,14,0,103,0,14,0,104,0,8,0,105,0, 8,0,106,0,8,0,107,0,8,0,108,0,8,0,109,0,8,0,110,0, 8,0,111,0,4,0,112,0,4,0,113,0,4,0,114,0,4,0,115,0, 4,0,116,0,4,0,117,0,4,0,118,0,0,0,37,0,45,0,23,0, 9,0,97,0,9,0,98,0,25,0,99,0,0,0,35,0,17,0,100,0, 17,0,101,0,13,0,102,0,13,0,103,0,13,0,104,0,7,0,105,0, 7,0,106,0,7,0,107,0,7,0,108,0,7,0,109,0,7,0,110,0, 7,0,111,0,4,0,112,0,4,0,113,0,4,0,114,0,4,0,115,0, 4,0,116,0,4,0,117,0,4,0,118,0,46,0,21,0,45,0,119,0, 15,0,120,0,13,0,121,0,13,0,122,0,13,0,123,0,13,0,124,0, 13,0,125,0,13,0,126,0,13,0,127,0,13,0,-128,0,13,0,-127,0, 7,0,-126,0,7,0,-125,0,7,0,-124,0,7,0,-123,0,7,0,-122,0, 7,0,-121,0,7,0,-120,0,7,0,-119,0,7,0,-118,0,4,0,-117,0, 47,0,22,0,44,0,119,0,16,0,120,0,14,0,121,0,14,0,122,0, 14,0,123,0,14,0,124,0,14,0,125,0,14,0,126,0,14,0,127,0, 14,0,-128,0,14,0,-127,0,8,0,-126,0,8,0,-125,0,8,0,-124,0, 8,0,-123,0,8,0,-122,0,8,0,-121,0,8,0,-120,0,8,0,-119,0, 8,0,-118,0,4,0,-117,0,0,0,37,0,48,0,2,0,4,0,-116,0, 4,0,-115,0,49,0,11,0,50,0,-114,0,50,0,-113,0,0,0,35,0, 4,0,-112,0,4,0,-111,0,4,0,-110,0,4,0,-109,0,7,0,-108,0, 7,0,-107,0,4,0,-106,0,0,0,-105,0,51,0,3,0,49,0,-104,0, 13,0,-103,0,13,0,-102,0,52,0,3,0,49,0,-104,0,14,0,-103,0, 14,0,-102,0,53,0,13,0,49,0,-104,0,18,0,-101,0,18,0,-100,0, 4,0,-99,0,4,0,-98,0,4,0,-97,0,7,0,-96,0,7,0,-95,0, 7,0,-94,0,7,0,-93,0,7,0,-92,0,7,0,-91,0,7,0,-90,0, 54,0,13,0,49,0,-104,0,17,0,-101,0,17,0,-100,0,4,0,-99,0, 4,0,-98,0,4,0,-97,0,7,0,-96,0,7,0,-95,0,7,0,-94,0, 7,0,-93,0,7,0,-92,0,7,0,-91,0,7,0,-90,0,55,0,11,0, 49,0,-104,0,17,0,-101,0,17,0,-100,0,7,0,-89,0,7,0,-88,0, 7,0,-87,0,7,0,-92,0,7,0,-91,0,7,0,-90,0,7,0,-86,0, 0,0,21,0,56,0,9,0,49,0,-104,0,17,0,-101,0,17,0,-100,0, 13,0,-85,0,13,0,-84,0,13,0,-83,0,13,0,-82,0,4,0,-81,0, 4,0,-80,0,57,0,9,0,49,0,-104,0,17,0,-101,0,17,0,-100,0, 7,0,-85,0,7,0,-84,0,7,0,-83,0,7,0,-82,0,4,0,-81,0, 4,0,-80,0,}; int sBulletDNAlen64= sizeof(sBulletDNAstr64); unsigned char sBulletDNAstr[]= { 83,68,78,65,78,65,77,69,-79,0,0,0,109,95,115,105,122,101,0,109, 95,99,97,112,97,99,105,116,121,0,42,109,95,100,97,116,97,0,109,95, 99,111,108,108,105,115,105,111,110,83,104,97,112,101,115,0,109,95,99,111, 108,108,105,115,105,111,110,79,98,106,101,99,116,115,0,109,95,99,111,110, 115,116,114,97,105,110,116,115,0,42,102,105,114,115,116,0,42,108,97,115, 116,0,109,95,102,108,111,97,116,115,91,52,93,0,109,95,101,108,91,51, 93,0,109,95,98,97,115,105,115,0,109,95,111,114,105,103,105,110,0,109, 95,114,111,111,116,78,111,100,101,73,110,100,101,120,0,109,95,115,117,98, 116,114,101,101,83,105,122,101,0,109,95,113,117,97,110,116,105,122,101,100, 65,97,98,98,77,105,110,91,51,93,0,109,95,113,117,97,110,116,105,122, 101,100,65,97,98,98,77,97,120,91,51,93,0,109,95,97,97,98,98,77, 105,110,79,114,103,0,109,95,97,97,98,98,77,97,120,79,114,103,0,109, 95,101,115,99,97,112,101,73,110,100,101,120,0,109,95,115,117,98,80,97, 114,116,0,109,95,116,114,105,97,110,103,108,101,73,110,100,101,120,0,109, 95,112,97,100,91,52,93,0,109,95,101,115,99,97,112,101,73,110,100,101, 120,79,114,84,114,105,97,110,103,108,101,73,110,100,101,120,0,109,95,98, 118,104,65,97,98,98,77,105,110,0,109,95,98,118,104,65,97,98,98,77, 97,120,0,109,95,98,118,104,81,117,97,110,116,105,122,97,116,105,111,110, 0,109,95,99,117,114,78,111,100,101,73,110,100,101,120,0,109,95,117,115, 101,81,117,97,110,116,105,122,97,116,105,111,110,0,109,95,110,117,109,67, 111,110,116,105,103,117,111,117,115,76,101,97,102,78,111,100,101,115,0,109, 95,110,117,109,81,117,97,110,116,105,122,101,100,67,111,110,116,105,103,117, 111,117,115,78,111,100,101,115,0,42,109,95,99,111,110,116,105,103,117,111, 117,115,78,111,100,101,115,80,116,114,0,42,109,95,113,117,97,110,116,105, 122,101,100,67,111,110,116,105,103,117,111,117,115,78,111,100,101,115,80,116, 114,0,42,109,95,115,117,98,84,114,101,101,73,110,102,111,80,116,114,0, 109,95,116,114,97,118,101,114,115,97,108,77,111,100,101,0,109,95,110,117, 109,83,117,98,116,114,101,101,72,101,97,100,101,114,115,0,42,109,95,110, 97,109,101,0,109,95,115,104,97,112,101,84,121,112,101,0,109,95,112,97, 100,100,105,110,103,91,52,93,0,109,95,99,111,108,108,105,115,105,111,110, 83,104,97,112,101,68,97,116,97,0,109,95,108,111,99,97,108,83,99,97, 108,105,110,103,0,109,95,112,108,97,110,101,78,111,114,109,97,108,0,109, 95,112,108,97,110,101,67,111,110,115,116,97,110,116,0,109,95,105,109,112, 108,105,99,105,116,83,104,97,112,101,68,105,109,101,110,115,105,111,110,115, 0,109,95,99,111,108,108,105,115,105,111,110,77,97,114,103,105,110,0,109, 95,112,97,100,100,105,110,103,0,109,95,112,111,115,0,109,95,114,97,100, 105,117,115,0,109,95,99,111,110,118,101,120,73,110,116,101,114,110,97,108, 83,104,97,112,101,68,97,116,97,0,42,109,95,108,111,99,97,108,80,111, 115,105,116,105,111,110,65,114,114,97,121,80,116,114,0,109,95,108,111,99, 97,108,80,111,115,105,116,105,111,110,65,114,114,97,121,83,105,122,101,0, 109,95,118,97,108,117,101,0,109,95,112,97,100,91,50,93,0,109,95,118, 97,108,117,101,115,91,51,93,0,42,109,95,118,101,114,116,105,99,101,115, 51,102,0,42,109,95,118,101,114,116,105,99,101,115,51,100,0,42,109,95, 105,110,100,105,99,101,115,51,50,0,42,109,95,51,105,110,100,105,99,101, 115,49,54,0,42,109,95,105,110,100,105,99,101,115,49,54,0,109,95,110, 117,109,84,114,105,97,110,103,108,101,115,0,109,95,110,117,109,86,101,114, 116,105,99,101,115,0,42,109,95,109,101,115,104,80,97,114,116,115,80,116, 114,0,109,95,115,99,97,108,105,110,103,0,109,95,110,117,109,77,101,115, 104,80,97,114,116,115,0,109,95,109,101,115,104,73,110,116,101,114,102,97, 99,101,0,42,109,95,113,117,97,110,116,105,122,101,100,70,108,111,97,116, 66,118,104,0,42,109,95,113,117,97,110,116,105,122,101,100,68,111,117,98, 108,101,66,118,104,0,42,109,95,116,114,105,97,110,103,108,101,73,110,102, 111,77,97,112,0,109,95,112,97,100,51,91,52,93,0,109,95,116,114,97, 110,115,102,111,114,109,0,42,109,95,99,104,105,108,100,83,104,97,112,101, 0,109,95,99,104,105,108,100,83,104,97,112,101,84,121,112,101,0,109,95, 99,104,105,108,100,77,97,114,103,105,110,0,42,109,95,99,104,105,108,100, 83,104,97,112,101,80,116,114,0,109,95,110,117,109,67,104,105,108,100,83, 104,97,112,101,115,0,109,95,117,112,65,120,105,115,0,109,95,102,108,97, 103,115,0,109,95,101,100,103,101,86,48,86,49,65,110,103,108,101,0,109, 95,101,100,103,101,86,49,86,50,65,110,103,108,101,0,109,95,101,100,103, 101,86,50,86,48,65,110,103,108,101,0,42,109,95,104,97,115,104,84,97, 98,108,101,80,116,114,0,42,109,95,110,101,120,116,80,116,114,0,42,109, 95,118,97,108,117,101,65,114,114,97,121,80,116,114,0,42,109,95,107,101, 121,65,114,114,97,121,80,116,114,0,109,95,99,111,110,118,101,120,69,112, 115,105,108,111,110,0,109,95,112,108,97,110,97,114,69,112,115,105,108,111, 110,0,109,95,101,113,117,97,108,86,101,114,116,101,120,84,104,114,101,115, 104,111,108,100,0,109,95,101,100,103,101,68,105,115,116,97,110,99,101,84, 104,114,101,115,104,111,108,100,0,109,95,122,101,114,111,65,114,101,97,84, 104,114,101,115,104,111,108,100,0,109,95,110,101,120,116,83,105,122,101,0, 109,95,104,97,115,104,84,97,98,108,101,83,105,122,101,0,109,95,110,117, 109,86,97,108,117,101,115,0,109,95,110,117,109,75,101,121,115,0,109,95, 103,105,109,112,97,99,116,83,117,98,84,121,112,101,0,42,109,95,117,110, 115,99,97,108,101,100,80,111,105,110,116,115,70,108,111,97,116,80,116,114, 0,42,109,95,117,110,115,99,97,108,101,100,80,111,105,110,116,115,68,111, 117,98,108,101,80,116,114,0,109,95,110,117,109,85,110,115,99,97,108,101, 100,80,111,105,110,116,115,0,109,95,112,97,100,100,105,110,103,51,91,52, 93,0,42,109,95,98,114,111,97,100,112,104,97,115,101,72,97,110,100,108, 101,0,42,109,95,99,111,108,108,105,115,105,111,110,83,104,97,112,101,0, 42,109,95,114,111,111,116,67,111,108,108,105,115,105,111,110,83,104,97,112, 101,0,109,95,119,111,114,108,100,84,114,97,110,115,102,111,114,109,0,109, 95,105,110,116,101,114,112,111,108,97,116,105,111,110,87,111,114,108,100,84, 114,97,110,115,102,111,114,109,0,109,95,105,110,116,101,114,112,111,108,97, 116,105,111,110,76,105,110,101,97,114,86,101,108,111,99,105,116,121,0,109, 95,105,110,116,101,114,112,111,108,97,116,105,111,110,65,110,103,117,108,97, 114,86,101,108,111,99,105,116,121,0,109,95,97,110,105,115,111,116,114,111, 112,105,99,70,114,105,99,116,105,111,110,0,109,95,99,111,110,116,97,99, 116,80,114,111,99,101,115,115,105,110,103,84,104,114,101,115,104,111,108,100, 0,109,95,100,101,97,99,116,105,118,97,116,105,111,110,84,105,109,101,0, 109,95,102,114,105,99,116,105,111,110,0,109,95,114,101,115,116,105,116,117, 116,105,111,110,0,109,95,104,105,116,70,114,97,99,116,105,111,110,0,109, 95,99,99,100,83,119,101,112,116,83,112,104,101,114,101,82,97,100,105,117, 115,0,109,95,99,99,100,77,111,116,105,111,110,84,104,114,101,115,104,111, 108,100,0,109,95,104,97,115,65,110,105,115,111,116,114,111,112,105,99,70, 114,105,99,116,105,111,110,0,109,95,99,111,108,108,105,115,105,111,110,70, 108,97,103,115,0,109,95,105,115,108,97,110,100,84,97,103,49,0,109,95, 99,111,109,112,97,110,105,111,110,73,100,0,109,95,97,99,116,105,118,97, 116,105,111,110,83,116,97,116,101,49,0,109,95,105,110,116,101,114,110,97, 108,84,121,112,101,0,109,95,99,104,101,99,107,67,111,108,108,105,100,101, 87,105,116,104,0,109,95,99,111,108,108,105,115,105,111,110,79,98,106,101, 99,116,68,97,116,97,0,109,95,105,110,118,73,110,101,114,116,105,97,84, 101,110,115,111,114,87,111,114,108,100,0,109,95,108,105,110,101,97,114,86, 101,108,111,99,105,116,121,0,109,95,97,110,103,117,108,97,114,86,101,108, 111,99,105,116,121,0,109,95,97,110,103,117,108,97,114,70,97,99,116,111, 114,0,109,95,108,105,110,101,97,114,70,97,99,116,111,114,0,109,95,103, 114,97,118,105,116,121,0,109,95,103,114,97,118,105,116,121,95,97,99,99, 101,108,101,114,97,116,105,111,110,0,109,95,105,110,118,73,110,101,114,116, 105,97,76,111,99,97,108,0,109,95,116,111,116,97,108,70,111,114,99,101, 0,109,95,116,111,116,97,108,84,111,114,113,117,101,0,109,95,105,110,118, 101,114,115,101,77,97,115,115,0,109,95,108,105,110,101,97,114,68,97,109, 112,105,110,103,0,109,95,97,110,103,117,108,97,114,68,97,109,112,105,110, 103,0,109,95,97,100,100,105,116,105,111,110,97,108,68,97,109,112,105,110, 103,70,97,99,116,111,114,0,109,95,97,100,100,105,116,105,111,110,97,108, 76,105,110,101,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111, 108,100,83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110, 103,117,108,97,114,68,97,109,112,105,110,103,84,104,114,101,115,104,111,108, 100,83,113,114,0,109,95,97,100,100,105,116,105,111,110,97,108,65,110,103, 117,108,97,114,68,97,109,112,105,110,103,70,97,99,116,111,114,0,109,95, 108,105,110,101,97,114,83,108,101,101,112,105,110,103,84,104,114,101,115,104, 111,108,100,0,109,95,97,110,103,117,108,97,114,83,108,101,101,112,105,110, 103,84,104,114,101,115,104,111,108,100,0,109,95,97,100,100,105,116,105,111, 110,97,108,68,97,109,112,105,110,103,0,109,95,110,117,109,67,111,110,115, 116,114,97,105,110,116,82,111,119,115,0,110,117,98,0,42,109,95,114,98, 65,0,42,109,95,114,98,66,0,109,95,111,98,106,101,99,116,84,121,112, 101,0,109,95,117,115,101,114,67,111,110,115,116,114,97,105,110,116,84,121, 112,101,0,109,95,117,115,101,114,67,111,110,115,116,114,97,105,110,116,73, 100,0,109,95,110,101,101,100,115,70,101,101,100,98,97,99,107,0,109,95, 97,112,112,108,105,101,100,73,109,112,117,108,115,101,0,109,95,100,98,103, 68,114,97,119,83,105,122,101,0,109,95,100,105,115,97,98,108,101,67,111, 108,108,105,115,105,111,110,115,66,101,116,119,101,101,110,76,105,110,107,101, 100,66,111,100,105,101,115,0,109,95,112,97,100,52,91,52,93,0,109,95, 116,121,112,101,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,109, 95,112,105,118,111,116,73,110,65,0,109,95,112,105,118,111,116,73,110,66, 0,109,95,114,98,65,70,114,97,109,101,0,109,95,114,98,66,70,114,97, 109,101,0,109,95,117,115,101,82,101,102,101,114,101,110,99,101,70,114,97, 109,101,65,0,109,95,97,110,103,117,108,97,114,79,110,108,121,0,109,95, 101,110,97,98,108,101,65,110,103,117,108,97,114,77,111,116,111,114,0,109, 95,109,111,116,111,114,84,97,114,103,101,116,86,101,108,111,99,105,116,121, 0,109,95,109,97,120,77,111,116,111,114,73,109,112,117,108,115,101,0,109, 95,108,111,119,101,114,76,105,109,105,116,0,109,95,117,112,112,101,114,76, 105,109,105,116,0,109,95,108,105,109,105,116,83,111,102,116,110,101,115,115, 0,109,95,98,105,97,115,70,97,99,116,111,114,0,109,95,114,101,108,97, 120,97,116,105,111,110,70,97,99,116,111,114,0,109,95,115,119,105,110,103, 83,112,97,110,49,0,109,95,115,119,105,110,103,83,112,97,110,50,0,109, 95,116,119,105,115,116,83,112,97,110,0,109,95,100,97,109,112,105,110,103, 0,109,95,108,105,110,101,97,114,85,112,112,101,114,76,105,109,105,116,0, 109,95,108,105,110,101,97,114,76,111,119,101,114,76,105,109,105,116,0,109, 95,97,110,103,117,108,97,114,85,112,112,101,114,76,105,109,105,116,0,109, 95,97,110,103,117,108,97,114,76,111,119,101,114,76,105,109,105,116,0,109, 95,117,115,101,76,105,110,101,97,114,82,101,102,101,114,101,110,99,101,70, 114,97,109,101,65,0,109,95,117,115,101,79,102,102,115,101,116,70,111,114, 67,111,110,115,116,114,97,105,110,116,70,114,97,109,101,0,84,89,80,69, 58,0,0,0,99,104,97,114,0,117,99,104,97,114,0,115,104,111,114,116, 0,117,115,104,111,114,116,0,105,110,116,0,108,111,110,103,0,117,108,111, 110,103,0,102,108,111,97,116,0,100,111,117,98,108,101,0,118,111,105,100, 0,80,111,105,110,116,101,114,65,114,114,97,121,0,98,116,80,104,121,115, 105,99,115,83,121,115,116,101,109,0,76,105,115,116,66,97,115,101,0,98, 116,86,101,99,116,111,114,51,70,108,111,97,116,68,97,116,97,0,98,116, 86,101,99,116,111,114,51,68,111,117,98,108,101,68,97,116,97,0,98,116, 77,97,116,114,105,120,51,120,51,70,108,111,97,116,68,97,116,97,0,98, 116,77,97,116,114,105,120,51,120,51,68,111,117,98,108,101,68,97,116,97, 0,98,116,84,114,97,110,115,102,111,114,109,70,108,111,97,116,68,97,116, 97,0,98,116,84,114,97,110,115,102,111,114,109,68,111,117,98,108,101,68, 97,116,97,0,98,116,66,118,104,83,117,98,116,114,101,101,73,110,102,111, 68,97,116,97,0,98,116,79,112,116,105,109,105,122,101,100,66,118,104,78, 111,100,101,70,108,111,97,116,68,97,116,97,0,98,116,79,112,116,105,109, 105,122,101,100,66,118,104,78,111,100,101,68,111,117,98,108,101,68,97,116, 97,0,98,116,81,117,97,110,116,105,122,101,100,66,118,104,78,111,100,101, 68,97,116,97,0,98,116,81,117,97,110,116,105,122,101,100,66,118,104,70, 108,111,97,116,68,97,116,97,0,98,116,81,117,97,110,116,105,122,101,100, 66,118,104,68,111,117,98,108,101,68,97,116,97,0,98,116,67,111,108,108, 105,115,105,111,110,83,104,97,112,101,68,97,116,97,0,98,116,83,116,97, 116,105,99,80,108,97,110,101,83,104,97,112,101,68,97,116,97,0,98,116, 67,111,110,118,101,120,73,110,116,101,114,110,97,108,83,104,97,112,101,68, 97,116,97,0,98,116,80,111,115,105,116,105,111,110,65,110,100,82,97,100, 105,117,115,0,98,116,77,117,108,116,105,83,112,104,101,114,101,83,104,97, 112,101,68,97,116,97,0,98,116,73,110,116,73,110,100,101,120,68,97,116, 97,0,98,116,83,104,111,114,116,73,110,116,73,110,100,101,120,68,97,116, 97,0,98,116,83,104,111,114,116,73,110,116,73,110,100,101,120,84,114,105, 112,108,101,116,68,97,116,97,0,98,116,77,101,115,104,80,97,114,116,68, 97,116,97,0,98,116,83,116,114,105,100,105,110,103,77,101,115,104,73,110, 116,101,114,102,97,99,101,68,97,116,97,0,98,116,84,114,105,97,110,103, 108,101,77,101,115,104,83,104,97,112,101,68,97,116,97,0,98,116,84,114, 105,97,110,103,108,101,73,110,102,111,77,97,112,68,97,116,97,0,98,116, 67,111,109,112,111,117,110,100,83,104,97,112,101,67,104,105,108,100,68,97, 116,97,0,98,116,67,111,109,112,111,117,110,100,83,104,97,112,101,68,97, 116,97,0,98,116,67,121,108,105,110,100,101,114,83,104,97,112,101,68,97, 116,97,0,98,116,67,97,112,115,117,108,101,83,104,97,112,101,68,97,116, 97,0,98,116,84,114,105,97,110,103,108,101,73,110,102,111,68,97,116,97, 0,98,116,71,73,109,112,97,99,116,77,101,115,104,83,104,97,112,101,68, 97,116,97,0,98,116,67,111,110,118,101,120,72,117,108,108,83,104,97,112, 101,68,97,116,97,0,98,116,67,111,108,108,105,115,105,111,110,79,98,106, 101,99,116,68,111,117,98,108,101,68,97,116,97,0,98,116,67,111,108,108, 105,115,105,111,110,79,98,106,101,99,116,70,108,111,97,116,68,97,116,97, 0,98,116,82,105,103,105,100,66,111,100,121,70,108,111,97,116,68,97,116, 97,0,98,116,82,105,103,105,100,66,111,100,121,68,111,117,98,108,101,68, 97,116,97,0,98,116,67,111,110,115,116,114,97,105,110,116,73,110,102,111, 49,0,98,116,84,121,112,101,100,67,111,110,115,116,114,97,105,110,116,68, 97,116,97,0,98,116,82,105,103,105,100,66,111,100,121,68,97,116,97,0, 98,116,80,111,105,110,116,50,80,111,105,110,116,67,111,110,115,116,114,97, 105,110,116,70,108,111,97,116,68,97,116,97,0,98,116,80,111,105,110,116, 50,80,111,105,110,116,67,111,110,115,116,114,97,105,110,116,68,111,117,98, 108,101,68,97,116,97,0,98,116,72,105,110,103,101,67,111,110,115,116,114, 97,105,110,116,68,111,117,98,108,101,68,97,116,97,0,98,116,72,105,110, 103,101,67,111,110,115,116,114,97,105,110,116,70,108,111,97,116,68,97,116, 97,0,98,116,67,111,110,101,84,119,105,115,116,67,111,110,115,116,114,97, 105,110,116,68,97,116,97,0,98,116,71,101,110,101,114,105,99,54,68,111, 102,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,98,116,83,108, 105,100,101,114,67,111,110,115,116,114,97,105,110,116,68,97,116,97,0,0, 84,76,69,78,1,0,1,0,2,0,2,0,4,0,4,0,4,0,4,0, 8,0,0,0,12,0,36,0,8,0,16,0,32,0,48,0,96,0,64,0, -128,0,20,0,48,0,80,0,16,0,84,0,-124,0,12,0,52,0,52,0, 20,0,64,0,4,0,4,0,8,0,28,0,28,0,60,0,56,0,76,0, 24,0,60,0,60,0,16,0,64,0,68,0,-56,1,-8,0,-32,1,-104,3, 8,0,44,0,0,0,76,0,108,0,84,1,-44,0,-52,0,-12,0,-60,0, 83,84,82,67,47,0,0,0,10,0,3,0,4,0,0,0,4,0,1,0, 9,0,2,0,11,0,3,0,10,0,3,0,10,0,4,0,10,0,5,0, 12,0,2,0,9,0,6,0,9,0,7,0,13,0,1,0,7,0,8,0, 14,0,1,0,8,0,8,0,15,0,1,0,13,0,9,0,16,0,1,0, 14,0,9,0,17,0,2,0,15,0,10,0,13,0,11,0,18,0,2,0, 16,0,10,0,14,0,11,0,19,0,4,0,4,0,12,0,4,0,13,0, 2,0,14,0,2,0,15,0,20,0,6,0,13,0,16,0,13,0,17,0, 4,0,18,0,4,0,19,0,4,0,20,0,0,0,21,0,21,0,6,0, 14,0,16,0,14,0,17,0,4,0,18,0,4,0,19,0,4,0,20,0, 0,0,21,0,22,0,3,0,2,0,14,0,2,0,15,0,4,0,22,0, 23,0,12,0,13,0,23,0,13,0,24,0,13,0,25,0,4,0,26,0, 4,0,27,0,4,0,28,0,4,0,29,0,20,0,30,0,22,0,31,0, 19,0,32,0,4,0,33,0,4,0,34,0,24,0,12,0,14,0,23,0, 14,0,24,0,14,0,25,0,4,0,26,0,4,0,27,0,4,0,28,0, 4,0,29,0,21,0,30,0,22,0,31,0,4,0,33,0,4,0,34,0, 19,0,32,0,25,0,3,0,0,0,35,0,4,0,36,0,0,0,37,0, 26,0,5,0,25,0,38,0,13,0,39,0,13,0,40,0,7,0,41,0, 0,0,21,0,27,0,5,0,25,0,38,0,13,0,39,0,13,0,42,0, 7,0,43,0,4,0,44,0,28,0,2,0,13,0,45,0,7,0,46,0, 29,0,4,0,27,0,47,0,28,0,48,0,4,0,49,0,0,0,37,0, 30,0,1,0,4,0,50,0,31,0,2,0,2,0,50,0,0,0,51,0, 32,0,2,0,2,0,52,0,0,0,51,0,33,0,7,0,13,0,53,0, 14,0,54,0,30,0,55,0,32,0,56,0,31,0,57,0,4,0,58,0, 4,0,59,0,34,0,4,0,33,0,60,0,13,0,61,0,4,0,62,0, 0,0,37,0,35,0,7,0,25,0,38,0,34,0,63,0,23,0,64,0, 24,0,65,0,36,0,66,0,7,0,43,0,0,0,67,0,37,0,4,0, 17,0,68,0,25,0,69,0,4,0,70,0,7,0,71,0,38,0,4,0, 25,0,38,0,37,0,72,0,4,0,73,0,7,0,43,0,39,0,3,0, 27,0,47,0,4,0,74,0,0,0,37,0,40,0,3,0,27,0,47,0, 4,0,74,0,0,0,37,0,41,0,4,0,4,0,75,0,7,0,76,0, 7,0,77,0,7,0,78,0,36,0,14,0,4,0,79,0,4,0,80,0, 41,0,81,0,4,0,82,0,7,0,83,0,7,0,84,0,7,0,85,0, 7,0,86,0,7,0,87,0,4,0,88,0,4,0,89,0,4,0,90,0, 4,0,91,0,0,0,37,0,42,0,5,0,25,0,38,0,34,0,63,0, 13,0,39,0,7,0,43,0,4,0,92,0,43,0,5,0,27,0,47,0, 13,0,93,0,14,0,94,0,4,0,95,0,0,0,96,0,44,0,24,0, 9,0,97,0,9,0,98,0,25,0,99,0,0,0,35,0,18,0,100,0, 18,0,101,0,14,0,102,0,14,0,103,0,14,0,104,0,8,0,105,0, 8,0,106,0,8,0,107,0,8,0,108,0,8,0,109,0,8,0,110,0, 8,0,111,0,4,0,112,0,4,0,113,0,4,0,114,0,4,0,115,0, 4,0,116,0,4,0,117,0,4,0,118,0,0,0,37,0,45,0,23,0, 9,0,97,0,9,0,98,0,25,0,99,0,0,0,35,0,17,0,100,0, 17,0,101,0,13,0,102,0,13,0,103,0,13,0,104,0,7,0,105,0, 7,0,106,0,7,0,107,0,7,0,108,0,7,0,109,0,7,0,110,0, 7,0,111,0,4,0,112,0,4,0,113,0,4,0,114,0,4,0,115,0, 4,0,116,0,4,0,117,0,4,0,118,0,46,0,21,0,45,0,119,0, 15,0,120,0,13,0,121,0,13,0,122,0,13,0,123,0,13,0,124,0, 13,0,125,0,13,0,126,0,13,0,127,0,13,0,-128,0,13,0,-127,0, 7,0,-126,0,7,0,-125,0,7,0,-124,0,7,0,-123,0,7,0,-122,0, 7,0,-121,0,7,0,-120,0,7,0,-119,0,7,0,-118,0,4,0,-117,0, 47,0,22,0,44,0,119,0,16,0,120,0,14,0,121,0,14,0,122,0, 14,0,123,0,14,0,124,0,14,0,125,0,14,0,126,0,14,0,127,0, 14,0,-128,0,14,0,-127,0,8,0,-126,0,8,0,-125,0,8,0,-124,0, 8,0,-123,0,8,0,-122,0,8,0,-121,0,8,0,-120,0,8,0,-119,0, 8,0,-118,0,4,0,-117,0,0,0,37,0,48,0,2,0,4,0,-116,0, 4,0,-115,0,49,0,11,0,50,0,-114,0,50,0,-113,0,0,0,35,0, 4,0,-112,0,4,0,-111,0,4,0,-110,0,4,0,-109,0,7,0,-108,0, 7,0,-107,0,4,0,-106,0,0,0,-105,0,51,0,3,0,49,0,-104,0, 13,0,-103,0,13,0,-102,0,52,0,3,0,49,0,-104,0,14,0,-103,0, 14,0,-102,0,53,0,13,0,49,0,-104,0,18,0,-101,0,18,0,-100,0, 4,0,-99,0,4,0,-98,0,4,0,-97,0,7,0,-96,0,7,0,-95,0, 7,0,-94,0,7,0,-93,0,7,0,-92,0,7,0,-91,0,7,0,-90,0, 54,0,13,0,49,0,-104,0,17,0,-101,0,17,0,-100,0,4,0,-99,0, 4,0,-98,0,4,0,-97,0,7,0,-96,0,7,0,-95,0,7,0,-94,0, 7,0,-93,0,7,0,-92,0,7,0,-91,0,7,0,-90,0,55,0,11,0, 49,0,-104,0,17,0,-101,0,17,0,-100,0,7,0,-89,0,7,0,-88,0, 7,0,-87,0,7,0,-92,0,7,0,-91,0,7,0,-90,0,7,0,-86,0, 0,0,21,0,56,0,9,0,49,0,-104,0,17,0,-101,0,17,0,-100,0, 13,0,-85,0,13,0,-84,0,13,0,-83,0,13,0,-82,0,4,0,-81,0, 4,0,-80,0,57,0,9,0,49,0,-104,0,17,0,-101,0,17,0,-100,0, 7,0,-85,0,7,0,-84,0,7,0,-83,0,7,0,-82,0,4,0,-81,0, 4,0,-80,0,}; int sBulletDNAlen= sizeof(sBulletDNAstr);
[ "manas@conffx.com" ]
manas@conffx.com
221a189b9599497f1b823924f9ee17eca5fce052
9e79677e214add6455a822b2d5e34e590a9228de
/path.cpp
7b107a33130b5043592c7cf4f5ee265179d0d432
[]
no_license
jrehm135/Data-Structures-P0
ade343295242433779344a33099ded1991957fcb
260e31b242d8e262c980b620eb8b77e9e9e2a5c0
refs/heads/master
2021-01-13T16:03:21.193756
2016-12-18T04:12:48
2016-12-18T04:12:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,226
cpp
#include "path.h" // TODO implement Path Path::Path():root("/"), separator("/") { fullstring = "/"; } Path::Path(std::string root, std::string sep):root(root), separator(sep) { fullstring = root; } Path::Path(std::string pathstring, std::string root, std::string sep):root(root), separator(sep) { fullstring = pathstring; } bool Path::isValid() { int len = fullstring.size(); bool isvalid = true; if (len == 0) isvalid = false; else { for (int i = 0; i < len; i++) { if (fullstring[i] < 32 || fullstring[i] > 127) { isvalid = false; } } } return isvalid; } bool Path::isAbsolute() { bool check = isValid(); int rootlen = root.length(); std::string newroot = fullstring.substr(0, rootlen); if (newroot == root && check == true) return true; else return false; } bool Path::isRelative() { bool check = isValid(); int rootlen = root.length(); std::string newroot = fullstring.substr(0, rootlen); if (newroot != root && check == true) return true; else return false; } bool Path::isDir() { int len = fullstring.length(); int slash = fullstring.find_last_of(separator); if (slash == len-1) return true; else return false; } std::string Path::asString() { return fullstring; } std::string Path::basename() { int pos1 = fullstring.find_last_of(separator); int pos2 = fullstring.find_last_of("."); int diff = pos2 - pos1; if (pos1 != -1 && pos2 != -1) { std::string filename = fullstring.substr(pos1 + 1, diff - 1); return filename; } else return ""; } std::string Path::extension() { int pos1 = fullstring.find_last_of(separator); int pos2 = fullstring.find_last_of("."); if (pos1 != -1 && pos2 != -1) { std::string extension = fullstring.substr(pos2 + 1); return extension; } else return ""; } std::string Path::dirname() { int pos1 = fullstring.find_last_of(separator); if (pos1 != -1) { std::string dir = fullstring.substr(0, pos1); return dir; } else return ""; } bool Path::appendFilename(std::string name) { if (isDir()) { fullstring = fullstring + name; return true; } else return false; } bool Path::appendDirname(std::string name) { if (isDir()) { fullstring = fullstring + name + separator; return true; } else return false; }
[ "jrehm135@vt.edu" ]
jrehm135@vt.edu
6be6f6a565a6f557d482c14f6d67a96f42971f89
1af49694004c6fbc31deada5618dae37255ce978
/third_party/blink/renderer/modules/mediastream/user_media_processor.cc
f331ca7378864d32e0d9578a24815312ab188f83
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "BSD-3-Clause" ]
permissive
sadrulhc/chromium
59682b173a00269ed036eee5ebfa317ba3a770cc
a4b950c23db47a0fdd63549cccf9ac8acd8e2c41
refs/heads/master
2023-02-02T07:59:20.295144
2020-12-01T21:32:32
2020-12-01T21:32:32
317,678,056
3
0
BSD-3-Clause
2020-12-01T21:56:26
2020-12-01T21:56:25
null
UTF-8
C++
false
false
78,653
cc
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "third_party/blink/renderer/modules/mediastream/user_media_processor.h" #include <stddef.h> #include <algorithm> #include <utility> #include <vector> #include "base/location.h" #include "base/logging.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "media/base/audio_parameters.h" #include "media/capture/video_capture_types.h" #include "third_party/blink/public/common/browser_interface_broker_proxy.h" #include "third_party/blink/public/common/mediastream/media_stream_controls.h" #include "third_party/blink/public/common/mediastream/media_stream_request.h" #include "third_party/blink/public/common/widget/screen_info.h" #include "third_party/blink/public/platform/modules/mediastream/web_media_stream_source.h" #include "third_party/blink/public/platform/modules/mediastream/web_media_stream_track.h" #include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_vector.h" #include "third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h" #include "third_party/blink/public/web/web_local_frame.h" #include "third_party/blink/public/web/web_local_frame_client.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/modules/mediastream/local_media_stream_audio_source.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_audio_processor.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_content.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_video_capturer_source.h" #include "third_party/blink/renderer/modules/mediastream/media_stream_video_track.h" #include "third_party/blink/renderer/modules/mediastream/processed_local_audio_source.h" #include "third_party/blink/renderer/modules/mediastream/user_media_client.h" #include "third_party/blink/renderer/platform/mediastream/media_constraints.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_audio_source.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_component.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_descriptor.h" #include "third_party/blink/renderer/platform/mediastream/webrtc_uma_histograms.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/video_capture/local_video_capturer_source.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/wtf_size_t.h" #include "ui/gfx/geometry/size.h" namespace blink { using blink::mojom::MediaStreamRequestResult; using blink::mojom::MediaStreamType; using blink::mojom::StreamSelectionStrategy; using EchoCancellationType = blink::AudioProcessingProperties::EchoCancellationType; namespace { const char* MediaStreamRequestResultToString(MediaStreamRequestResult value) { switch (value) { case MediaStreamRequestResult::OK: return "OK"; case MediaStreamRequestResult::PERMISSION_DENIED: return "PERMISSION_DENIED"; case MediaStreamRequestResult::PERMISSION_DISMISSED: return "PERMISSION_DISMISSED"; case MediaStreamRequestResult::INVALID_STATE: return "INVALID_STATE"; case MediaStreamRequestResult::NO_HARDWARE: return "NO_HARDWARE"; case MediaStreamRequestResult::INVALID_SECURITY_ORIGIN: return "INVALID_SECURITY_ORIGIN"; case MediaStreamRequestResult::TAB_CAPTURE_FAILURE: return "TAB_CAPTURE_FAILURE"; case MediaStreamRequestResult::SCREEN_CAPTURE_FAILURE: return "SCREEN_CAPTURE_FAILURE"; case MediaStreamRequestResult::CAPTURE_FAILURE: return "CAPTURE_FAILURE"; case MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED: return "CONSTRAINT_NOT_SATISFIED"; case MediaStreamRequestResult::TRACK_START_FAILURE_AUDIO: return "TRACK_START_FAILURE_AUDIO"; case MediaStreamRequestResult::TRACK_START_FAILURE_VIDEO: return "TRACK_START_FAILURE_VIDEO"; case MediaStreamRequestResult::NOT_SUPPORTED: return "NOT_SUPPORTED"; case MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN: return "FAILED_DUE_TO_SHUTDOWN"; case MediaStreamRequestResult::KILL_SWITCH_ON: return "KILL_SWITCH_ON"; case MediaStreamRequestResult::SYSTEM_PERMISSION_DENIED: return "SYSTEM_PERMISSION_DENIED"; case MediaStreamRequestResult::NUM_MEDIA_REQUEST_RESULTS: return "NUM_MEDIA_REQUEST_RESULTS"; default: NOTREACHED(); } return "INVALID"; } void SendLogMessage(const std::string& message) { blink::WebRtcLogMessage("UMP::" + message); } std::string GetTrackLogString(MediaStreamComponent* component, bool is_pending) { String str = String::Format( "StartAudioTrack({track=[id: %s, enabled: %d, muted: %d]}, " "{is_pending=%d})", component->Id().Utf8().c_str(), component->Enabled(), component->Muted(), is_pending); return str.Utf8(); } std::string GetTrackSourceLogString(blink::MediaStreamAudioSource* source) { const MediaStreamDevice& device = source->device(); StringBuilder builder; builder.AppendFormat("StartAudioTrack(source: {session_id=%s}, ", device.session_id().ToString().c_str()); builder.AppendFormat("{is_local_source=%d}, ", source->is_local_source()); builder.AppendFormat("{device=[id: %s", device.id.c_str()); if (device.group_id.has_value()) { builder.AppendFormat(", group_id: %s", device.group_id.value().c_str()); } builder.AppendFormat(", name: %s", device.name.c_str()); builder.Append(String("]})")); return builder.ToString().Utf8(); } std::string GetOnTrackStartedLogString( blink::WebPlatformMediaStreamSource* source, MediaStreamRequestResult result) { const MediaStreamDevice& device = source->device(); String str = String::Format("OnTrackStarted({session_id=%s}, {result=%s})", device.session_id().ToString().c_str(), MediaStreamRequestResultToString(result)); return str.Utf8(); } void InitializeAudioTrackControls(UserMediaRequest* user_media_request, TrackControls* track_controls) { if (user_media_request->MediaRequestType() == UserMediaRequest::MediaType::kDisplayMedia || user_media_request->MediaRequestType() == UserMediaRequest::MediaType::kGetCurrentBrowsingContextMedia) { track_controls->requested = true; track_controls->stream_type = MediaStreamType::DISPLAY_AUDIO_CAPTURE; return; } DCHECK_EQ(UserMediaRequest::MediaType::kUserMedia, user_media_request->MediaRequestType()); const MediaConstraints& constraints = user_media_request->AudioConstraints(); DCHECK(!constraints.IsNull()); track_controls->requested = true; MediaStreamType* stream_type = &track_controls->stream_type; *stream_type = MediaStreamType::NO_SERVICE; String source_constraint = constraints.Basic().media_stream_source.Exact().IsEmpty() ? String() : String(constraints.Basic().media_stream_source.Exact()[0]); if (!source_constraint.IsEmpty()) { if (source_constraint == blink::kMediaStreamSourceTab) { *stream_type = MediaStreamType::GUM_TAB_AUDIO_CAPTURE; } else if (source_constraint == blink::kMediaStreamSourceDesktop || source_constraint == blink::kMediaStreamSourceSystem) { *stream_type = MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE; } } else { *stream_type = MediaStreamType::DEVICE_AUDIO_CAPTURE; } } void InitializeVideoTrackControls(UserMediaRequest* user_media_request, TrackControls* track_controls) { if (user_media_request->MediaRequestType() == UserMediaRequest::MediaType::kDisplayMedia) { track_controls->requested = true; track_controls->stream_type = MediaStreamType::DISPLAY_VIDEO_CAPTURE; return; } else if (user_media_request->MediaRequestType() == UserMediaRequest::MediaType::kGetCurrentBrowsingContextMedia) { track_controls->requested = true; track_controls->stream_type = MediaStreamType::DISPLAY_VIDEO_CAPTURE_THIS_TAB; return; } DCHECK_EQ(UserMediaRequest::MediaType::kUserMedia, user_media_request->MediaRequestType()); const MediaConstraints& constraints = user_media_request->VideoConstraints(); DCHECK(!constraints.IsNull()); track_controls->requested = true; MediaStreamType* stream_type = &track_controls->stream_type; *stream_type = MediaStreamType::NO_SERVICE; String source_constraint = constraints.Basic().media_stream_source.Exact().IsEmpty() ? String() : String(constraints.Basic().media_stream_source.Exact()[0]); if (!source_constraint.IsEmpty()) { if (source_constraint == blink::kMediaStreamSourceTab) { *stream_type = MediaStreamType::GUM_TAB_VIDEO_CAPTURE; } else if (source_constraint == blink::kMediaStreamSourceDesktop || source_constraint == blink::kMediaStreamSourceScreen) { *stream_type = MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE; } } else { *stream_type = MediaStreamType::DEVICE_VIDEO_CAPTURE; } } bool IsSameDevice(const MediaStreamDevice& device, const MediaStreamDevice& other_device) { return device.id == other_device.id && device.type == other_device.type && device.session_id() == other_device.session_id(); } bool IsSameSource(MediaStreamSource* source, MediaStreamSource* other_source) { WebPlatformMediaStreamSource* const source_extra_data = source->GetPlatformSource(); const MediaStreamDevice& device = source_extra_data->device(); WebPlatformMediaStreamSource* const other_source_extra_data = other_source->GetPlatformSource(); const MediaStreamDevice& other_device = other_source_extra_data->device(); return IsSameDevice(device, other_device); } void SurfaceAudioProcessingSettings(MediaStreamSource* source) { auto* source_impl = static_cast<blink::MediaStreamAudioSource*>(source->GetPlatformSource()); // If the source is a processed source, get the properties from it. if (auto* processed_source = blink::ProcessedLocalAudioSource::From(source_impl)) { blink::AudioProcessingProperties properties = processed_source->audio_processing_properties(); MediaStreamSource::EchoCancellationMode echo_cancellation_mode; switch (properties.echo_cancellation_type) { case EchoCancellationType::kEchoCancellationDisabled: echo_cancellation_mode = MediaStreamSource::EchoCancellationMode::kDisabled; break; case EchoCancellationType::kEchoCancellationAec3: echo_cancellation_mode = MediaStreamSource::EchoCancellationMode::kBrowser; break; case EchoCancellationType::kEchoCancellationSystem: echo_cancellation_mode = MediaStreamSource::EchoCancellationMode::kSystem; break; } source->SetAudioProcessingProperties(echo_cancellation_mode, properties.goog_auto_gain_control, properties.goog_noise_suppression); } else { // If the source is not a processed source, it could still support system // echo cancellation. Surface that if it does. media::AudioParameters params = source_impl->GetAudioParameters(); const MediaStreamSource::EchoCancellationMode echo_cancellation_mode = params.IsValid() && (params.effects() & media::AudioParameters::ECHO_CANCELLER) ? MediaStreamSource::EchoCancellationMode::kSystem : MediaStreamSource::EchoCancellationMode::kDisabled; source->SetAudioProcessingProperties(echo_cancellation_mode, false, false); } } // TODO(crbug.com/704136): Check all places where this helper is used. // Change their types from using std::vector to WTF::Vector, so this // extra conversion round is not needed. template <typename T> std::vector<T> ToStdVector(const Vector<T>& format_vector) { std::vector<T> formats; std::copy(format_vector.begin(), format_vector.end(), std::back_inserter(formats)); return formats; } Vector<blink::VideoInputDeviceCapabilities> ToVideoInputDeviceCapabilities( const Vector<blink::mojom::blink::VideoInputDeviceCapabilitiesPtr>& input_capabilities) { Vector<blink::VideoInputDeviceCapabilities> capabilities; for (const auto& capability : input_capabilities) { capabilities.emplace_back(capability->device_id, capability->group_id, capability->control_support, capability->formats, capability->facing_mode); } return capabilities; } } // namespace // Class for storing state of the the processing of getUserMedia requests. class UserMediaProcessor::RequestInfo final : public GarbageCollected<UserMediaProcessor::RequestInfo> { public: using ResourcesReady = base::OnceCallback<void(RequestInfo* request_info, MediaStreamRequestResult result, const String& result_name)>; enum class State { NOT_SENT_FOR_GENERATION, SENT_FOR_GENERATION, GENERATED, }; explicit RequestInfo(UserMediaRequest* request); void StartAudioTrack(MediaStreamComponent* component, bool is_pending); MediaStreamComponent* CreateAndStartVideoTrack(MediaStreamSource* source); // Triggers |callback| when all sources used in this request have either // successfully started, or a source has failed to start. void CallbackOnTracksStarted(ResourcesReady callback); // Called when a local audio source has finished (or failed) initializing. void OnAudioSourceStarted(blink::WebPlatformMediaStreamSource* source, MediaStreamRequestResult result, const String& result_name); UserMediaRequest* request() { return request_; } int request_id() const { return request_->request_id(); } State state() const { return state_; } void set_state(State state) { state_ = state; } const blink::AudioCaptureSettings& audio_capture_settings() const { return audio_capture_settings_; } void SetAudioCaptureSettings(const blink::AudioCaptureSettings& settings, bool is_content_capture) { DCHECK(settings.HasValue()); is_audio_content_capture_ = is_content_capture; audio_capture_settings_ = settings; } const blink::VideoCaptureSettings& video_capture_settings() const { return video_capture_settings_; } bool is_video_content_capture() const { return video_capture_settings_.HasValue() && is_video_content_capture_; } bool is_video_device_capture() const { return video_capture_settings_.HasValue() && !is_video_content_capture_; } void SetVideoCaptureSettings(const blink::VideoCaptureSettings& settings, bool is_content_capture) { DCHECK(settings.HasValue()); is_video_content_capture_ = is_content_capture; video_capture_settings_ = settings; } void SetDevices(Vector<MediaStreamDevice> audio_devices, Vector<MediaStreamDevice> video_devices) { audio_devices_ = std::move(audio_devices); video_devices_ = std::move(video_devices); } void AddNativeVideoFormats(const String& device_id, Vector<media::VideoCaptureFormat> formats) { video_formats_map_.insert(device_id, std::move(formats)); } // Do not store or delete the returned pointer. Vector<media::VideoCaptureFormat>* GetNativeVideoFormats( const String& device_id) { auto it = video_formats_map_.find(device_id); CHECK(it != video_formats_map_.end()); return &it->value; } void InitializeWebStream(const String& label, const MediaStreamComponentVector& audios, const MediaStreamComponentVector& videos) { descriptor_ = MakeGarbageCollected<MediaStreamDescriptor>(label, audios, videos); } const Vector<MediaStreamDevice>& audio_devices() const { return audio_devices_; } const Vector<MediaStreamDevice>& video_devices() const { return video_devices_; } bool CanStartTracks() const { return video_formats_map_.size() == video_devices_.size(); } MediaStreamDescriptor* descriptor() { DCHECK(descriptor_); return descriptor_; } StreamControls* stream_controls() { return &stream_controls_; } bool is_processing_user_gesture() const { return request_->has_transient_user_activation(); } bool pan_tilt_zoom_allowed() const { return pan_tilt_zoom_allowed_; } void set_pan_tilt_zoom_allowed(bool pan_tilt_zoom_allowed) { pan_tilt_zoom_allowed_ = pan_tilt_zoom_allowed; } void Trace(Visitor* visitor) const { visitor->Trace(request_); visitor->Trace(descriptor_); visitor->Trace(sources_); } private: void OnTrackStarted(blink::WebPlatformMediaStreamSource* source, MediaStreamRequestResult result, const blink::WebString& result_name); // Checks if the sources for all tracks have been started and if so, // invoke the |ready_callback_|. Note that the caller should expect // that |this| might be deleted when the function returns. void CheckAllTracksStarted(); Member<UserMediaRequest> request_; State state_ = State::NOT_SENT_FOR_GENERATION; blink::AudioCaptureSettings audio_capture_settings_; bool is_audio_content_capture_ = false; blink::VideoCaptureSettings video_capture_settings_; bool is_video_content_capture_ = false; Member<MediaStreamDescriptor> descriptor_; StreamControls stream_controls_; ResourcesReady ready_callback_; MediaStreamRequestResult request_result_ = MediaStreamRequestResult::OK; String request_result_name_; // Sources used in this request. HeapVector<Member<MediaStreamSource>> sources_; Vector<blink::WebPlatformMediaStreamSource*> sources_waiting_for_callback_; HashMap<String, Vector<media::VideoCaptureFormat>> video_formats_map_; Vector<MediaStreamDevice> audio_devices_; Vector<MediaStreamDevice> video_devices_; bool pan_tilt_zoom_allowed_ = false; }; // TODO(guidou): Initialize request_result_name_ as a null WTF::String. // https://crbug.com/764293 UserMediaProcessor::RequestInfo::RequestInfo(UserMediaRequest* request) : request_(request), request_result_name_("") {} void UserMediaProcessor::RequestInfo::StartAudioTrack( MediaStreamComponent* component, bool is_pending) { DCHECK(component->Source()->GetType() == MediaStreamSource::kTypeAudio); DCHECK(request()->Audio()); #if DCHECK_IS_ON() DCHECK(audio_capture_settings_.HasValue()); #endif SendLogMessage(GetTrackLogString(component, is_pending)); auto* native_source = MediaStreamAudioSource::From(component->Source()); SendLogMessage(GetTrackSourceLogString(native_source)); // Add the source as pending since OnTrackStarted will expect it to be there. sources_waiting_for_callback_.push_back(native_source); sources_.push_back(component->Source()); bool connected = native_source->ConnectToTrack(component); if (!is_pending) { OnTrackStarted(native_source, connected ? MediaStreamRequestResult::OK : MediaStreamRequestResult::TRACK_START_FAILURE_AUDIO, ""); } } MediaStreamComponent* UserMediaProcessor::RequestInfo::CreateAndStartVideoTrack( MediaStreamSource* source) { DCHECK(source->GetType() == MediaStreamSource::kTypeVideo); DCHECK(request()->Video()); DCHECK(video_capture_settings_.HasValue()); SendLogMessage(base::StringPrintf( "UMP::RI::CreateAndStartVideoTrack({request_id=%d})", request_id())); MediaStreamVideoSource* native_source = MediaStreamVideoSource::GetVideoSource(source); DCHECK(native_source); sources_.push_back(source); sources_waiting_for_callback_.push_back(native_source); return MediaStreamVideoTrack::CreateVideoTrack( native_source, video_capture_settings_.track_adapter_settings(), video_capture_settings_.noise_reduction(), is_video_content_capture_, video_capture_settings_.min_frame_rate(), video_capture_settings_.pan(), video_capture_settings_.tilt(), video_capture_settings_.zoom(), pan_tilt_zoom_allowed(), WTF::Bind(&UserMediaProcessor::RequestInfo::OnTrackStarted, WrapWeakPersistent(this)), true); } void UserMediaProcessor::RequestInfo::CallbackOnTracksStarted( ResourcesReady callback) { DCHECK(ready_callback_.is_null()); ready_callback_ = std::move(callback); CheckAllTracksStarted(); } void UserMediaProcessor::RequestInfo::OnTrackStarted( blink::WebPlatformMediaStreamSource* source, MediaStreamRequestResult result, const blink::WebString& result_name) { SendLogMessage(GetOnTrackStartedLogString(source, result)); auto** it = std::find(sources_waiting_for_callback_.begin(), sources_waiting_for_callback_.end(), source); DCHECK(it != sources_waiting_for_callback_.end()); sources_waiting_for_callback_.erase(it); // All tracks must be started successfully. Otherwise the request is a // failure. if (result != MediaStreamRequestResult::OK) { request_result_ = result; request_result_name_ = result_name; } CheckAllTracksStarted(); } void UserMediaProcessor::RequestInfo::CheckAllTracksStarted() { if (ready_callback_ && sources_waiting_for_callback_.IsEmpty()) { std::move(ready_callback_).Run(this, request_result_, request_result_name_); // NOTE: |this| might now be deleted. } } void UserMediaProcessor::RequestInfo::OnAudioSourceStarted( blink::WebPlatformMediaStreamSource* source, MediaStreamRequestResult result, const String& result_name) { // Check if we're waiting to be notified of this source. If not, then we'll // ignore the notification. if (base::Contains(sources_waiting_for_callback_, source)) OnTrackStarted(source, result, result_name); } UserMediaProcessor::UserMediaProcessor( LocalFrame* frame, MediaDevicesDispatcherCallback media_devices_dispatcher_cb, scoped_refptr<base::SingleThreadTaskRunner> task_runner) : dispatcher_host_(frame->DomWindow()), media_devices_dispatcher_cb_(std::move(media_devices_dispatcher_cb)), frame_(frame), task_runner_(std::move(task_runner)) {} UserMediaProcessor::~UserMediaProcessor() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // Ensure StopAllProcessing() has been called by UserMediaClient. DCHECK(!current_request_info_ && !request_completed_cb_ && !local_sources_.size()); } UserMediaRequest* UserMediaProcessor::CurrentRequest() { return current_request_info_ ? current_request_info_->request() : nullptr; } void UserMediaProcessor::ProcessRequest(UserMediaRequest* request, base::OnceClosure callback) { DCHECK(!request_completed_cb_); DCHECK(!current_request_info_); request_completed_cb_ = std::move(callback); current_request_info_ = MakeGarbageCollected<RequestInfo>(request); SendLogMessage( base::StringPrintf("ProcessRequest({request_id=%d}, {audio=%d}, " "{video=%d})", current_request_info_->request_id(), current_request_info_->request()->Audio(), current_request_info_->request()->Video())); // TODO(guidou): Set up audio and video in parallel. if (current_request_info_->request()->Audio()) { SetupAudioInput(); return; } SetupVideoInput(); } void UserMediaProcessor::SetupAudioInput() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); DCHECK(current_request_info_->request()->Audio()); SendLogMessage( base::StringPrintf("SetupAudioInput({request_id=%d}, {constraints=%s})", current_request_info_->request_id(), current_request_info_->request() ->AudioConstraints() .ToString() .Utf8() .c_str())); auto& audio_controls = current_request_info_->stream_controls()->audio; InitializeAudioTrackControls(current_request_info_->request(), &audio_controls); if (audio_controls.stream_type == MediaStreamType::DISPLAY_AUDIO_CAPTURE) { SelectAudioSettings(current_request_info_->request(), {blink::AudioDeviceCaptureCapability()}); return; } if (blink::IsDeviceMediaType(audio_controls.stream_type)) { SendLogMessage( base::StringPrintf("SetupAudioInput({request_id=%d}) => " "(Requesting device capabilities)", current_request_info_->request_id())); GetMediaDevicesDispatcher()->GetAudioInputCapabilities( WTF::Bind(&UserMediaProcessor::SelectAudioDeviceSettings, WrapWeakPersistent(this), WrapPersistent(current_request_info_->request()))); } else { if (!blink::IsAudioInputMediaType(audio_controls.stream_type)) { String failed_constraint_name = String(current_request_info_->request() ->AudioConstraints() .Basic() .media_stream_source.GetName()); MediaStreamRequestResult result = MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED; GetUserMediaRequestFailed(result, failed_constraint_name); return; } SelectAudioSettings(current_request_info_->request(), {blink::AudioDeviceCaptureCapability()}); } } void UserMediaProcessor::SelectAudioDeviceSettings( UserMediaRequest* user_media_request, Vector<blink::mojom::blink::AudioInputDeviceCapabilitiesPtr> audio_input_capabilities) { blink::AudioDeviceCaptureCapabilities capabilities; for (const auto& device : audio_input_capabilities) { // Find the first occurrence of blink::ProcessedLocalAudioSource that // matches the same device ID as |device|. If more than one exists, any // such source will contain the same non-reconfigurable settings that limit // the associated capabilities. blink::MediaStreamAudioSource* audio_source = nullptr; auto* it = std::find_if(local_sources_.begin(), local_sources_.end(), [&device](MediaStreamSource* source) { DCHECK(source); MediaStreamAudioSource* platform_source = MediaStreamAudioSource::From(source); ProcessedLocalAudioSource* processed_source = ProcessedLocalAudioSource::From( platform_source); return processed_source && source->Id() == device->device_id; }); if (it != local_sources_.end()) { WebPlatformMediaStreamSource* const source = (*it)->GetPlatformSource(); if (source->device().type == MediaStreamType::DEVICE_AUDIO_CAPTURE) audio_source = static_cast<MediaStreamAudioSource*>(source); } if (audio_source) { capabilities.emplace_back(audio_source); } else { capabilities.emplace_back(device->device_id, device->group_id, device->parameters); } } SelectAudioSettings(user_media_request, capabilities); } void UserMediaProcessor::SelectAudioSettings( UserMediaRequest* user_media_request, const blink::AudioDeviceCaptureCapabilities& capabilities) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // The frame might reload or |user_media_request| might be cancelled while // capabilities are queried. Do nothing if a different request is being // processed at this point. if (!IsCurrentRequestInfo(user_media_request)) return; DCHECK(current_request_info_->stream_controls()->audio.requested); SendLogMessage(base::StringPrintf("SelectAudioSettings({request_id=%d})", current_request_info_->request_id())); auto settings = SelectSettingsAudioCapture( capabilities, user_media_request->AudioConstraints(), user_media_request->ShouldDisableHardwareNoiseSuppression(), true /* is_reconfiguration_allowed */); if (!settings.HasValue()) { String failed_constraint_name = String(settings.failed_constraint_name()); MediaStreamRequestResult result = failed_constraint_name.IsEmpty() ? MediaStreamRequestResult::NO_HARDWARE : MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED; GetUserMediaRequestFailed(result, failed_constraint_name); return; } if (current_request_info_->stream_controls()->audio.stream_type != MediaStreamType::DISPLAY_AUDIO_CAPTURE) { current_request_info_->stream_controls()->audio.device_id = settings.device_id(); current_request_info_->stream_controls()->disable_local_echo = settings.disable_local_echo(); } current_request_info_->SetAudioCaptureSettings( settings, !blink::IsDeviceMediaType( current_request_info_->stream_controls()->audio.stream_type)); // No further audio setup required. Continue with video. SetupVideoInput(); } base::Optional<base::UnguessableToken> UserMediaProcessor::DetermineExistingAudioSessionId() { DCHECK(current_request_info_->request()->Audio()); auto settings = current_request_info_->audio_capture_settings(); auto device_id = settings.device_id(); // Create a copy of the MediaStreamSource objects that are // associated to the same audio device capture based on its device ID. HeapVector<Member<MediaStreamSource>> matching_sources; for (const auto& source : local_sources_) { MediaStreamSource* source_copy = source; if (source_copy->GetType() == MediaStreamSource::kTypeAudio && source_copy->Id().Utf8() == device_id) { matching_sources.push_back(source_copy); } } // Return the session ID associated to the source that has the same settings // that have been previously selected, if one exists. if (!matching_sources.IsEmpty()) { for (auto& matching_source : matching_sources) { auto* audio_source = static_cast<MediaStreamAudioSource*>( matching_source->GetPlatformSource()); if (audio_source->HasSameReconfigurableSettings( settings.audio_processing_properties())) { return audio_source->device().session_id(); } } } return base::nullopt; } void UserMediaProcessor::SetupVideoInput() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); if (!current_request_info_->request()->Video()) { base::Optional<base::UnguessableToken> audio_session_id = DetermineExistingAudioSessionId(); GenerateStreamForCurrentRequestInfo( audio_session_id, audio_session_id.has_value() ? StreamSelectionStrategy::SEARCH_BY_SESSION_ID : StreamSelectionStrategy::FORCE_NEW_STREAM); return; } SendLogMessage( base::StringPrintf("SetupVideoInput. request_id=%d, video constraints=%s", current_request_info_->request_id(), current_request_info_->request() ->VideoConstraints() .ToString() .Utf8() .c_str())); auto& video_controls = current_request_info_->stream_controls()->video; InitializeVideoTrackControls(current_request_info_->request(), &video_controls); current_request_info_->stream_controls()->request_pan_tilt_zoom_permission = IsPanTiltZoomPermissionRequested( current_request_info_->request()->VideoConstraints()); if (blink::IsDeviceMediaType(video_controls.stream_type)) { GetMediaDevicesDispatcher()->GetVideoInputCapabilities( WTF::Bind(&UserMediaProcessor::SelectVideoDeviceSettings, WrapWeakPersistent(this), WrapPersistent(current_request_info_->request()))); } else { if (!blink::IsVideoInputMediaType(video_controls.stream_type)) { String failed_constraint_name = String(current_request_info_->request() ->VideoConstraints() .Basic() .media_stream_source.GetName()); MediaStreamRequestResult result = MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED; GetUserMediaRequestFailed(result, failed_constraint_name); return; } SelectVideoContentSettings(); } } // static bool UserMediaProcessor::IsPanTiltZoomPermissionRequested( const MediaConstraints& constraints) { if (!RuntimeEnabledFeatures::MediaCapturePanTiltEnabled()) return false; if (constraints.Basic().pan.IsPresent() || constraints.Basic().tilt.IsPresent() || constraints.Basic().zoom.IsPresent()) { return true; } for (const auto& advanced_set : constraints.Advanced()) { if (advanced_set.pan.IsPresent() || advanced_set.tilt.IsPresent() || advanced_set.zoom.IsPresent()) { return true; } } return false; } void UserMediaProcessor::SelectVideoDeviceSettings( UserMediaRequest* user_media_request, Vector<blink::mojom::blink::VideoInputDeviceCapabilitiesPtr> video_input_capabilities) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // The frame might reload or |user_media_request| might be cancelled while // capabilities are queried. Do nothing if a different request is being // processed at this point. if (!IsCurrentRequestInfo(user_media_request)) return; DCHECK(current_request_info_->stream_controls()->video.requested); DCHECK(blink::IsDeviceMediaType( current_request_info_->stream_controls()->video.stream_type)); SendLogMessage(base::StringPrintf("SelectVideoDeviceSettings. request_id=%d.", current_request_info_->request_id())); blink::VideoDeviceCaptureCapabilities capabilities; capabilities.device_capabilities = ToVideoInputDeviceCapabilities(video_input_capabilities); capabilities.noise_reduction_capabilities = {base::Optional<bool>(), base::Optional<bool>(true), base::Optional<bool>(false)}; blink::VideoCaptureSettings settings = SelectSettingsVideoDeviceCapture( std::move(capabilities), user_media_request->VideoConstraints(), blink::MediaStreamVideoSource::kDefaultWidth, blink::MediaStreamVideoSource::kDefaultHeight, blink::MediaStreamVideoSource::kDefaultFrameRate); if (!settings.HasValue()) { String failed_constraint_name = String(settings.failed_constraint_name()); MediaStreamRequestResult result = failed_constraint_name.IsEmpty() ? MediaStreamRequestResult::NO_HARDWARE : MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED; GetUserMediaRequestFailed(result, failed_constraint_name); return; } current_request_info_->stream_controls()->video.device_id = settings.device_id(); current_request_info_->SetVideoCaptureSettings( settings, false /* is_content_capture */); if (current_request_info_->request()->Audio()) { base::Optional<base::UnguessableToken> audio_session_id = DetermineExistingAudioSessionId(); GenerateStreamForCurrentRequestInfo( audio_session_id, audio_session_id.has_value() ? StreamSelectionStrategy::SEARCH_BY_SESSION_ID : StreamSelectionStrategy::FORCE_NEW_STREAM); } else { GenerateStreamForCurrentRequestInfo(); } } void UserMediaProcessor::SelectVideoContentSettings() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); SendLogMessage( base::StringPrintf("SelectVideoContentSettings. request_id=%d.", current_request_info_->request_id())); gfx::Size screen_size = GetScreenSize(); blink::VideoCaptureSettings settings = blink::SelectSettingsVideoContentCapture( current_request_info_->request()->VideoConstraints(), current_request_info_->stream_controls()->video.stream_type, screen_size.width(), screen_size.height()); if (!settings.HasValue()) { String failed_constraint_name = String(settings.failed_constraint_name()); DCHECK(!failed_constraint_name.IsEmpty()); GetUserMediaRequestFailed( MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED, failed_constraint_name); return; } const MediaStreamType stream_type = current_request_info_->stream_controls()->video.stream_type; if (stream_type != MediaStreamType::DISPLAY_VIDEO_CAPTURE && stream_type != MediaStreamType::DISPLAY_VIDEO_CAPTURE_THIS_TAB) { current_request_info_->stream_controls()->video.device_id = settings.device_id(); } current_request_info_->SetVideoCaptureSettings(settings, true /* is_content_capture */); GenerateStreamForCurrentRequestInfo(); } void UserMediaProcessor::GenerateStreamForCurrentRequestInfo( base::Optional<base::UnguessableToken> requested_audio_capture_session_id, blink::mojom::StreamSelectionStrategy strategy) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); SendLogMessage(base::StringPrintf( "GenerateStreamForCurrentRequestInfo({request_id=%d}, " "{audio.device_id=%s}, {video.device_id=%s})", current_request_info_->request_id(), current_request_info_->stream_controls()->audio.device_id.c_str(), current_request_info_->stream_controls()->video.device_id.c_str())); current_request_info_->set_state(RequestInfo::State::SENT_FOR_GENERATION); // The browser replies to this request by invoking OnStreamGenerated(). GetMediaStreamDispatcherHost()->GenerateStream( current_request_info_->request_id(), *current_request_info_->stream_controls(), current_request_info_->is_processing_user_gesture(), blink::mojom::blink::StreamSelectionInfo::New( strategy, requested_audio_capture_session_id), WTF::Bind(&UserMediaProcessor::OnStreamGenerated, WrapWeakPersistent(this), current_request_info_->request_id())); } WebMediaStreamDeviceObserver* UserMediaProcessor::GetMediaStreamDeviceObserver() { auto* media_stream_device_observer = media_stream_device_observer_for_testing_; if (frame_) { // Can be null for tests. auto* web_frame = static_cast<WebLocalFrame*>(WebFrame::FromFrame(frame_)); if (!web_frame || !web_frame->Client()) return nullptr; // TODO(704136): Move ownership of |WebMediaStreamDeviceObserver| out of // RenderFrameImpl, back to UserMediaClient. media_stream_device_observer = web_frame->Client()->MediaStreamDeviceObserver(); DCHECK(media_stream_device_observer); } return media_stream_device_observer; } void UserMediaProcessor::OnStreamGenerated( int request_id, MediaStreamRequestResult result, const String& label, const Vector<MediaStreamDevice>& audio_devices, const Vector<MediaStreamDevice>& video_devices, bool pan_tilt_zoom_allowed) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (result != MediaStreamRequestResult::OK) { OnStreamGenerationFailed(request_id, result); return; } if (!IsCurrentRequestInfo(request_id)) { // This can happen if the request is canceled or the frame reloads while // MediaStreamDispatcherHost is processing the request. SendLogMessage(base::StringPrintf( "OnStreamGenerated([request_id=%d]) => (ERROR: invalid request ID)", request_id)); OnStreamGeneratedForCancelledRequest(audio_devices, video_devices); return; } current_request_info_->set_state(RequestInfo::State::GENERATED); current_request_info_->set_pan_tilt_zoom_allowed(pan_tilt_zoom_allowed); for (const auto* devices : {&audio_devices, &video_devices}) { for (const auto& device : *devices) { SendLogMessage(base::StringPrintf( "OnStreamGenerated({request_id=%d}, {label=%s}, {device=[id: %s, " "name: " "%s]})", request_id, label.Utf8().c_str(), device.id.c_str(), device.name.c_str())); } } current_request_info_->SetDevices(audio_devices, video_devices); if (video_devices.IsEmpty()) { StartTracks(label); return; } if (current_request_info_->is_video_content_capture()) { media::VideoCaptureFormat format = current_request_info_->video_capture_settings().Format(); for (const auto& video_device : video_devices) { String video_device_id(video_device.id.data()); current_request_info_->AddNativeVideoFormats( video_device_id, {media::VideoCaptureFormat(GetScreenSize(), format.frame_rate, format.pixel_format)}); } StartTracks(label); return; } for (const auto& video_device : video_devices) { SendLogMessage(base::StringPrintf( "OnStreamGenerated({request_id=%d}, {label=%s}, {device=[id: %s, " "name: %s]}) => (Requesting video device formats)", request_id, label.Utf8().c_str(), video_device.id.c_str(), video_device.name.c_str())); String video_device_id(video_device.id.data()); GetMediaDevicesDispatcher()->GetAllVideoInputDeviceFormats( video_device_id, WTF::Bind(&UserMediaProcessor::GotAllVideoInputFormatsForDevice, WrapWeakPersistent(this), WrapPersistent(current_request_info_->request()), label, video_device_id)); } } void UserMediaProcessor::GotAllVideoInputFormatsForDevice( UserMediaRequest* user_media_request, const String& label, const String& device_id, const Vector<media::VideoCaptureFormat>& formats) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // The frame might reload or |user_media_request| might be cancelled while // video formats are queried. Do nothing if a different request is being // processed at this point. if (!IsCurrentRequestInfo(user_media_request)) return; SendLogMessage( base::StringPrintf("GotAllVideoInputFormatsForDevice({request_id=%d}, " "{label=%s}, {device=[id: %s]})", current_request_info_->request_id(), label.Utf8().c_str(), device_id.Utf8().c_str())); current_request_info_->AddNativeVideoFormats(device_id, formats); if (current_request_info_->CanStartTracks()) StartTracks(label); } gfx::Size UserMediaProcessor::GetScreenSize() { gfx::Size screen_size(blink::kDefaultScreenCastWidth, blink::kDefaultScreenCastHeight); if (frame_) { // Can be null in tests. blink::ScreenInfo info = frame_->GetChromeClient().GetScreenInfo(*frame_); screen_size = info.rect.size(); } return screen_size; } void UserMediaProcessor::OnStreamGeneratedForCancelledRequest( const Vector<MediaStreamDevice>& audio_devices, const Vector<MediaStreamDevice>& video_devices) { SendLogMessage("OnStreamGeneratedForCancelledRequest()"); // Only stop the device if the device is not used in another MediaStream. for (auto* it = audio_devices.begin(); it != audio_devices.end(); ++it) { if (!FindLocalSource(*it)) { String id(it->id.data()); GetMediaStreamDispatcherHost()->StopStreamDevice( id, it->serializable_session_id()); } } for (auto* it = video_devices.begin(); it != video_devices.end(); ++it) { if (!FindLocalSource(*it)) { String id(it->id.data()); GetMediaStreamDispatcherHost()->StopStreamDevice( id, it->serializable_session_id()); } } } // static void UserMediaProcessor::OnAudioSourceStartedOnAudioThread( scoped_refptr<base::SingleThreadTaskRunner> task_runner, UserMediaProcessor* weak_ptr, blink::WebPlatformMediaStreamSource* source, MediaStreamRequestResult result, const blink::WebString& result_name) { PostCrossThreadTask( *task_runner.get(), FROM_HERE, CrossThreadBindOnce(&UserMediaProcessor::OnAudioSourceStarted, WrapCrossThreadWeakPersistent(weak_ptr), CrossThreadUnretained(source), result, String(result_name))); } void UserMediaProcessor::OnAudioSourceStarted( blink::WebPlatformMediaStreamSource* source, MediaStreamRequestResult result, const String& result_name) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); for (auto* it = pending_local_sources_.begin(); it != pending_local_sources_.end(); ++it) { blink::WebPlatformMediaStreamSource* const source_extra_data = (*it)->GetPlatformSource(); if (source_extra_data != source) continue; if (result == MediaStreamRequestResult::OK) local_sources_.push_back((*it)); pending_local_sources_.erase(it); NotifyCurrentRequestInfoOfAudioSourceStarted(source, result, result_name); return; } } void UserMediaProcessor::NotifyCurrentRequestInfoOfAudioSourceStarted( blink::WebPlatformMediaStreamSource* source, MediaStreamRequestResult result, const String& result_name) { // The only request possibly being processed is |current_request_info_|. if (current_request_info_) current_request_info_->OnAudioSourceStarted(source, result, result_name); } void UserMediaProcessor::OnStreamGenerationFailed( int request_id, MediaStreamRequestResult result) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!IsCurrentRequestInfo(request_id)) { // This can happen if the request is canceled or the frame reloads while // MediaStreamDispatcherHost is processing the request. return; } SendLogMessage(base::StringPrintf("OnStreamGenerationFailed({request_id=%d})", current_request_info_->request_id())); GetUserMediaRequestFailed(result); DeleteUserMediaRequest(current_request_info_->request()); } void UserMediaProcessor::OnDeviceStopped(const MediaStreamDevice& device) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); SendLogMessage(base::StringPrintf( "OnDeviceStopped({session_id=%s}, {device_id=%s})", device.session_id().ToString().c_str(), device.id.c_str())); MediaStreamSource* source = FindLocalSource(device); if (!source) { // This happens if the same device is used in several guM requests or // if a user happens to stop a track from JS at the same time // as the underlying media device is unplugged from the system. return; } StopLocalSource(source, false); RemoveLocalSource(source); } void UserMediaProcessor::OnDeviceChanged(const MediaStreamDevice& old_device, const MediaStreamDevice& new_device) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); // TODO(https://crbug.com/1017219): possibly useful in native logs as well. DVLOG(1) << "UserMediaProcessor::OnDeviceChange(" << "{old_device_id = " << old_device.id << ", session id = " << old_device.session_id() << ", type = " << old_device.type << "}" << "{new_device_id = " << new_device.id << ", session id = " << new_device.session_id() << ", type = " << new_device.type << "})"; MediaStreamSource* source = FindLocalSource(old_device); if (!source) { // This happens if the same device is used in several guM requests or // if a user happens to stop a track from JS at the same time // as the underlying media device is unplugged from the system. DVLOG(1) << "failed to find existing source with device " << old_device.id; return; } if (old_device.type != MediaStreamType::NO_SERVICE && new_device.type == MediaStreamType::NO_SERVICE) { // At present, this will only happen to the case that a new desktop capture // source without audio share is selected, then the previous audio capture // device should be stopped if existing. DCHECK(blink::IsAudioInputMediaType(old_device.type)); OnDeviceStopped(old_device); return; } WebPlatformMediaStreamSource* const source_impl = source->GetPlatformSource(); source_impl->ChangeSource(new_device); } void UserMediaProcessor::OnDeviceRequestStateChange( const MediaStreamDevice& device, const mojom::blink::MediaStreamStateChange new_state) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); SendLogMessage(base::StringPrintf( "OnDeviceRequestStateChange({session_id=%s}, {device_id=%s}, " "{new_state=%s})", device.session_id().ToString().c_str(), device.id.c_str(), (new_state == mojom::blink::MediaStreamStateChange::PAUSE ? "PAUSE" : "PLAY"))); MediaStreamSource* source = FindLocalSource(device); if (!source) { // This happens if the same device is used in several guM requests or // if a user happens to stop a track from JS at the same time // as the underlying media device is unplugged from the system. return; } WebPlatformMediaStreamSource* const source_impl = source->GetPlatformSource(); source_impl->SetSourceMuted(new_state == mojom::blink::MediaStreamStateChange::PAUSE); MediaStreamVideoSource* video_source = static_cast<blink::MediaStreamVideoSource*>(source_impl); if (!video_source) { return; } if (new_state == mojom::blink::MediaStreamStateChange::PAUSE) { if (video_source->IsRunning()) { video_source->StopForRestart(base::DoNothing(), /*send_black_frame=*/true); } } else if (new_state == mojom::blink::MediaStreamStateChange::PLAY) { if (video_source->IsStoppedForRestart()) { video_source->Restart(*video_source->GetCurrentFormat(), base::DoNothing()); } } else { NOTREACHED(); } } void UserMediaProcessor::Trace(Visitor* visitor) const { visitor->Trace(dispatcher_host_); visitor->Trace(frame_); visitor->Trace(current_request_info_); visitor->Trace(local_sources_); visitor->Trace(pending_local_sources_); } MediaStreamSource* UserMediaProcessor::InitializeVideoSourceObject( const MediaStreamDevice& device) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); SendLogMessage(base::StringPrintf( "UMP::InitializeVideoSourceObject({request_id=%d}, {device=[id: %s, " "name: %s]})", current_request_info_->request_id(), device.id.c_str(), device.name.c_str())); MediaStreamSource* source = FindOrInitializeSourceObject(device); if (!source->GetPlatformSource()) { auto video_source = CreateVideoSource( device, WTF::Bind(&UserMediaProcessor::OnLocalSourceStopped, WrapWeakPersistent(this))); source->SetPlatformSource(std::move(video_source)); String device_id(device.id.data()); source->SetCapabilities(ComputeCapabilitiesForVideoSource( // TODO(crbug.com/704136): Change ComputeCapabilitiesForVideoSource to // operate over WTF::Vector. String::FromUTF8(device.id), ToStdVector(*current_request_info_->GetNativeVideoFormats(device_id)), static_cast<mojom::blink::FacingMode>(device.video_facing), current_request_info_->is_video_device_capture(), device.group_id)); local_sources_.push_back(source); } return source; } MediaStreamSource* UserMediaProcessor::InitializeAudioSourceObject( const MediaStreamDevice& device, bool* is_pending) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); SendLogMessage( base::StringPrintf("InitializeAudioSourceObject({session_id=%s})", device.session_id().ToString().c_str())); *is_pending = true; // See if the source is already being initialized. auto* pending = FindPendingLocalSource(device); if (pending) return pending; MediaStreamSource* source = FindOrInitializeSourceObject(device); if (source->GetPlatformSource()) { // The only return point for non-pending sources. *is_pending = false; return source; } // While sources are being initialized, keep them in a separate array. // Once they've finished initialized, they'll be moved over to local_sources_. // See OnAudioSourceStarted for more details. pending_local_sources_.push_back(source); blink::WebPlatformMediaStreamSource::ConstraintsRepeatingCallback source_ready = ConvertToBaseRepeatingCallback(CrossThreadBindRepeating( &UserMediaProcessor::OnAudioSourceStartedOnAudioThread, task_runner_, WrapCrossThreadWeakPersistent(this))); std::unique_ptr<blink::MediaStreamAudioSource> audio_source = CreateAudioSource(device, std::move(source_ready)); audio_source->SetStopCallback(WTF::Bind( &UserMediaProcessor::OnLocalSourceStopped, WrapWeakPersistent(this))); #if DCHECK_IS_ON() for (auto local_source : local_sources_) { auto* platform_source = static_cast<WebPlatformMediaStreamSource*>( local_source->GetPlatformSource()); DCHECK(platform_source); if (platform_source->device().id == audio_source->device().id) { auto* audio_platform_source = static_cast<MediaStreamAudioSource*>(platform_source); auto* processed_existing_source = ProcessedLocalAudioSource::From(audio_platform_source); auto* processed_new_source = ProcessedLocalAudioSource::From(audio_source.get()); if (processed_new_source && processed_existing_source) { DCHECK(audio_source->HasSameNonReconfigurableSettings( audio_platform_source)); } } } #endif // DCHECK_IS_ON() MediaStreamSource::Capabilities capabilities; capabilities.echo_cancellation = {true, false}; capabilities.echo_cancellation_type.ReserveCapacity(3); capabilities.echo_cancellation_type.emplace_back( String::FromUTF8(kEchoCancellationTypeBrowser)); capabilities.echo_cancellation_type.emplace_back( String::FromUTF8(kEchoCancellationTypeAec3)); if (device.input.effects() & (media::AudioParameters::ECHO_CANCELLER | media::AudioParameters::EXPERIMENTAL_ECHO_CANCELLER)) { capabilities.echo_cancellation_type.emplace_back( String::FromUTF8(kEchoCancellationTypeSystem)); } capabilities.auto_gain_control = {true, false}; capabilities.noise_suppression = {true, false}; capabilities.sample_size = { media::SampleFormatToBitsPerChannel(media::kSampleFormatS16), // min media::SampleFormatToBitsPerChannel(media::kSampleFormatS16) // max }; auto device_parameters = audio_source->device().input; if (device_parameters.IsValid()) { capabilities.channel_count = {1, device_parameters.channels()}; capabilities.sample_rate = {std::min(blink::kAudioProcessingSampleRate, device_parameters.sample_rate()), std::max(blink::kAudioProcessingSampleRate, device_parameters.sample_rate())}; double fallback_latency = static_cast<double>(blink::kFallbackAudioLatencyMs) / 1000; double min_latency, max_latency; std::tie(min_latency, max_latency) = blink::GetMinMaxLatenciesForAudioParameters(device_parameters); capabilities.latency = {std::min(fallback_latency, min_latency), std::max(fallback_latency, max_latency)}; } capabilities.device_id = blink::WebString::FromUTF8(device.id); if (device.group_id) capabilities.group_id = blink::WebString::FromUTF8(*device.group_id); source->SetPlatformSource(std::move(audio_source)); source->SetCapabilities(capabilities); return source; } std::unique_ptr<blink::MediaStreamAudioSource> UserMediaProcessor::CreateAudioSource( const MediaStreamDevice& device, blink::WebPlatformMediaStreamSource::ConstraintsRepeatingCallback source_ready) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); StreamControls* stream_controls = current_request_info_->stream_controls(); // If the audio device is a loopback device (for screen capture), or if the // constraints/effects parameters indicate no audio processing is needed, // create an efficient, direct-path MediaStreamAudioSource instance. blink::AudioProcessingProperties audio_processing_properties = current_request_info_->audio_capture_settings() .audio_processing_properties(); if (blink::IsScreenCaptureMediaType(device.type) || !blink::MediaStreamAudioProcessor::WouldModifyAudio( audio_processing_properties)) { return std::make_unique<blink::LocalMediaStreamAudioSource>( frame_, device, base::OptionalOrNullptr(current_request_info_->audio_capture_settings() .requested_buffer_size()), stream_controls->disable_local_echo, std::move(source_ready), task_runner_); } // The audio device is not associated with screen capture and also requires // processing. return std::make_unique<blink::ProcessedLocalAudioSource>( frame_, device, stream_controls->disable_local_echo, audio_processing_properties, std::move(source_ready), task_runner_); } std::unique_ptr<blink::MediaStreamVideoSource> UserMediaProcessor::CreateVideoSource( const MediaStreamDevice& device, blink::WebPlatformMediaStreamSource::SourceStoppedCallback stop_callback) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); DCHECK(current_request_info_->video_capture_settings().HasValue()); return std::make_unique<blink::MediaStreamVideoCapturerSource>( frame_, std::move(stop_callback), device, current_request_info_->video_capture_settings().capture_params(), WTF::BindRepeating( &blink::LocalVideoCapturerSource::Create, frame_->GetTaskRunner(blink::TaskType::kInternalMedia))); } void UserMediaProcessor::StartTracks(const String& label) { DCHECK(current_request_info_->request()); SendLogMessage(base::StringPrintf("StartTracks({request_id=%d}, {label=%s})", current_request_info_->request_id(), label.Utf8().c_str())); if (auto* media_stream_device_observer = GetMediaStreamDeviceObserver()) { media_stream_device_observer->AddStream( blink::WebString(label), ToStdVector(current_request_info_->audio_devices()), ToStdVector(current_request_info_->video_devices()), WTF::BindRepeating(&UserMediaProcessor::OnDeviceStopped, WrapWeakPersistent(this)), WTF::BindRepeating(&UserMediaProcessor::OnDeviceChanged, WrapWeakPersistent(this)), WTF::BindRepeating(&UserMediaProcessor::OnDeviceRequestStateChange, WrapWeakPersistent(this))); } HeapVector<Member<MediaStreamComponent>> audio_tracks( current_request_info_->audio_devices().size()); CreateAudioTracks(current_request_info_->audio_devices(), &audio_tracks); HeapVector<Member<MediaStreamComponent>> video_tracks( current_request_info_->video_devices().size()); CreateVideoTracks(current_request_info_->video_devices(), &video_tracks); String blink_id = label; current_request_info_->InitializeWebStream(blink_id, audio_tracks, video_tracks); // Wait for the tracks to be started successfully or to fail. current_request_info_->CallbackOnTracksStarted( WTF::Bind(&UserMediaProcessor::OnCreateNativeTracksCompleted, WrapWeakPersistent(this), label)); } void UserMediaProcessor::CreateVideoTracks( const Vector<MediaStreamDevice>& devices, HeapVector<Member<MediaStreamComponent>>* components) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); DCHECK_EQ(devices.size(), components->size()); SendLogMessage(base::StringPrintf("UMP::CreateVideoTracks({request_id=%d})", current_request_info_->request_id())); for (WTF::wtf_size_t i = 0; i < devices.size(); ++i) { MediaStreamSource* source = InitializeVideoSourceObject(devices[i]); (*components)[i] = current_request_info_->CreateAndStartVideoTrack(source); } } void UserMediaProcessor::CreateAudioTracks( const Vector<MediaStreamDevice>& devices, HeapVector<Member<MediaStreamComponent>>* components) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(current_request_info_); DCHECK_EQ(devices.size(), components->size()); Vector<MediaStreamDevice> overridden_audio_devices = devices; bool render_to_associated_sink = current_request_info_->audio_capture_settings().HasValue() && current_request_info_->audio_capture_settings() .render_to_associated_sink(); SendLogMessage( base::StringPrintf("CreateAudioTracks({render_to_associated_sink=%d})", render_to_associated_sink)); if (!render_to_associated_sink) { // If the GetUserMedia request did not explicitly set the constraint // kMediaStreamRenderToAssociatedSink, the output device id must // be removed. for (auto& device : overridden_audio_devices) device.matched_output_device_id.reset(); } for (WTF::wtf_size_t i = 0; i < overridden_audio_devices.size(); ++i) { bool is_pending = false; MediaStreamSource* source = InitializeAudioSourceObject(overridden_audio_devices[i], &is_pending); (*components)[i] = MakeGarbageCollected<MediaStreamComponent>(source); current_request_info_->StartAudioTrack((*components)[i], is_pending); // At this point the source has started, and its audio parameters have been // set. Thus, all audio processing properties are known and can be surfaced // to |source|. SurfaceAudioProcessingSettings(source); } } void UserMediaProcessor::OnCreateNativeTracksCompleted( const String& label, RequestInfo* request_info, MediaStreamRequestResult result, const String& constraint_name) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); SendLogMessage(base::StringPrintf( "UMP::OnCreateNativeTracksCompleted({request_id = %d}, {label=%s})", request_info->request_id(), label.Utf8().c_str())); if (result == MediaStreamRequestResult::OK) { GetUserMediaRequestSucceeded(request_info->descriptor(), request_info->request()); GetMediaStreamDispatcherHost()->OnStreamStarted(label); } else { GetUserMediaRequestFailed(result, constraint_name); for (auto web_track : request_info->descriptor()->AudioComponents()) { MediaStreamTrackPlatform* track = MediaStreamTrackPlatform::GetTrack(WebMediaStreamTrack(web_track)); if (track) track->Stop(); } for (auto web_track : request_info->descriptor()->VideoComponents()) { MediaStreamTrackPlatform* track = MediaStreamTrackPlatform::GetTrack(WebMediaStreamTrack(web_track)); if (track) track->Stop(); } } DeleteUserMediaRequest(request_info->request()); } void UserMediaProcessor::GetUserMediaRequestSucceeded( MediaStreamDescriptor* descriptor, UserMediaRequest* user_media_request) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(IsCurrentRequestInfo(user_media_request)); SendLogMessage( base::StringPrintf("GetUserMediaRequestSucceeded({request_id=%d})", current_request_info_->request_id())); // Completing the getUserMedia request can lead to that the RenderFrame and // the UserMediaClient/UserMediaProcessor are destroyed if the JavaScript // code request the frame to be destroyed within the scope of the callback. // Therefore, post a task to complete the request with a clean stack. task_runner_->PostTask( FROM_HERE, WTF::Bind(&UserMediaProcessor::DelayedGetUserMediaRequestSucceeded, WrapWeakPersistent(this), current_request_info_->request_id(), WrapPersistent(descriptor), WrapPersistent(user_media_request))); } void UserMediaProcessor::DelayedGetUserMediaRequestSucceeded( int request_id, MediaStreamDescriptor* component, UserMediaRequest* user_media_request) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); SendLogMessage(base::StringPrintf( "DelayedGetUserMediaRequestSucceeded({request_id=%d}, {result=%s})", request_id, MediaStreamRequestResultToString(MediaStreamRequestResult::OK))); blink::LogUserMediaRequestResult(MediaStreamRequestResult::OK); DeleteUserMediaRequest(user_media_request); user_media_request->Succeed(component); } void UserMediaProcessor::GetUserMediaRequestFailed( MediaStreamRequestResult result, const String& constraint_name) { DCHECK(current_request_info_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); SendLogMessage( base::StringPrintf("GetUserMediaRequestFailed({request_id=%d})", current_request_info_->request_id())); // Completing the getUserMedia request can lead to that the RenderFrame and // the UserMediaClient/UserMediaProcessor are destroyed if the JavaScript // code request the frame to be destroyed within the scope of the callback. // Therefore, post a task to complete the request with a clean stack. task_runner_->PostTask( FROM_HERE, WTF::Bind(&UserMediaProcessor::DelayedGetUserMediaRequestFailed, WrapWeakPersistent(this), current_request_info_->request_id(), WrapPersistent(current_request_info_->request()), result, constraint_name)); } void UserMediaProcessor::DelayedGetUserMediaRequestFailed( int request_id, UserMediaRequest* user_media_request, MediaStreamRequestResult result, const String& constraint_name) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); blink::LogUserMediaRequestResult(result); SendLogMessage(base::StringPrintf( "DelayedGetUserMediaRequestFailed({request_id=%d}, {result=%s})", request_id, MediaStreamRequestResultToString(result))); DeleteUserMediaRequest(user_media_request); switch (result) { case MediaStreamRequestResult::OK: case MediaStreamRequestResult::NUM_MEDIA_REQUEST_RESULTS: NOTREACHED(); return; case MediaStreamRequestResult::PERMISSION_DENIED: user_media_request->Fail(UserMediaRequest::Error::kPermissionDenied, "Permission denied"); return; case MediaStreamRequestResult::PERMISSION_DISMISSED: user_media_request->Fail(UserMediaRequest::Error::kPermissionDismissed, "Permission dismissed"); return; case MediaStreamRequestResult::INVALID_STATE: user_media_request->Fail(UserMediaRequest::Error::kInvalidState, "Invalid state"); return; case MediaStreamRequestResult::NO_HARDWARE: user_media_request->Fail(UserMediaRequest::Error::kDevicesNotFound, "Requested device not found"); return; case MediaStreamRequestResult::INVALID_SECURITY_ORIGIN: user_media_request->Fail(UserMediaRequest::Error::kSecurityError, "Invalid security origin"); return; case MediaStreamRequestResult::TAB_CAPTURE_FAILURE: user_media_request->Fail(UserMediaRequest::Error::kTabCapture, "Error starting tab capture"); return; case MediaStreamRequestResult::SCREEN_CAPTURE_FAILURE: user_media_request->Fail(UserMediaRequest::Error::kScreenCapture, "Error starting screen capture"); return; case MediaStreamRequestResult::CAPTURE_FAILURE: user_media_request->Fail(UserMediaRequest::Error::kCapture, "Error starting capture"); return; case MediaStreamRequestResult::CONSTRAINT_NOT_SATISFIED: user_media_request->FailConstraint(constraint_name, ""); return; case MediaStreamRequestResult::TRACK_START_FAILURE_AUDIO: user_media_request->Fail(UserMediaRequest::Error::kTrackStart, "Could not start audio source"); return; case MediaStreamRequestResult::TRACK_START_FAILURE_VIDEO: user_media_request->Fail(UserMediaRequest::Error::kTrackStart, "Could not start video source"); return; case MediaStreamRequestResult::NOT_SUPPORTED: user_media_request->Fail(UserMediaRequest::Error::kNotSupported, "Not supported"); return; case MediaStreamRequestResult::FAILED_DUE_TO_SHUTDOWN: user_media_request->Fail(UserMediaRequest::Error::kFailedDueToShutdown, "Failed due to shutdown"); return; case MediaStreamRequestResult::KILL_SWITCH_ON: user_media_request->Fail(UserMediaRequest::Error::kKillSwitchOn, ""); return; case MediaStreamRequestResult::SYSTEM_PERMISSION_DENIED: user_media_request->Fail(UserMediaRequest::Error::kSystemPermissionDenied, "Permission denied by system"); return; } NOTREACHED(); user_media_request->Fail(UserMediaRequest::Error::kPermissionDenied, ""); } MediaStreamSource* UserMediaProcessor::FindLocalSource( const LocalStreamSources& sources, const MediaStreamDevice& device) const { for (auto local_source : sources) { WebPlatformMediaStreamSource* const source = local_source->GetPlatformSource(); const MediaStreamDevice& active_device = source->device(); if (IsSameDevice(active_device, device)) return local_source; } return nullptr; } MediaStreamSource* UserMediaProcessor::FindOrInitializeSourceObject( const MediaStreamDevice& device) { MediaStreamSource* existing_source = FindLocalSource(device); if (existing_source) { DVLOG(1) << "Source already exists. Reusing source with id " << existing_source->Id().Utf8(); return existing_source; } MediaStreamSource::StreamType type = IsAudioInputMediaType(device.type) ? MediaStreamSource::kTypeAudio : MediaStreamSource::kTypeVideo; auto* source = MakeGarbageCollected<MediaStreamSource>( String::FromUTF8(device.id), type, String::FromUTF8(device.name), false /* remote */); if (device.group_id) source->SetGroupId(String::FromUTF8(*device.group_id)); return source; } bool UserMediaProcessor::RemoveLocalSource(MediaStreamSource* source) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); SendLogMessage(base::StringPrintf( "RemoveLocalSource({id=%s}, {name=%s}, {group_id=%s})", source->Id().Utf8().c_str(), source->GetName().Utf8().c_str(), source->GroupId().Utf8().c_str())); for (auto* device_it = local_sources_.begin(); device_it != local_sources_.end(); ++device_it) { if (IsSameSource(*device_it, source)) { local_sources_.erase(device_it); return true; } } // Check if the source was pending. for (auto* device_it = pending_local_sources_.begin(); device_it != pending_local_sources_.end(); ++device_it) { if (IsSameSource(*device_it, source)) { WebPlatformMediaStreamSource* const source_extra_data = source->GetPlatformSource(); const bool is_audio_source = source->GetType() == MediaStreamSource::kTypeAudio; NotifyCurrentRequestInfoOfAudioSourceStarted( source_extra_data, is_audio_source ? MediaStreamRequestResult::TRACK_START_FAILURE_AUDIO : MediaStreamRequestResult::TRACK_START_FAILURE_VIDEO, String::FromUTF8(is_audio_source ? "Failed to access audio capture device" : "Failed to access video capture device")); pending_local_sources_.erase(device_it); return true; } } return false; } bool UserMediaProcessor::IsCurrentRequestInfo(int request_id) const { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return current_request_info_ && current_request_info_->request_id() == request_id; } bool UserMediaProcessor::IsCurrentRequestInfo( UserMediaRequest* user_media_request) const { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return current_request_info_ && current_request_info_->request() == user_media_request; } bool UserMediaProcessor::DeleteUserMediaRequest( UserMediaRequest* user_media_request) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (current_request_info_ && current_request_info_->request() == user_media_request) { current_request_info_ = nullptr; std::move(request_completed_cb_).Run(); return true; } return false; } void UserMediaProcessor::StopAllProcessing() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (current_request_info_) { switch (current_request_info_->state()) { case RequestInfo::State::SENT_FOR_GENERATION: // Let the browser process know that the previously sent request must be // canceled. GetMediaStreamDispatcherHost()->CancelRequest( current_request_info_->request_id()); FALLTHROUGH; case RequestInfo::State::NOT_SENT_FOR_GENERATION: LogUserMediaRequestWithNoResult( blink::MEDIA_STREAM_REQUEST_NOT_GENERATED); break; case RequestInfo::State::GENERATED: LogUserMediaRequestWithNoResult( blink::MEDIA_STREAM_REQUEST_PENDING_MEDIA_TRACKS); break; } current_request_info_ = nullptr; } request_completed_cb_.Reset(); // Loop through all current local sources and stop the sources. auto* it = local_sources_.begin(); while (it != local_sources_.end()) { StopLocalSource(*it, true); it = local_sources_.erase(it); } } void UserMediaProcessor::OnLocalSourceStopped( const blink::WebMediaStreamSource& source) { // The client can be null if the frame is already detached. // If it's already detached, dispatcher_host_ shouldn't be bound again. // (ref: crbug.com/1105842) if (!frame_->Client()) return; DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); blink::WebPlatformMediaStreamSource* source_impl = source.GetPlatformSource(); SendLogMessage(base::StringPrintf( "OnLocalSourceStopped({session_id=%s})", source_impl->device().session_id().ToString().c_str())); const bool some_source_removed = RemoveLocalSource(source); CHECK(some_source_removed); if (auto* media_stream_device_observer = GetMediaStreamDeviceObserver()) media_stream_device_observer->RemoveStreamDevice(source_impl->device()); String device_id(source_impl->device().id.data()); GetMediaStreamDispatcherHost()->StopStreamDevice( device_id, source_impl->device().serializable_session_id()); } void UserMediaProcessor::StopLocalSource(MediaStreamSource* source, bool notify_dispatcher) { WebPlatformMediaStreamSource* source_impl = source->GetPlatformSource(); SendLogMessage(base::StringPrintf( "StopLocalSource({session_id=%s})", source_impl->device().session_id().ToString().c_str())); if (notify_dispatcher) { if (auto* media_stream_device_observer = GetMediaStreamDeviceObserver()) media_stream_device_observer->RemoveStreamDevice(source_impl->device()); String device_id(source_impl->device().id.data()); GetMediaStreamDispatcherHost()->StopStreamDevice( device_id, source_impl->device().serializable_session_id()); } source_impl->ResetSourceStoppedCallback(); source_impl->StopSource(); } bool UserMediaProcessor::HasActiveSources() const { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return !local_sources_.IsEmpty(); } blink::mojom::blink::MediaStreamDispatcherHost* UserMediaProcessor::GetMediaStreamDispatcherHost() { if (!dispatcher_host_.is_bound()) { frame_->GetBrowserInterfaceBroker().GetInterface( dispatcher_host_.BindNewPipeAndPassReceiver(task_runner_)); } return dispatcher_host_.get(); } blink::mojom::blink::MediaDevicesDispatcherHost* UserMediaProcessor::GetMediaDevicesDispatcher() { return media_devices_dispatcher_cb_.Run(); } const blink::AudioCaptureSettings& UserMediaProcessor::AudioCaptureSettingsForTesting() const { DCHECK(current_request_info_); return current_request_info_->audio_capture_settings(); } const blink::VideoCaptureSettings& UserMediaProcessor::VideoCaptureSettingsForTesting() const { DCHECK(current_request_info_); return current_request_info_->video_capture_settings(); } void UserMediaProcessor::SetMediaStreamDeviceObserverForTesting( WebMediaStreamDeviceObserver* media_stream_device_observer) { DCHECK(!GetMediaStreamDeviceObserver()); DCHECK(media_stream_device_observer); media_stream_device_observer_for_testing_ = media_stream_device_observer; } } // namespace blink
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
caa8586b9a1a1640c417def0b6faa2f09b4d2c96
490abe0915a71a3e60ee0552aea9401fa6a4f88a
/Boost.cpp
3d91422d218ec6c4a00888ded5648c5fcc46a992
[]
no_license
patrickhno/meteorites
cc69532735bcee793c91f83ccdab0a15ed0a025c
d075ff784a971a01ad7d1af508c22e0ccfaa4bf2
refs/heads/master
2020-05-20T01:10:32.837063
2014-04-25T18:26:55
2014-04-25T18:26:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,164
cpp
#if 0 // Copyright (C) 1997-1998 RealityMakers Entertainment as // All rights reserved. #include <posix/stdlib.h> //#include <Interface/Debug.h> #include "Boost.h" #include <3dapi/Material.h> #include <3dapi/Texture.h> #include <3dapi/Geometry.h> #include <3dapi/IndexedPolygon.h> #include <assert.h> BoostAI::BoostAI(Geometry *c, Geometry *_ship) : Intelligence(c){ // ,KernelClient(){ geo = c; c->SetName(0,"Boost"); ship = _ship; Boost = new Material("Textures/Boost/Flame",Texture::cRGB); Boost->SetMode(MATERIAL_DEST_ADD_SOURCE|MATERIAL_SOURCE_DIFFUSE); Boost->CacheAll(); c->Apply(Boost); c->Add(Vector(-5*4,-20*4,0)); c->Add(Vector( 5*4,-20*4,0)); c->Add(Vector( 5*4, 20*4,0)); c->Add(Vector(-5*4, 20*4,0)); c->Add(Vertex(0,0,0)); c->Add(Vertex(1,1,0)); c->Add(Vertex(2,1,1)); c->Add(Vertex(3,0,1)); IndexedPolygon *pol; pol = c->NewIndexedPolygon(); pol->Add(0); pol->Add(1); pol->Add(2); pol->Add(3); pol = c->NewIndexedPolygon(); pol->Add(3); pol->Add(2); pol->Add(1); pol->Add(0); OldVelocity = Vector(0,0,0); pol = 0; Activate(); } BoostAI::~BoostAI(){ delete Boost; } bool BoostAI::Tick(double time){ int framecount = GetCreatorGeometry()->GetMaterial()->GetTexture()->GetFrameCount(); int frame = rand()%(framecount-1); if(framecount) GetCreatorGeometry()->GetMaterial()->GetTexture()->SetFrame(frame); // Geometry *geo = GetGeometry("Player1"); // if(geo){ // float val = (Vector(ship->GetIntelligence()->GetVelocity())-OldVelocity).Lenght(); Intelligence *ai = ship->GetIntelligence(); if(ai){ Vector vel = Vector(ai->GetVelocity()); vel-=OldVelocity; float val = vel.Lenght()*2.0f; OldVelocity = Vector(ship->GetIntelligence()->GetVelocity()); if(val<200){ SetVector(2,Vector( 5*4, val-20,0)); SetVector(3,Vector(-5*4, val-20,0)); } } // } return true; } void BoostAI::Activate(void){ assert(pol==0); pol = new IndexedPolygon(geo); pol->Add(3); pol->Add(2); pol->Add(1); pol->Add(0); } void BoostAI::Deactivate(void){ if(pol) delete pol; pol = 0; } #endif
[ "patrick.hanevold@gmail.com" ]
patrick.hanevold@gmail.com
d9dee862e6c71aa79eaff7ef32a2b889b922516b
0cda2dcf353c9dbb42e7b820861929948b9942ea
/fileedit/2009/mytmp.cpp
87c5528a9676b96a7fcd892a35976616522efc8f
[]
no_license
naoyat/topcoder
618853a31fa339ac6aa8e7099ceedcdd1eb67c64
ec1a691cd0f56359f3de899b03eada9efa01f31d
refs/heads/master
2020-05-30T23:14:10.356754
2010-01-17T04:03:52
2010-01-17T04:03:52
176,567
1
1
null
null
null
null
UTF-8
C++
false
false
399
cpp
#line 42 "Time.cpp" #include <string> #include <vector> #include <iostream> #include <sstream> using namespace std; class Time { public: string whatTime(int seconds) { int minutes = seconds / 60; int hours = minutes / 60; int s = seconds % 60; int m = minutes % 60; // int h = hours % 24; stringstream ss; ss << hours << ":" << m << ":" << s; return ss.str(); } };
[ "naoya_t@users.sourceforge.jp" ]
naoya_t@users.sourceforge.jp
222fda80c9f848be26478908408ece2df685488d
9ab4296413534b107b1d0618819c2039f157cd9c
/day_4/part2.cpp
0a87d34c2ddef77bd98ae5cfafa5fa6dee418f45
[]
no_license
zachs18/advent-of-code-2020
20a09c273f2583c28f5240411c545c7b360f4f9e
1a94e2233e0c95371ca0b91f117662aa34a520af
refs/heads/main
2023-06-04T20:54:44.686461
2021-06-23T20:47:31
2021-06-23T20:47:31
319,221,117
1
0
null
null
null
null
UTF-8
C++
false
false
3,965
cpp
#include <cstdlib> #include <iostream> #include <iterator> #include <vector> #include <map> #include <set> #include <string> #include <sstream> #include <ranges> #include <functional> class passport { static const std::map<std::string, std::function<bool(std::string_view)>> required_fields; static const std::map<std::string, std::function<bool(std::string_view)>> optional_fields; public: std::map<std::string, std::string> m_fields; bool valid(void) const { if (m_fields.size() < required_fields.size()) return false; for (const auto &[field, validator] : required_fields) { if (auto it = m_fields.find(field); it == m_fields.end() || !validator(it->second)) { return false; } } unsigned optional_count = 0; for (const auto &[field, validator] : optional_fields) { if (auto it = m_fields.find(field); it != m_fields.end() && validator(it->second)) { ++optional_count; } } return m_fields.size() == required_fields.size() + optional_count; } }; std::optional<unsigned> to_number_no_sign(std::string_view val) { unsigned v = 0; for (auto c : val) { if (!std::isdigit(c)) return {}; v = v * 10 + (c - '0'); } return v; } std::optional<int> to_number(std::string_view val) { if (val.size() == 0) return {}; if (val[0] == '-') { val.remove_prefix(1); if (auto i = to_number_no_sign(val)) return -*i; } else { if (auto i = to_number_no_sign(val)) return *i; } return {}; } const std::map<std::string, std::function<bool(std::string_view)>> passport::required_fields{ {"byr", [](std::string_view byr) -> bool { const auto birth_year = to_number(byr); return birth_year.has_value() && birth_year >= 1920 && birth_year <= 2002; }}, {"iyr", [](std::string_view iyr) -> bool { const auto issue_year = to_number(iyr); return issue_year.has_value() && issue_year >= 2010 && issue_year <= 2020; }}, {"eyr", [](std::string_view eyr) -> bool { const auto expiration_year = to_number(eyr); return expiration_year.has_value() && expiration_year >= 2020 && expiration_year <= 2030; }}, {"hgt", [](std::string_view hgt) -> bool { if (hgt.size() < 2) return false; auto units = hgt; units.remove_prefix(units.size()-2); hgt.remove_suffix(2); const auto height = to_number(hgt); return height.has_value() && ( (units == "cm" && height >= 150 && height <= 193) || (units == "in" && height >= 59 && height <= 76) ); }}, {"hcl", [](std::string_view hcl) -> bool { return hcl.size() == 7 && hcl[0] == '#' && std::all_of( hcl.begin()+1, hcl.end(), [](char c) -> bool { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f'); } ); }}, {"ecl", [](std::string_view ecl) -> bool { static const std::set<std::string_view> valid_eye_colors{ "amb", "blu", "brn", "gry", "grn", "hzl", "oth" }; return valid_eye_colors.find(ecl) != valid_eye_colors.end(); }}, {"pid", [](std::string_view pid) -> bool { if (pid.size() != 9) return false; const auto passport_id = to_number_no_sign(pid); return passport_id.has_value(); }}, }; const std::map<std::string, std::function<bool(std::string_view)>> passport::optional_fields{ {"cid", [](auto) { return true; }} }; std::istream &operator>>(std::istream &str, passport &ppt) { ppt.m_fields.clear(); std::string line; bool any = false; while (getline(str, line) && line.size() > 0) { any = true; std::istringstream iss{line}; std::string kv_pair; while (iss >> kv_pair) { auto colon_index = kv_pair.find(':'); ppt.m_fields[kv_pair.substr(0, colon_index)] = kv_pair.substr(1+colon_index); } } if (any) str.clear(); return str; } int main(int argc, char **argv) { std::ranges::subrange passports{ std::istream_iterator<passport>{std::cin}, std::istream_iterator<passport>{} }; unsigned valid_count = 0; for (const auto &ppt : passports) { if (ppt.valid()) ++valid_count; } std::cout << valid_count << '\n'; return EXIT_SUCCESS; // return EXIT_FAILURE; }
[ "zasample18+github@gmail.com" ]
zasample18+github@gmail.com
ca0345f9f3ceebfafea585412c32f96e1979ec40
954c2172c7a93596685ad0317500b47088adbfc1
/SharedLibrary/Source/Audio/AudioStream.h
82793578007fcc9df34d2477e9dd7e657dcbe874
[]
no_license
hank5925/HiveReturns
92defc704e0ed1ad07c72a7bbb756e2c82f694c5
69204b391a1fc3e30743a35af444c8a2830c4259
refs/heads/master
2016-09-06T19:11:37.549342
2014-05-01T02:20:28
2014-05-01T02:20:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,445
h
// // AudioStream.h // HiveReturn // // Created by Govinda Ram Pingali on 3/7/14. // Copyright (c) 2014 GTCMT. All rights reserved. // #ifndef __HiveReturn__AudioStream__ #define __HiveReturn__AudioStream__ #include "SharedLibraryHeader.h" #include "AudioEffects.h" #include <cfloat> class AudioStream : public AudioIODeviceCallback { public: AudioStream(); ~AudioStream(); void audioDeviceIOCallback(const float** inputChannelData, int totalNumInputChannels, float** outputChannelData, int totalNumOutputChannels, int blockSize) override; void audioDeviceAboutToStart (AudioIODevice* device) override; void audioDeviceStopped() override; void setEffectParam(int effectID, int parameterID, float value); void setEffectStatus(int effectID); void setMicGain(float newGainValue); private: AudioDeviceManager::AudioDeviceSetup deviceSetup; CVibrato *pMyVibrato; bool vibratoStatus; CDelay *pMyDelay; bool delayStatus; CLPF *pMyLPF; bool lowpassStatus; CRingModulator *pMyRingModulator; bool ringModulatorStatus; float fSampleRate; int iNumChannel; float **ppfOutputBuffer; float inputMicGain; float paramValue1; float paramValue2; float paramValue3; // alloc my effects here }; #endif /* defined(__HiveReturn__AudioStream__) */
[ "cwu307@gatech.edu" ]
cwu307@gatech.edu
269486d34a6226c838766b6475f8b85c396b0152
600df3590cce1fe49b9a96e9ca5b5242884a2a70
/buildtools/third_party/libc++/trunk/src/include/atomic_support.h
dbf3b9c81ea4bc83763020a43882557fa166ee22
[ "NCSA", "MIT", "BSD-3-Clause" ]
permissive
metux/chromium-suckless
efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a
72a05af97787001756bae2511b7985e61498c965
refs/heads/orig
2022-12-04T23:53:58.681218
2017-04-30T10:59:06
2017-04-30T23:35:58
89,884,931
5
3
BSD-3-Clause
2022-11-23T20:52:53
2017-05-01T00:09:08
null
UTF-8
C++
false
false
4,287
h
#ifndef ATOMIC_SUPPORT_H #define ATOMIC_SUPPORT_H #include "__config" #include "memory" // for __libcpp_relaxed_load #if defined(__clang__) && __has_builtin(__atomic_load_n) \ && __has_builtin(__atomic_store_n) \ && __has_builtin(__atomic_add_fetch) \ && __has_builtin(__atomic_compare_exchange_n) \ && defined(__ATOMIC_RELAXED) \ && defined(__ATOMIC_CONSUME) \ && defined(__ATOMIC_ACQUIRE) \ && defined(__ATOMIC_RELEASE) \ && defined(__ATOMIC_ACQ_REL) \ && defined(__ATOMIC_SEQ_CST) # define _LIBCPP_HAS_ATOMIC_BUILTINS #elif !defined(__clang__) && defined(_GNUC_VER) && _GNUC_VER >= 407 # define _LIBCPP_HAS_ATOMIC_BUILTINS #endif #if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS) # if defined(_MSC_VER) && !defined(__clang__) _LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported") # else # warning Building libc++ without __atomic builtins is unsupported # endif #endif _LIBCPP_BEGIN_NAMESPACE_STD namespace { #if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS) enum __libcpp_atomic_order { _AO_Relaxed = __ATOMIC_RELAXED, _AO_Consume = __ATOMIC_CONSUME, _AO_Aquire = __ATOMIC_ACQUIRE, _AO_Release = __ATOMIC_RELEASE, _AO_Acq_Rel = __ATOMIC_ACQ_REL, _AO_Seq = __ATOMIC_SEQ_CST }; template <class _ValueType, class _FromType> inline _LIBCPP_INLINE_VISIBILITY void __libcpp_atomic_store(_ValueType* __dest, _FromType __val, int __order = _AO_Seq) { __atomic_store_n(__dest, __val, __order); } template <class _ValueType, class _FromType> inline _LIBCPP_INLINE_VISIBILITY void __libcpp_relaxed_store(_ValueType* __dest, _FromType __val) { __atomic_store_n(__dest, __val, _AO_Relaxed); } template <class _ValueType> inline _LIBCPP_INLINE_VISIBILITY _ValueType __libcpp_atomic_load(_ValueType const* __val, int __order = _AO_Seq) { return __atomic_load_n(__val, __order); } template <class _ValueType, class _AddType> inline _LIBCPP_INLINE_VISIBILITY _ValueType __libcpp_atomic_add(_ValueType* __val, _AddType __a, int __order = _AO_Seq) { return __atomic_add_fetch(__val, __a, __order); } template <class _ValueType> inline _LIBCPP_INLINE_VISIBILITY bool __libcpp_atomic_compare_exchange(_ValueType* __val, _ValueType* __expected, _ValueType __after, int __success_order = _AO_Seq, int __fail_order = _AO_Seq) { return __atomic_compare_exchange_n(__val, __expected, __after, true, __success_order, __fail_order); } #else // _LIBCPP_HAS_NO_THREADS enum __libcpp_atomic_order { _AO_Relaxed, _AO_Consume, _AO_Acquire, _AO_Release, _AO_Acq_Rel, _AO_Seq }; template <class _ValueType, class _FromType> inline _LIBCPP_INLINE_VISIBILITY void __libcpp_atomic_store(_ValueType* __dest, _FromType __val, int = 0) { *__dest = __val; } template <class _ValueType, class _FromType> inline _LIBCPP_INLINE_VISIBILITY void __libcpp_relaxed_store(_ValueType* __dest, _FromType __val) { *__dest = __val; } template <class _ValueType> inline _LIBCPP_INLINE_VISIBILITY _ValueType __libcpp_atomic_load(_ValueType const* __val, int = 0) { return *__val; } template <class _ValueType, class _AddType> inline _LIBCPP_INLINE_VISIBILITY _ValueType __libcpp_atomic_add(_ValueType* __val, _AddType __a, int = 0) { return *__val += __a; } template <class _ValueType> inline _LIBCPP_INLINE_VISIBILITY bool __libcpp_atomic_compare_exchange(_ValueType* __val, _ValueType* __expected, _ValueType __after, int = 0, int = 0) { if (*__val == *__expected) { *__val = __after; return true; } *__expected = *__val; return false; } #endif // _LIBCPP_HAS_NO_THREADS } // end namespace _LIBCPP_END_NAMESPACE_STD #endif // ATOMIC_SUPPORT_H
[ "enrico.weigelt@gr13.net" ]
enrico.weigelt@gr13.net
4d59b909d9b1e1f459e5cb40957b5451c9ea2dcf
9e4a00de1ec07e7e88872ef60c42a49bf65dc2b0
/Code/Libraries/Rodin/src/BTNodes/rodinbtnodeloop.h
bb1e035c52001515a756b24ffe95a50714cd5d41
[ "Zlib" ]
permissive
ptitSeb/Eldritch
6a5201949b13f6cd95d3d75928e375bdf785ffca
3cd6831a4eebb11babec831e2fc59361411ad57f
refs/heads/master
2021-07-10T18:45:05.892756
2021-04-25T14:16:19
2021-04-25T14:16:19
39,091,718
6
4
NOASSERTION
2021-04-25T14:16:20
2015-07-14T18:03:07
C
UTF-8
C++
false
false
503
h
#ifndef RODINBTNODELOOP_H #define RODINBTNODELOOP_H #include "rodinbtnodedecorator.h" class RodinBTNodeLoop : public RodinBTNodeDecorator { public: RodinBTNodeLoop(); virtual ~RodinBTNodeLoop(); DEFINE_RODINBTNODE_FACTORY( Loop ); virtual void InitializeFromDefinition( const SimpleString& DefinitionName ); virtual ETickStatus Tick( const float DeltaTime ); protected: bool m_CanFail; bool m_CanSucceed; float m_LastTickTime; }; #endif // RODINBTNODELOOP_H
[ "rajdakin@gmail.com" ]
rajdakin@gmail.com
b79c79ab1e697be4d6319db496540fda3fa037f6
0103ce0fa860abd9f76cfda4979d304d450aba25
/Tools/DumpRenderTree/win/TestRunnerWin.cpp
14f71e91aff9fae831225628f29ad8980372280c
[]
no_license
1C-Company-third-party/webkit
2dedcae3b5424dd5de1fee6151cd33b35d08567f
f7eec5c68105bea4d4a1dca91734170bdfd537b6
refs/heads/master
2022-11-08T12:23:55.380720
2019-04-18T12:13:32
2019-04-18T12:13:32
182,072,953
5
2
null
2022-10-18T10:56:03
2019-04-18T11:10:56
C++
UTF-8
C++
false
false
43,084
cpp
/* * Copyright (C) 2006-2014 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include "TestRunner.h" #include "DumpRenderTree.h" #include "EditingDelegate.h" #include "PolicyDelegate.h" #include "WorkQueue.h" #include "WorkQueueItem.h" #include <CoreFoundation/CoreFoundation.h> #include <JavaScriptCore/JSRetainPtr.h> #include <JavaScriptCore/JSStringRefBSTR.h> #include <JavaScriptCore/JavaScriptCore.h> #include <WebCore/COMPtr.h> #include <WebKitLegacy/WebKit.h> #include <WebKitLegacy/WebKitCOMAPI.h> #include <comutil.h> #include <shlguid.h> #include <shlwapi.h> #include <shobjidl.h> #include <string> #include <wtf/Assertions.h> #include <wtf/Platform.h> #include <wtf/RetainPtr.h> #include <wtf/Vector.h> using std::string; using std::wstring; static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath); TestRunner::~TestRunner() { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; // reset webview-related states back to default values in preparation for next test COMPtr<IWebViewEditing> viewEditing; if (FAILED(webView->QueryInterface(&viewEditing))) return; COMPtr<IWebEditingDelegate> delegate; if (FAILED(viewEditing->editingDelegate(&delegate))) return; COMPtr<EditingDelegate> editingDelegate(Query, viewEditing.get()); if (editingDelegate) editingDelegate->setAcceptsEditing(TRUE); } JSContextRef TestRunner::mainFrameJSContext() { return frame->globalContext(); } void TestRunner::addDisallowedURL(JSStringRef url) { // FIXME: Implement! fprintf(testResult, "ERROR: TestRunner::addDisallowedURL(JSStringRef) not implemented\n"); } bool TestRunner::callShouldCloseOnWebView() { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return false; COMPtr<IWebViewPrivate2> viewPrivate; if (FAILED(webView->QueryInterface(&viewPrivate))) return false; BOOL result; viewPrivate->shouldClose(&result); return result; } void TestRunner::clearAllApplicationCaches() { COMPtr<IWebApplicationCache> applicationCache; if (FAILED(WebKitCreateInstance(CLSID_WebApplicationCache, 0, IID_IWebApplicationCache, reinterpret_cast<void**>(&applicationCache)))) return; applicationCache->deleteAllApplicationCaches(); } long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef url) { COMPtr<IWebSecurityOrigin2> origin; if (FAILED(WebKitCreateInstance(CLSID_WebSecurityOrigin, 0, IID_IWebSecurityOrigin2, reinterpret_cast<void**>(&origin)))) return 0; COMPtr<IWebApplicationCache> applicationCache; if (FAILED(WebKitCreateInstance(CLSID_WebApplicationCache, 0, IID_IWebApplicationCache, reinterpret_cast<void**>(&applicationCache)))) return 0; _bstr_t urlBstr(JSStringCopyBSTR(url), false); origin->initWithURL(urlBstr.GetBSTR()); long long usage = 0; if (FAILED(applicationCache->diskUsageForOrigin(origin.get(), &usage))) return 0; return usage; } void TestRunner::clearApplicationCacheForOrigin(JSStringRef origin) { COMPtr<IWebSecurityOrigin2> securityOrigin; if (FAILED(WebKitCreateInstance(CLSID_WebSecurityOrigin, 0, IID_IWebSecurityOrigin2, reinterpret_cast<void**>(&securityOrigin)))) return; _bstr_t originBstr(JSStringCopyBSTR(origin), false); if (FAILED(securityOrigin->initWithURL(originBstr.GetBSTR()))) return; COMPtr<IWebApplicationCache> applicationCache; if (FAILED(WebKitCreateInstance(CLSID_WebApplicationCache, 0, IID_IWebApplicationCache, reinterpret_cast<void**>(&applicationCache)))) return; applicationCache->deleteCacheForOrigin(securityOrigin.get()); } JSValueRef TestRunner::originsWithApplicationCache(JSContextRef context) { // FIXME: Implement to get origins that have application caches. fprintf(testResult, "ERROR: TestRunner::originsWithApplicationCache(JSContextRef) not implemented\n"); return JSValueMakeUndefined(context); } void TestRunner::clearAllDatabases() { COMPtr<IWebDatabaseManager> databaseManager; COMPtr<IWebDatabaseManager> tmpDatabaseManager; if (FAILED(WebKitCreateInstance(CLSID_WebDatabaseManager, 0, IID_IWebDatabaseManager, (void**)&tmpDatabaseManager))) return; if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager))) return; databaseManager->deleteAllDatabases(); COMPtr<IWebDatabaseManager2> databaseManager2; if (FAILED(databaseManager->QueryInterface(&databaseManager2))) return; databaseManager2->deleteAllIndexedDatabases(); } void TestRunner::setStorageDatabaseIdleInterval(double) { // FIXME: Implement. Requires non-existant (on Windows) WebStorageManager fprintf(testResult, "ERROR: TestRunner::setStorageDatabaseIdleInterval(double) not implemented\n"); } void TestRunner::closeIdleLocalStorageDatabases() { // FIXME: Implement. Requires non-existant (on Windows) WebStorageManager fprintf(testResult, "ERROR: TestRunner::closeIdleLocalStorageDatabases(double) not implemented\n"); } void TestRunner::clearBackForwardList() { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebBackForwardList> backForwardList; if (FAILED(webView->backForwardList(&backForwardList))) return; COMPtr<IWebHistoryItem> item; if (FAILED(backForwardList->currentItem(&item))) return; // We clear the history by setting the back/forward list's capacity to 0 // then restoring it back and adding back the current item. int capacity; if (FAILED(backForwardList->capacity(&capacity))) return; backForwardList->setCapacity(0); backForwardList->setCapacity(capacity); backForwardList->addItem(item.get()); backForwardList->goToItem(item.get()); } JSStringRef TestRunner::copyDecodedHostName(JSStringRef name) { // FIXME: Implement! fprintf(testResult, "ERROR: TestRunner::copyDecodedHostName(JSStringRef) not implemented\n"); return 0; } JSStringRef TestRunner::copyEncodedHostName(JSStringRef name) { // FIXME: Implement! fprintf(testResult, "ERROR: TestRunner::copyEncodedHostName(JSStringRef) not implemented\n"); return 0; } void TestRunner::display() { displayWebView(); } void TestRunner::displayAndTrackRepaints() { displayWebView(); } void TestRunner::keepWebHistory() { COMPtr<IWebHistory> history; if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) return; COMPtr<IWebHistory> sharedHistory; if (SUCCEEDED(history->optionalSharedHistory(&sharedHistory)) && sharedHistory) return; if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(sharedHistory), reinterpret_cast<void**>(&sharedHistory)))) return; history->setOptionalSharedHistory(sharedHistory.get()); } int TestRunner::numberOfPendingGeolocationPermissionRequests() { // FIXME: Implement for Geolocation layout tests. fprintf(testResult, "ERROR: TestRunner::numberOfPendingGeolocationPermissionRequests() not implemented\n"); return -1; } bool TestRunner::isGeolocationProviderActive() { // FIXME: Implement for Geolocation layout tests. fprintf(testResult, "ERROR: TestRunner::isGeolocationProviderActive() not implemented\n"); return false; } size_t TestRunner::webHistoryItemCount() { COMPtr<IWebHistory> history; if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) return 0; COMPtr<IWebHistory> sharedHistory; if (FAILED(history->optionalSharedHistory(&sharedHistory)) || !sharedHistory) return 0; COMPtr<IWebHistoryPrivate> sharedHistoryPrivate; if (FAILED(sharedHistory->QueryInterface(&sharedHistoryPrivate))) return 0; int count = 0; if (FAILED(sharedHistoryPrivate->allItems(&count, 0))) return 0; return count; } void TestRunner::notifyDone() { // Same as on mac. This can be shared. if (m_waitToDump && !topLoadingFrame && !WorkQueue::singleton().count()) dump(); m_waitToDump = false; } void TestRunner::forceImmediateCompletion() { // Same as on mac. This can be shared. if (m_waitToDump && !WorkQueue::singleton().count()) dump(); m_waitToDump = false; } static wstring jsStringRefToWString(JSStringRef jsStr) { size_t length = JSStringGetLength(jsStr); Vector<WCHAR> buffer(length + 1, 0); memcpy(buffer.data(), JSStringGetCharactersPtr(jsStr), length * sizeof(WCHAR)); buffer[length] = 0; return buffer.data(); } JSStringRef TestRunner::pathToLocalResource(JSContextRef context, JSStringRef url) { wstring input(JSStringGetCharactersPtr(url), JSStringGetLength(url)); wstring localPath; if (!resolveCygwinPath(input, localPath)) { fprintf(testResult, "ERROR: Failed to resolve Cygwin path %S\n", input.c_str()); return nullptr; } return JSStringCreateWithCharacters(localPath.c_str(), localPath.length()); } void TestRunner::queueLoad(JSStringRef url, JSStringRef target) { COMPtr<IWebDataSource> dataSource; if (FAILED(frame->dataSource(&dataSource))) return; COMPtr<IWebURLResponse> response; if (FAILED(dataSource->response(&response)) || !response) return; _bstr_t responseURLBSTR; if (FAILED(response->URL(&responseURLBSTR.GetBSTR()))) return; wstring responseURL(responseURLBSTR, responseURLBSTR.length()); // FIXME: We should do real relative URL resolution here. int lastSlash = responseURL.rfind('/'); if (lastSlash != -1) responseURL = responseURL.substr(0, lastSlash); wstring wURL = jsStringRefToWString(url); wstring wAbsoluteURL = responseURL + TEXT("/") + wURL; JSRetainPtr<JSStringRef> jsAbsoluteURL(Adopt, JSStringCreateWithCharacters(wAbsoluteURL.data(), wAbsoluteURL.length())); WorkQueue::singleton().queue(new LoadItem(jsAbsoluteURL.get(), target)); } void TestRunner::setAcceptsEditing(bool acceptsEditing) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewEditing> viewEditing; if (FAILED(webView->QueryInterface(&viewEditing))) return; COMPtr<IWebEditingDelegate> delegate; if (FAILED(viewEditing->editingDelegate(&delegate))) return; EditingDelegate* editingDelegate = (EditingDelegate*)(IWebEditingDelegate*)delegate.get(); editingDelegate->setAcceptsEditing(acceptsEditing); } void TestRunner::setAlwaysAcceptCookies(bool alwaysAcceptCookies) { if (alwaysAcceptCookies == m_alwaysAcceptCookies) return; if (!::setAlwaysAcceptCookies(alwaysAcceptCookies)) return; m_alwaysAcceptCookies = alwaysAcceptCookies; } void TestRunner::setAppCacheMaximumSize(unsigned long long size) { COMPtr<IWebApplicationCache> applicationCache; if (FAILED(WebKitCreateInstance(CLSID_WebApplicationCache, 0, IID_IWebApplicationCache, reinterpret_cast<void**>(&applicationCache)))) return; applicationCache->setMaximumSize(size); } void TestRunner::setAuthorAndUserStylesEnabled(bool flag) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); if (!prefsPrivate) return; prefsPrivate->setAuthorAndUserStylesEnabled(flag); } void TestRunner::setCustomPolicyDelegate(bool setDelegate, bool permissive) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; if (!setDelegate) { webView->setPolicyDelegate(nullptr); return; } policyDelegate->setPermissive(permissive); webView->setPolicyDelegate(policyDelegate); } void TestRunner::setDatabaseQuota(unsigned long long quota) { COMPtr<IWebDatabaseManager> databaseManager; COMPtr<IWebDatabaseManager> tmpDatabaseManager; if (FAILED(WebKitCreateInstance(CLSID_WebDatabaseManager, 0, IID_IWebDatabaseManager, (void**)&tmpDatabaseManager))) return; if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager))) return; databaseManager->setQuota(TEXT("file:///"), quota); } void TestRunner::goBack() { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; BOOL ignore = TRUE; webView->goBack(&ignore); } void TestRunner::setDefersLoading(bool defers) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate2> viewPrivate; if (FAILED(webView->QueryInterface(&viewPrivate))) return; viewPrivate->setDefersCallbacks(defers); } void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme) { COMPtr<IWebViewPrivate2> webView; if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) return; _bstr_t schemeBSTR(JSStringCopyBSTR(scheme), false); webView->setDomainRelaxationForbiddenForURLScheme(forbidden, schemeBSTR.GetBSTR()); } void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) { // FIXME: Implement for DeviceOrientation layout tests. // See https://bugs.webkit.org/show_bug.cgi?id=30335. fprintf(testResult, "ERROR: TestRunner::setMockDeviceOrientation() not implemented\n"); } void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel) { // FIXME: Implement for Geolocation layout tests. // See https://bugs.webkit.org/show_bug.cgi?id=28264. fprintf(testResult, "ERROR: TestRunner::setMockGeolocationPosition() not implemented\n"); } void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message) { // FIXME: Implement for Geolocation layout tests. // See https://bugs.webkit.org/show_bug.cgi?id=28264. fprintf(testResult, "ERROR: TestRunner::setMockGeolocationPositionUnavailableError() not implemented\n"); } void TestRunner::setGeolocationPermission(bool allow) { // FIXME: Implement for Geolocation layout tests. setGeolocationPermissionCommon(allow); } void TestRunner::setIconDatabaseEnabled(bool) { } void TestRunner::setMainFrameIsFirstResponder(bool) { // Nothing to do here on Windows } void TestRunner::setPrivateBrowsingEnabled(bool privateBrowsingEnabled) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; preferences->setPrivateBrowsingEnabled(privateBrowsingEnabled); } void TestRunner::setXSSAuditorEnabled(bool enabled) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); if (!prefsPrivate) return; prefsPrivate->setXSSAuditorEnabled(enabled); } void TestRunner::setSpatialNavigationEnabled(bool enabled) { // FIXME: Implement for SpatialNavigation layout tests. fprintf(testResult, "ERROR: TestRunner::setSpatialNavigationEnabled(bool) not implemented\n"); } void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); if (!prefsPrivate) return; prefsPrivate->setAllowUniversalAccessFromFileURLs(enabled); } void TestRunner::setAllowFileAccessFromFileURLs(bool enabled) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); if (!prefsPrivate) return; prefsPrivate->setAllowFileAccessFromFileURLs(enabled); } void TestRunner::setNeedsStorageAccessFromFileURLsQuirk(bool needsQuirk) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); if (!prefsPrivate) return; // FIXME: <https://webkit.org/b/164575> Call IWebPreferencesPrivate method when available. } void TestRunner::setPopupBlockingEnabled(bool enabled) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; preferences->setJavaScriptCanOpenWindowsAutomatically(!enabled); } void TestRunner::setPluginsEnabled(bool flag) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; preferences->setPlugInsEnabled(flag); } void TestRunner::setJavaScriptCanAccessClipboard(bool enabled) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); if (!prefsPrivate) return; prefsPrivate->setJavaScriptCanAccessClipboard(enabled); } void TestRunner::setAutomaticLinkDetectionEnabled(bool) { // FIXME: Implement this. fprintf(testResult, "ERROR: TestRunner::setAutomaticLinkDetectionEnabled(bool) not implemented\n"); } void TestRunner::setTabKeyCyclesThroughElements(bool shouldCycle) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate2> viewPrivate; if (FAILED(webView->QueryInterface(&viewPrivate))) return; viewPrivate->setTabKeyCyclesThroughElements(shouldCycle ? TRUE : FALSE); } void TestRunner::setUseDashboardCompatibilityMode(bool flag) { // Not implemented on Windows. } void TestRunner::setUserStyleSheetEnabled(bool flag) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; preferences->setUserStyleSheetEnabled(flag); } bool appendComponentToPath(wstring& path, const wstring& component) { WCHAR buffer[MAX_PATH]; if (path.size() + 1 > MAX_PATH) return false; memcpy(buffer, path.data(), path.size() * sizeof(WCHAR)); buffer[path.size()] = '\0'; if (!PathAppendW(buffer, component.c_str())) return false; path = wstring(buffer); return true; } static bool followShortcuts(wstring& path) { if (PathFileExists(path.c_str())) return true; // Do we have a shortcut? wstring linkPath = path; linkPath.append(TEXT(".lnk")); if (!PathFileExists(linkPath.c_str())) return true; // We have a shortcut, find its target. COMPtr<IShellLink> shortcut(Create, CLSID_ShellLink); if (!shortcut) return false; COMPtr<IPersistFile> persistFile(Query, shortcut); if (!shortcut) return false; if (FAILED(persistFile->Load(linkPath.c_str(), STGM_READ))) return false; if (FAILED(shortcut->Resolve(0, 0))) return false; WCHAR targetPath[MAX_PATH]; DWORD targetPathLen = _countof(targetPath); if (FAILED(shortcut->GetPath(targetPath, targetPathLen, 0, 0))) return false; if (!PathFileExists(targetPath)) return false; // Use the target path as the result path instead. path = wstring(targetPath); return true; } static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath) { wstring fileProtocol = L"file://"; bool isFileProtocol = cygwinPath.find(fileProtocol) != string::npos; if (cygwinPath[isFileProtocol ? 7 : 0] != '/') // ensure path is absolute return false; // Get the Root path. WCHAR rootPath[MAX_PATH]; DWORD rootPathSize = _countof(rootPath); DWORD keyType; DWORD result = ::SHGetValueW(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/"), TEXT("native"), &keyType, &rootPath, &rootPathSize); if (result != ERROR_SUCCESS || keyType != REG_SZ) { // Cygwin 1.7 doesn't store Cygwin's root as a mount point anymore, because mount points are now stored in /etc/fstab. // However, /etc/fstab doesn't contain any information about where / is located as a Windows path, so we need to use Cygwin's // new registry key that has the root. result = ::SHGetValueW(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Cygwin\\setup"), TEXT("rootdir"), &keyType, &rootPath, &rootPathSize); if (result != ERROR_SUCCESS || keyType != REG_SZ) return false; } windowsPath = wstring(rootPath, rootPathSize); int oldPos = isFileProtocol ? 8 : 1; while (1) { int newPos = cygwinPath.find('/', oldPos); if (newPos == -1) { wstring pathComponent = cygwinPath.substr(oldPos); if (!appendComponentToPath(windowsPath, pathComponent)) return false; if (!followShortcuts(windowsPath)) return false; break; } wstring pathComponent = cygwinPath.substr(oldPos, newPos - oldPos); if (!appendComponentToPath(windowsPath, pathComponent)) return false; if (!followShortcuts(windowsPath)) return false; oldPos = newPos + 1; } if (isFileProtocol) windowsPath = fileProtocol + windowsPath; return true; } void TestRunner::setUserStyleSheetLocation(JSStringRef jsURL) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; RetainPtr<CFStringRef> urlString = adoptCF(JSStringCopyCFString(0, jsURL)); RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithString(0, urlString.get(), 0)); if (!url) return; // Now copy the file system path, POSIX style. RetainPtr<CFStringRef> pathCF = adoptCF(CFURLCopyFileSystemPath(url.get(), kCFURLPOSIXPathStyle)); if (!pathCF) return; wstring path = cfStringRefToWString(pathCF.get()); wstring resultPath; if (!resolveCygwinPath(path, resultPath)) return; // The path has been resolved, now convert it back to a CFURL. int result = ::WideCharToMultiByte(CP_UTF8, 0, resultPath.c_str(), resultPath.size() + 1, nullptr, 0, nullptr, nullptr); Vector<char> utf8Vector(result); result = ::WideCharToMultiByte(CP_UTF8, 0, resultPath.c_str(), resultPath.size() + 1, utf8Vector.data(), result, nullptr, nullptr); if (!result) return; url = CFURLCreateFromFileSystemRepresentation(0, (const UInt8*)utf8Vector.data(), utf8Vector.size() - 1, false); if (!url) return; resultPath = cfStringRefToWString(CFURLGetString(url.get())); _bstr_t resultPathBSTR(resultPath.data()); preferences->setUserStyleSheetLocation(resultPathBSTR); } void TestRunner::setValueForUser(JSContextRef context, JSValueRef element, JSStringRef value) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate2> webViewPrivate(Query, webView); if (!webViewPrivate) return; COMPtr<IDOMElement> domElement; if (FAILED(webViewPrivate->elementFromJS(context, element, &domElement))) return; COMPtr<IDOMHTMLInputElement> domInputElement; if (FAILED(domElement->QueryInterface(IID_IDOMHTMLInputElement, reinterpret_cast<void**>(&domInputElement)))) return; _bstr_t valueBSTR(JSStringCopyBSTR(value), false); domInputElement->setValueForUser(valueBSTR); } void TestRunner::dispatchPendingLoadRequests() { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate2> viewPrivate; if (FAILED(webView->QueryInterface(&viewPrivate))) return; viewPrivate->dispatchPendingLoadRequests(); } void TestRunner::overridePreference(JSStringRef key, JSStringRef value) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); if (!prefsPrivate) return; _bstr_t keyBSTR(JSStringCopyBSTR(key), false); _bstr_t valueBSTR(JSStringCopyBSTR(value), false); prefsPrivate->setPreferenceForTest(keyBSTR, valueBSTR); } void TestRunner::removeAllVisitedLinks() { COMPtr<IWebHistory> history; if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast<void**>(&history)))) return; COMPtr<IWebHistory> sharedHistory; if (FAILED(history->optionalSharedHistory(&sharedHistory)) || !sharedHistory) return; COMPtr<IWebHistoryPrivate> sharedHistoryPrivate; if (FAILED(sharedHistory->QueryInterface(&sharedHistoryPrivate))) return; sharedHistoryPrivate->removeAllVisitedLinks(); } void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef jsURL) { RetainPtr<CFStringRef> urlString = adoptCF(JSStringCopyCFString(0, jsURL)); ::setPersistentUserStyleSheetLocation(urlString.get()); } void TestRunner::clearPersistentUserStyleSheet() { ::setPersistentUserStyleSheetLocation(nullptr); } void TestRunner::setWindowIsKey(bool flag) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate2> viewPrivate; if (FAILED(webView->QueryInterface(&viewPrivate))) return; HWND webViewWindow; if (FAILED(viewPrivate->viewWindow(&webViewWindow))) return; ::SendMessage(webViewWindow, flag ? WM_SETFOCUS : WM_KILLFOCUS, (WPARAM)::GetDesktopWindow(), 0); } void TestRunner::setViewSize(double width, double height) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate2> viewPrivate; if (FAILED(webView->QueryInterface(&viewPrivate))) return; HWND webViewWindow; if (FAILED(viewPrivate->viewWindow(&webViewWindow))) return; ::SetWindowPos(webViewWindow, 0, 0, 0, width, height, SWP_NOMOVE); } static void CALLBACK waitUntilDoneWatchdogFired(HWND, UINT, UINT_PTR, DWORD) { gTestRunner->waitToDumpWatchdogTimerFired(); } void TestRunner::setWaitToDump(bool waitUntilDone) { m_waitToDump = waitUntilDone; if (m_waitToDump && !waitToDumpWatchdog) waitToDumpWatchdog = SetTimer(0, 0, m_timeout, waitUntilDoneWatchdogFired); } int TestRunner::windowCount() { return openWindows().size(); } void TestRunner::execCommand(JSStringRef name, JSStringRef value) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate2> viewPrivate; if (FAILED(webView->QueryInterface(&viewPrivate))) return; _bstr_t nameBSTR(JSStringCopyBSTR(name), false); _bstr_t valueBSTR(JSStringCopyBSTR(value), false); viewPrivate->executeCoreCommandByName(nameBSTR, valueBSTR); } bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRef optionsArray) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return false; COMPtr<IWebViewPrivate3> viewPrivate; if (FAILED(webView->QueryInterface(&viewPrivate))) return false; unsigned char options = 0; JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length")); JSValueRef lengthValue = JSObjectGetProperty(context, optionsArray, lengthPropertyName.get(), nullptr); if (!JSValueIsNumber(context, lengthValue)) return false; _bstr_t targetBSTR(JSStringCopyBSTR(target), false); size_t length = static_cast<size_t>(JSValueToNumber(context, lengthValue, nullptr)); for (size_t i = 0; i < length; ++i) { JSValueRef value = JSObjectGetPropertyAtIndex(context, optionsArray, i, nullptr); if (!JSValueIsString(context, value)) continue; JSRetainPtr<JSStringRef> optionName(Adopt, JSValueToStringCopy(context, value, nullptr)); if (JSStringIsEqualToUTF8CString(optionName.get(), "CaseInsensitive")) options |= WebFindOptionsCaseInsensitive; else if (JSStringIsEqualToUTF8CString(optionName.get(), "AtWordStarts")) options |= WebFindOptionsAtWordStarts; else if (JSStringIsEqualToUTF8CString(optionName.get(), "TreatMedialCapitalAsWordStart")) options |= WebFindOptionsTreatMedialCapitalAsWordStart; else if (JSStringIsEqualToUTF8CString(optionName.get(), "Backwards")) options |= WebFindOptionsBackwards; else if (JSStringIsEqualToUTF8CString(optionName.get(), "WrapAround")) options |= WebFindOptionsWrapAround; else if (JSStringIsEqualToUTF8CString(optionName.get(), "StartInSelection")) options |= WebFindOptionsStartInSelection; } BOOL found = FALSE; if (FAILED(viewPrivate->findString(targetBSTR, static_cast<WebFindOptions>(options), &found))) return false; return found; } void TestRunner::setCacheModel(int cacheModel) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; preferences->setCacheModel(static_cast<WebCacheModel>(cacheModel)); } bool TestRunner::isCommandEnabled(JSStringRef /*name*/) { fprintf(testResult, "ERROR: TestRunner::isCommandEnabled() not implemented\n"); return false; } void TestRunner::waitForPolicyDelegate() { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; setWaitToDump(true); policyDelegate->setControllerToNotifyDone(this); webView->setPolicyDelegate(policyDelegate); } static _bstr_t bstrT(JSStringRef jsString) { // The false parameter tells the _bstr_t constructor to adopt the BSTR we pass it. return _bstr_t(JSStringCopyBSTR(jsString), false); } void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) { COMPtr<IWebViewPrivate2> webView; if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) return; webView->addOriginAccessWhitelistEntry(bstrT(sourceOrigin).GetBSTR(), bstrT(destinationProtocol).GetBSTR(), bstrT(destinationHost).GetBSTR(), allowDestinationSubdomains); } void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains) { COMPtr<IWebViewPrivate2> webView; if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) return; webView->removeOriginAccessWhitelistEntry(bstrT(sourceOrigin).GetBSTR(), bstrT(destinationProtocol).GetBSTR(), bstrT(destinationHost).GetBSTR(), allowDestinationSubdomains); } void TestRunner::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy) { // FIXME: implement } void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames) { COMPtr<IWebViewPrivate2> webView; if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) return; COMPtr<IWebScriptWorld> world; if (FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(world), reinterpret_cast<void**>(&world)))) return; webView->addUserScriptToGroup(_bstr_t(L"org.webkit.DumpRenderTree").GetBSTR(), world.get(), bstrT(source).GetBSTR(), nullptr, 0, nullptr, 0, nullptr, runAtStart ? WebInjectAtDocumentStart : WebInjectAtDocumentEnd, allFrames ? WebInjectInAllFrames : WebInjectInTopFrameOnly); } void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames) { COMPtr<IWebViewPrivate2> webView; if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView)))) return; COMPtr<IWebScriptWorld> world; if (FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(world), reinterpret_cast<void**>(&world)))) return; webView->addUserStyleSheetToGroup(_bstr_t(L"org.webkit.DumpRenderTree").GetBSTR(), world.get(), bstrT(source).GetBSTR(), nullptr, 0, nullptr, 0, nullptr, allFrames ? WebInjectInAllFrames : WebInjectInTopFrameOnly); } void TestRunner::setDeveloperExtrasEnabled(bool enabled) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebPreferences> preferences; if (FAILED(webView->preferences(&preferences))) return; COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); if (!prefsPrivate) return; prefsPrivate->setDeveloperExtrasEnabled(enabled); } void TestRunner::showWebInspector() { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate2> viewPrivate(Query, webView); if (!viewPrivate) return; COMPtr<IWebInspector> inspector; if (SUCCEEDED(viewPrivate->inspector(&inspector))) inspector->show(); } void TestRunner::closeWebInspector() { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate2> viewPrivate(Query, webView); if (!viewPrivate) return; COMPtr<IWebInspector> inspector; if (FAILED(viewPrivate->inspector(&inspector))) return; inspector->close(); } void TestRunner::evaluateInWebInspector(JSStringRef script) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate2> viewPrivate(Query, webView); if (!viewPrivate) return; COMPtr<IWebInspector> inspector; if (FAILED(viewPrivate->inspector(&inspector))) return; COMPtr<IWebInspectorPrivate> inspectorPrivate(Query, inspector); if (!inspectorPrivate) return; inspectorPrivate->evaluateInFrontend(bstrT(script).GetBSTR()); } JSStringRef TestRunner::inspectorTestStubURL() { CFBundleRef webkitBundle = webKitBundle(); if (!webkitBundle) return nullptr; RetainPtr<CFURLRef> url = adoptCF(CFBundleCopyResourceURL(webkitBundle, CFSTR("TestStub"), CFSTR("html"), CFSTR("WebInspectorUI"))); if (!url) return nullptr; return JSStringCreateWithCFString(CFURLGetString(url.get())); } typedef HashMap<unsigned, COMPtr<IWebScriptWorld> > WorldMap; static WorldMap& worldMap() { static WorldMap& map = *new WorldMap; return map; } unsigned worldIDForWorld(IWebScriptWorld* world) { WorldMap::const_iterator end = worldMap().end(); for (WorldMap::const_iterator it = worldMap().begin(); it != end; ++it) { if (it->value == world) return it->key; } return 0; } void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script) { // FIXME: Implement this. } void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script) { COMPtr<IWebFramePrivate> framePrivate(Query, frame); if (!framePrivate) return; // A worldID of 0 always corresponds to a new world. Any other worldID corresponds to a world // that is created once and cached forever. COMPtr<IWebScriptWorld> world; if (!worldID) { if (FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(world), reinterpret_cast<void**>(&world)))) return; } else { COMPtr<IWebScriptWorld>& worldSlot = worldMap().add(worldID, nullptr).iterator->value; if (!worldSlot && FAILED(WebKitCreateInstance(__uuidof(WebScriptWorld), 0, __uuidof(worldSlot), reinterpret_cast<void**>(&worldSlot)))) return; world = worldSlot; } _bstr_t result; if (FAILED(framePrivate->stringByEvaluatingJavaScriptInScriptWorld(world.get(), globalObject, bstrT(script).GetBSTR(), &result.GetBSTR()))) return; } void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL) { // Nothing implemented here (compare to Mac) } void TestRunner::apiTestGoToCurrentBackForwardItem() { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebBackForwardList> backForwardList; if (FAILED(webView->backForwardList(&backForwardList))) return; COMPtr<IWebHistoryItem> item; if (FAILED(backForwardList->currentItem(&item))) return; BOOL success; webView->goToBackForwardItem(item.get(), &success); } void TestRunner::setWebViewEditable(bool editable) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewEditing> viewEditing; if (FAILED(webView->QueryInterface(&viewEditing))) return; viewEditing->setEditable(editable); } void TestRunner::authenticateSession(JSStringRef, JSStringRef, JSStringRef) { fprintf(testResult, "ERROR: TestRunner::authenticateSession() not implemented\n"); } void TestRunner::abortModal() { // Nothing to do } void TestRunner::setSerializeHTTPLoads(bool serializeLoads) { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate2> viewPrivate; if (FAILED(webView->QueryInterface(&viewPrivate))) return; viewPrivate->setLoadResourcesSerially(serializeLoads); } void TestRunner::setTextDirection(JSStringRef direction) { COMPtr<IWebFramePrivate> framePrivate(Query, frame); if (!framePrivate) return; framePrivate->setTextDirection(bstrT(direction).GetBSTR()); } void TestRunner::addChromeInputField() { fprintf(testResult, "ERROR: TestRunner::addChromeInputField() not implemented\n"); } void TestRunner::removeChromeInputField() { fprintf(testResult, "ERROR: TestRunner::removeChromeInputField() not implemented\n"); } void TestRunner::focusWebView() { fprintf(testResult, "ERROR: TestRunner::focusWebView() not implemented\n"); } void TestRunner::setBackingScaleFactor(double) { // Not applicable } void TestRunner::resetPageVisibility() { COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate4> viewPrivate; if (FAILED(webView->QueryInterface(&viewPrivate))) return; viewPrivate->setVisibilityState(WebPageVisibilityStateVisible); } void TestRunner::setPageVisibility(const char* newVisibility) { if (!newVisibility) return; COMPtr<IWebView> webView; if (FAILED(frame->webView(&webView))) return; COMPtr<IWebViewPrivate4> viewPrivate; if (FAILED(webView->QueryInterface(&viewPrivate))) return; if (!strcmp(newVisibility, "visible")) viewPrivate->setVisibilityState(WebPageVisibilityStateVisible); else if (!strcmp(newVisibility, "hidden")) viewPrivate->setVisibilityState(WebPageVisibilityStateHidden); else if (!strcmp(newVisibility, "prerender")) viewPrivate->setVisibilityState(WebPageVisibilityStatePrerender); } void TestRunner::grantWebNotificationPermission(JSStringRef origin) { // FIXME: Implement. // See https://bugs.webkit.org/show_bug.cgi?id=172295 } void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin) { // FIXME: Implement. // See https://bugs.webkit.org/show_bug.cgi?id=172295 } void TestRunner::removeAllWebNotificationPermissions() { // FIXME: Implement. // See https://bugs.webkit.org/show_bug.cgi?id=172295 } void TestRunner::simulateWebNotificationClick(JSValueRef jsNotification) { // FIXME: Implement. // See https://bugs.webkit.org/show_bug.cgi?id=172295 } void TestRunner::simulateLegacyWebNotificationClick(JSStringRef title) { // FIXME: Implement. } unsigned TestRunner::imageCountInGeneralPasteboard() const { fprintf(testResult, "ERROR: TestRunner::imageCountInGeneralPasteboard() not implemented\n"); return 0; } void TestRunner::setSpellCheckerLoggingEnabled(bool enabled) { fprintf(testResult, "ERROR: TestRunner::setSpellCheckerLoggingEnabled() not implemented\n"); }
[ "ruka@1c.ru" ]
ruka@1c.ru
642f776d0af1e824a2fc823c4db950af22a3e0d6
818d205ced79f21481280f886de234f58e5f49cf
/CountItemsMatchingARule/count_items_matching_a_rule.h
f753f9daa3ebc66ff6299d9f2c1a0c3c82babd6c
[]
no_license
babypuma/leetcode
6cafe2495b1b77701589be7d44e2c42e467cba18
0ac08c56623d5990d7fde45d0cc962f5926c6b64
refs/heads/master
2022-06-15T17:03:53.515967
2022-05-31T16:24:30
2022-05-31T16:24:30
25,457,134
0
0
null
null
null
null
UTF-8
C++
false
false
719
h
/* * Author : Jeremy Zhao * Email : jqzhao@live.com * Date : 2021/03/01 * * Source : https://leetcode-cn.com/problems/count-items-matching-a-rule/ * Problem: Count Items Matching a Rule * */ #include <string> #include <vector> #include <unordered_map> using std::string; using std::vector; using std::unordered_map; class Solution { public: int countMatches(vector<vector<string> >& items, string ruleKey, string ruleValue) { unordered_map<string, int> freq; for (auto& v : items) { ++freq["type" + v[0]]; ++freq["color" + v[1]]; ++freq["name" + v[2]]; } string key = ruleKey + ruleValue; return freq.count(key) == 0 ? 0 : freq[key]; } };
[ "jqzhao@live.com" ]
jqzhao@live.com
0f91973e38c563ac4d6979f1765fa699a3cf9074
58cc6f1889aa214dab8c87e7eaae4d473564054f
/Geometry/main.cpp
8aed31f6b09d65abf7f06925cbd389508cd92f82
[]
no_license
adityarasam/cpp_basics_DS_Algos_Prac_Code
9c1b8f8f099d04c751825a3d0445c42bee8fff1c
9404512d5ad70390c1ce114ab0d95c36b05eafa8
refs/heads/master
2023-02-12T20:51:10.387383
2021-01-04T03:42:57
2021-01-04T03:42:57
326,561,286
0
0
null
null
null
null
UTF-8
C++
false
false
478
cpp
#include "Geom.h" int main() { point p1,p2, r, s, z; p1.x = 0.0; p1.y = 0.0; p2.x = 0.0; p2.y = 10.0; r.x = 3.0; r.y = 3.0; s.x = -3.0; s.y = 3.0; line l1(p1,p2); line l2(r,s); lineAlgo la ; //cout<<la.ColinearpointOnLine(l1,r)<<endl; z = la.pointOfIntersection(l1,l2); cout<<"("<<z.x<<", "<< z.y<<")"<<endl; //line* l = new line(p1,p2); cout << "Hello world!" << endl; return 0; }
[ "adityarasam10@gmail.com" ]
adityarasam10@gmail.com